#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2013
    Posts
    2
    Rep Power
    0

    Element DSN is undefined in APPLICATION (HELP)


    I have no clue about coldfusion I was simply making some changes to the html code of this website however when I uploaded the file to the server I got this error

    Element DSN is undefined in APPLICATION.

    I assume that this as something to do with the cold fusion as html wouldn't generate that error.

    heres the cold fusion code for the page


    [CODE][CODE]
    Code:
    <!--- Get and display course details --->
    <cfset CurrentPage = GetFileFromPath(GetTemplatePath())>
    <cfquery name="GetCourseType" datasource="#application.dsn#">
    	SELECT FeeType, CourseCode
    	FROM Pages INNER JOIN Courses ON Pages.PageId = Courses.PageId
    	WHERE PageFile = '#CurrentPage#'
    </cfquery>
    <style type="text/css">
    <!--
    .style1 {color: #FF0000}
    -->
    </style>
    
    <cfif GetCourseType.RecordCount>
    	<cfset FixedFound = False>
    	<cfset VariableFound = False>
    	<cfset HourlyFound = False>
    	<cfoutput query = "GetCourseType">
    		<cfif FeeType IS "VariableFees">
    			<cfset VariableFound = True>
    		<cfelseif  FeeType IS "Fixed">
    			<cfset FixedFound = True>
    		<cfelseif  FeeType IS "HourlyRate">
    			<cfset HourlyFound = True>
    		</cfif>
    	</cfoutput>
    	<cfif FixedFound>
    		<cfquery name="GetCourseDetails" datasource="#application.dsn#">
    			SELECT CourseTitle, CourseName, CourseLevel, CourseDays, CourseTimes, Dates, MaxStudents, CourseLength, CourseFee, RegistrationFee, SpecialOffer
    			FROM (Pages INNER JOIN Courses ON Pages.PageId = Courses.PageId)
    					INNER JOIN CourseDates ON Courses.CourseId = CourseDates.CourseId
    			WHERE PageFile = '#CurrentPage#' AND DisplayUntilDate > GetDate()
    			ORDER BY StartDate, CourseName
    		</cfquery>
    		<cfif GetCourseDetails.RecordCount>
    			<table class="Courses">
    				<cfoutput query="GetCourseDetails" group="CourseTitle">
    					<tr><th colspan="3">#HTMLEditFormat(CourseTitle)#</th></tr>
    					<cfoutput>
    						<tr>
    							<td>
    								<div style="font-weight:bold;">#HTMLEditFormat(CourseName)#</div>
    								<div>#HTMLEditFormat(CourseLevel)#</div>							</td>
    							<td>
    								<div>#HTMLEditFormat(CourseTimes)# - #HTMLEditFormat(CourseDays)#</div>
    								<div style="font-weight:bold;">#HTMLEditFormat(Dates)#</div>
    								<div>Maximum #HTMLEditFormat(MaxStudents)# participants</div>							</td>
    							<td>
    								<div style="font-weight:bold;">#HTMLEditFormat(CourseLength)#</div>
    								<div style="font-weight:bold;">Course fee: &pound;#NumberFormat(CourseFee)#</div>
    								<cfif RegistrationFee IS NOT 0><div>+ <span style="font-weight:bold;">&pound;#NumberFormat(RegistrationFee)# registration fee</span></div></cfif>
    								<cfif SpecialOffer IS 1><div class="Important"><a href="Special-Offers.cfm">Special offer available!</a></div></cfif>							</td>
    						</tr>
    					</cfoutput>				</cfoutput>
    			</table>
    		<cfelse>
    			<!--p style=" color:#CC3300">Sorry, no dates and fees available at the moment. In order to apply please <a href="Contact-King-Street.cfm">contact the school</a> directly.</p-->
    		</cfif>
    	</cfif>
    	<cfif VariableFound>
    		<cfinclude template="ITCourseGeneralInfo.cfm">
    		<cfif GetCourseType.CourseCode IS "GE4">
    			<cfquery name="GetCourseFees" datasource="#application.dsn#">
    				SELECT WeekNumber, Fee
    				FROM (Pages INNER JOIN Courses ON Pages.PageId = Courses.PageId)
    						INNER JOIN VariableFees ON Courses.CourseId = VariableFees.CourseId
    				WHERE PageFile = '#CurrentPage#'
    				ORDER BY WeekNumber
    			</cfquery>
    			<table class="Timetable">
    				<tr><th>Number of Weeks</th><cfoutput query="GetCourseFees"><th>#WeekNumber#</th></cfoutput></tr>
    				<tr><th>Fee</th><cfoutput query="GetCourseFees"><td>#Fee#</td></cfoutput></tr>
    			</table>
    		<cfelse>
    			<cfquery name="GetCourseFees" datasource="#application.dsn#">
    				SELECT WeekNumber, Fee, CourseCode, CourseName
    				FROM (Pages INNER JOIN Courses ON Pages.PageId = Courses.PageId)
    						INNER JOIN VariableFees ON Courses.CourseId = VariableFees.CourseId
    				WHERE PageFile = '#CurrentPage#' AND WeekNumber <= 10
    				ORDER BY CourseCode, WeekNumber
    			</cfquery>
    			<table class="Timetable" style="width:100%">
    				<tr><th colspan="13" id="TableTitle">Weeks 1 to 10</th></tr>
    				<tr><th>Code</th><th style="width:20%">Description</th><cfloop from=1 to=10 index="Week"><th><cfoutput>#Week#</cfoutput></th></cfloop></tr>
    				<cfoutput query="GetCourseFees" group="CourseCode">
    					<tr><th>#HTMLEditFormat(CourseCode)#</th><td>#HTMLEditFormat(CourseName)#</td>
    					<cfoutput>
    						<td>#Fee#</td>
    					</cfoutput>					</tr>
    				</cfoutput>
    			</table>
    			<cfquery name="GetCourseFees" datasource="#application.dsn#">
    				SELECT WeekNumber, Fee, CourseCode, CourseName
    				FROM (Pages INNER JOIN Courses ON Pages.PageId = Courses.PageId)
    						INNER JOIN VariableFees ON Courses.CourseId = VariableFees.CourseId
    				WHERE PageFile = '#CurrentPage#' AND WeekNumber > 10 AND WeekNumber <= 20 
    				ORDER BY CourseCode, WeekNumber
    			</cfquery>
    			<table class="Timetable" style="margin-top:1em;width:100%">
    				<tr><th colspan="12" id="TableTitle">Weeks 11 to 20</th></tr>
    				<tr><th>Code</th><th style="width:20%">Description</th><cfloop from=11 to=20 index="Week"><th><cfoutput>#Week#</cfoutput></th></cfloop></tr>
    				<cfoutput query="GetCourseFees" group="CourseCode">
    					<tr><th>#HTMLEditFormat(CourseCode)#</th><td>#HTMLEditFormat(CourseName)#</td>
    					<cfoutput>
    						<td>#Fee#</td>
    					</cfoutput>					</tr>
    				</cfoutput>
    			</table>
    			<cfquery name="GetCourseFees" datasource="#application.dsn#">
    				SELECT WeekNumber, Fee, CourseCode, CourseName
    				FROM (Pages INNER JOIN Courses ON Pages.PageId = Courses.PageId)
    						INNER JOIN VariableFees ON Courses.CourseId = VariableFees.CourseId
    				WHERE PageFile = '#CurrentPage#' AND WeekNumber > 20 AND WeekNumber <= 30 
    				ORDER BY CourseCode, WeekNumber
    			</cfquery>
    			<table class="Timetable" style="margin-top:1em;width:100%">
    				<tr><th colspan="12" id="TableTitle">Weeks 21 to 30</th></tr>
    				<tr><th>Code</th><th style="width:20%">Description</th><cfloop from=21 to=30 index="Week"><th><cfoutput>#Week#</cfoutput></th></cfloop></tr>
    				<cfoutput query="GetCourseFees" group="CourseCode">
    					<tr><th>#HTMLEditFormat(CourseCode)#</th><td>#HTMLEditFormat(CourseName)#</td>
    					<cfoutput>
    						<td>#Fee#</td>
    					</cfoutput>					</tr>
    				</cfoutput>
    			</table>
    			<cfquery name="GetCourseFees" datasource="#application.dsn#">
    				SELECT WeekNumber, Fee, CourseCode, CourseName
    				FROM (Pages INNER JOIN Courses ON Pages.PageId = Courses.PageId)
    						INNER JOIN VariableFees ON Courses.CourseId = VariableFees.CourseId
    				WHERE PageFile = '#CurrentPage#' AND WeekNumber > 30 AND WeekNumber <= 40 
    				ORDER BY CourseCode, WeekNumber
    			</cfquery>
    			<table class="Timetable" style="margin-top:1em;width:100%">
    				<tr><th colspan="12" id="TableTitle">Weeks 31 to 40</th></tr>
    				<tr><th>Code</th><th style="width:20%">Description</th><cfloop from=31 to=40 index="Week"><th><cfoutput>#Week#</cfoutput></th></cfloop></tr>
    				<cfoutput query="GetCourseFees" group="CourseCode">
    					<tr><th>#HTMLEditFormat(CourseCode)#</th><td>#HTMLEditFormat(CourseName)#</td>
    					<cfoutput>
    						<td>#Fee#</td>
    					</cfoutput>					</tr>
    				</cfoutput>
    			</table>
                <cfquery name="GetCourseFees" datasource="#application.dsn#">
    				SELECT WeekNumber, Fee, CourseCode, CourseName
    				FROM (Pages INNER JOIN Courses ON Pages.PageId = Courses.PageId)
    						INNER JOIN VariableFees ON Courses.CourseId = VariableFees.CourseId
    				WHERE PageFile = '#CurrentPage#' AND WeekNumber > 40 AND WeekNumber <= 50 
    				ORDER BY CourseCode, WeekNumber
    			</cfquery>
    			<table class="Timetable" style="margin-top:1em;width:100%">
    				<tr><th colspan="12" id="TableTitle">Weeks 41 to 50</th></tr>
    				<tr><th>Code</th><th style="width:20%">Description</th><cfloop from=41 to=50 index="Week"><th><cfoutput>#Week#</cfoutput></th></cfloop></tr>
    				<cfoutput query="GetCourseFees" group="CourseCode">
    					<tr><th>#HTMLEditFormat(CourseCode)#</th><td>#HTMLEditFormat(CourseName)#</td>
    					<cfoutput>
    						<td>#Fee#</td>
    					</cfoutput>					</tr>
    				</cfoutput>
    			</table>
                <cfquery name="GetCourseFees" datasource="#application.dsn#">
    				SELECT WeekNumber, Fee, CourseCode, CourseName
    				FROM (Pages INNER JOIN Courses ON Pages.PageId = Courses.PageId)
    						INNER JOIN VariableFees ON Courses.CourseId = VariableFees.CourseId
    				WHERE PageFile = '#CurrentPage#' AND WeekNumber > 50 AND WeekNumber <= 52 
    				ORDER BY CourseCode, WeekNumber
    			</cfquery>
    			<table class="Timetable" style="margin-top:1em;width:100%">
    				<tr><th colspan="12" id="TableTitle">Weeks 51 to 52</th></tr>
    				<tr><th>Code</th><th style="width:20%">Description</th><cfloop from=51 to=52 index="Week"><th><cfoutput>#Week#</cfoutput></th></cfloop></tr>
    				<cfoutput query="GetCourseFees" group="CourseCode">
    					<tr><th>#HTMLEditFormat(CourseCode)#</th><td>#HTMLEditFormat(CourseName)#</td>
    					<cfoutput>
    						<td>#Fee#</td>
    					</cfoutput>					</tr>
    				</cfoutput>
    			</table>
    		</cfif>
    	</cfif>
    	<cfif HourlyFound>
    		<cfquery name="GetCourseFees" datasource="#application.dsn#">
    			SELECT Rate, CourseName
    			FROM (Pages INNER JOIN Courses ON Pages.PageId = Courses.PageId)
    						INNER JOIN HourlyRates ON Courses.CourseId = HourlyRates.CourseId
    			WHERE PageFile = '#CurrentPage#' 
    		</cfquery>
    		<cfoutput query="GetCourseFees"><p>#HTMLEditFormat(CourseName)# from &pound;#DecimalFormat(Rate)# per hour.</p></cfoutput>
    	</cfif>
    <cfelse>
    	<!--p style=" color:#CC3300">Sorry, no course details available at the moment.</p-->
    
    
    
    </cfif>

    AND THIS IS THE HTML

    [CODE][CODE]
    Code:
    <!-- InstanceBegin template="/Templates/course.dwt.cfm" codeOutsideHTMLIsLocked="false" -->
    <head>
    	<!-- InstanceBeginEditable name="doctitle" -->
    	<title>English Language Courses from King Street College</title>
    	<meta name="Description" content="English Language Courses from King Street College">
    	<meta name="Keywords" content="English Language Courses, training, classes, English speakers, King Street College, Shepherds Bush, London, UK">
    
    
    	<!-- InstanceEndEditable -->
    	<link rel="stylesheet" type="text/css" href="KingStreet.css">
    <!--[if IE]>
    <style type="text/css" media="screen">
    /* csshover.htc file V1.21.041022 available for download from: http://www.xs4all.nl/~peterned/csshover.html */
    body{behavior:url(csshover.htc);}
    #Navigation ul li{float:left;height:1%;width:100%;}
    #Navigation ul li a{height:1%;}
    </style>
    <![endif]-->
        <!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
    </head>
    <!-- InstanceBeginEditable name="Code" -->
    <!--- Code --->
    <!-- InstanceEndEditable -->
    
    <body>
    <div id="Page">
    	<div id="TopStrip">
    		<div style="float:right;padding-right:7px;padding-top:7px;">
    			<span style="font-size:1em;">Language:</span><div id="google_translate_element"></div><script type="text/javascript">
    function googleTranslateElementInit() {
      new google.translate.TranslateElement({pageLanguage: 'en', layout: google.translate.TranslateElement.InlineLayout.HORIZONTAL, gaTrack: true, gaId: 'UA-28445039-1'}, 'google_translate_element');
    }
    </script><script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script></div>
    		<a href="http://www.kingstreet.co.uk"><img src="images/King_Street_College.gif" alt="King Street College" width="369" height="45" style="padding-top:6px;"></a>
    		<div style="padding-top:2px;">
    			<a href="index.cfm"><span style="font-size:1.2em;">A Part of The Burlington School of English</span></a>
    		</div>
    	</div>
    	<div id="Wrapper">
    		<div id="Navigation"><cfinclude template="ITMenu.cfm"></div>
    		<div id="Content">
    		<!-- InstanceBeginEditable name="PreDates" -->
     		<div id="Crumbtrail"><a href="Specialist-English-Courses.cfm">Specialist English Courses</a></div>
    		<h2>Business English</h1>
    		<h2> 4 hours a week (BEC4)</h2>
    		<p>The Business English Course concentrates on the English language skills necessary to work in an English speaking environment. The course includes useful commercial vocabulary, relevant speaking skills (telephone language, giving presentations, contributing to meetings, socialising with clients etc.) and help with writing letters and reports. It also covers cross cultural issues, and how to write a CV and have a job interview in English.</p>
    		<p>This course is an ideal starting starting point for students intending to work in the EU or a commercial English speaking environment.</p>
    		<p>These classes are not suitable for executive level employees who may prefer specialist language training that could be more properly provided in <a href="Special-Courses.cfm">one to one classes</a>.</p>
    		<table class="CourseDescription">
    			<tr><th>Business English</th>
    			  <th>BEC4<sup>*</sup></th>
    		  </tr>
    			<tr><th>Course description</th>
    			  <td>4 hours of evening Business English class per week</td>
    		  </tr>
    			<tr><th>Class time</th>
    			  <td>18:30 - 20:30</td>
    		  </tr>
    			<tr><th>Minimum level</th>
    			<td >Upper-Intermediate</td>
    			</tr>
    			<tr><td class="Important" colspan="3"><sup>*</sup> subject to demand and availability</td></tr>
    		</table>
    		<!-- InstanceEndEditable -->
    		<cfinclude template="ITCourseDetails.cfm">
    		<!-- InstanceBeginEditable name="PostDates" -->
    		<!-- InstanceEndEditable -->	    
    	    <!-- InstanceBeginEditable name="TopPanelImage" -->
    			<img src="images/King_Street_College_Front.jpg" alt="Front of King Street College building" width="396" height="64" border="0"> 
    			<!-- InstanceEndEditable --></div>
    		<div id="Clear"></div>
    	</div>
    </div>
    <!-- InstanceBeginEditable name="Credits" -->
    <!-- InstanceEndEditable -->
    </body>
    <!-- InstanceEnd --></html>
  2. #2
  3. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,286
    Rep Power
    968
    Something somewhere in the application was setting a variable named DSN into the application scope. This is often done in a file named Application.cfm or Application.cfc. However, application-scoped variables can be set in any CFML or CFSCRIPT code, so there's really no telling where it was being set. I would compare revisions in your version control system from before and after you made your changes to try and locate where it got removed.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2013
    Posts
    2
    Rep Power
    0
    Thank you for your reply, I found the application.cfm file however it is blank?! how could this be possible I didn't touch it, and there is no back up!
  6. #4
  7. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,286
    Rep Power
    968
    Well it's possible that it is intended to be blank, though that sounds unlikely.

    If the file contents were deleted, obviously there's no way I can know how that happened. And if there's no backup? Well, to be blunt, someone should be fired for that. Hopefully you're not the person responsible for implementing a change management plan. But whoever is should be fired immediately.

    It's insane to not use a version control system like Subversion or Git. Beyond insane. They're free, proven, and easy to use. There's absolutely no excuse for not using a version control system.

    Sorry, but if there's no backup and no version control, there's not much you can do.
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2014
    Posts
    1
    Rep Power
    0

    Unhappy Can't figure out what changed


    I am using Oracle 11g and ColdFusion 8. I adapted the ColdFusion login Framework code from Forta & Camdem and have been using it for a few years now without any problem. The last time I used my site was a few months ago. When I tested it yesterday, I got the following error message:

    Element DATASOURCE is undefined in APPLICATION.

    The DB table, datasource, username, password, or code hasn't changed in any of the pages. The Application.cfc file has the following function:

    <cffunction name="onApplicationStart" output="false" returnType="void">
    <cfset APPLICATION.dataSource="mydatasource">
    <cfset APPLICATION.username="myusername">
    <cfset APPLICATION.password="mypassword">
    </cffunction>

    The robust exception points to the forceUserLogin.cfm:

    <cfquery name="getUser"
    datasource="#APPLICATION.dataSource#" ----- This is where the error pops
    password="#APPLICATION.password#"
    username="#APPLICATION.username#">
    select *
    from tblogin
    where uname = "#Form.UserLogin#"
    and pwd = "#Form.UserPassword#"
    </cfquery>

    In trying to figure out what was happening, I hardcoded the datasource, password, and username in forceUserLogin.cfm, and then got the following error:


    Error Executing Database Query.

    [Macromedia][Oracle JDBC Driver][Oracle]ORA-01017: invalid username/password; logon denied

    I know the username and password are correct, because I can login to Oracle via SQL*Plus. This is killing me!

    So my questions are:

    1) Any idea of what may have caused the code to stop working?
    2) Is the second mistake related to the first one?

    Any assistance will be greatly appreciated.
  10. #6
  11. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,286
    Rep Power
    968
    First I'd use the Subversion or Git log to look at the file history (or the history of the entire project) to look for any code change that may have affected this.

    As far as the database login problem, it could be a number of things. The user name or password could be wrong. Or the CF server may be blocked (e.g. by a firewall) from reaching the database. Or the database could be set up to only allow connections of a specific type, or to a specific database, or from specific IP addresses. My guess would be that something changed in the database config or in the network config between the CF server and the database.

IMN logo majestic logo threadwatch logo seochat tools logo