Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Global.asa errors

Status
Not open for further replies.

Anesthaesia

Technical User
Aug 30, 2001
126
0
0
GB
Hi,

I am using Web Reporting for SMS 2.0

When I try run a report, I get the following error :
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified [-2147467259]

I have found that manually editing and entering the connection string from the global.asa file into the .asp file makes the report work. It seems the session variables from the global.asa are therefore not being loaded. Does anyone know why this is happening ?
 
can you post your Session_OnStart sub

_________________________________________________________
[sub]$str = "sleep is good for you. sleep gives you the energy you need to function";
$Nstr = ereg_replace("sleep","coffee",$str); echo $Nstr;[/sub]
onpnt2.gif
[sup] [/sub]
 
Sub Session_OnStart

dim strConn 'holds the connection string for the SMS database
dim sUser 'the user name to uses to connect to the SMS database
dim sPassword 'the password for the user
dim sCatalog 'the name of the database to connect to
dim sSource 'the NetBios name of the SQL server machine that holds the database
dim sTimeout 'the query timeout

'SQL Server OLEDB connection string information
sUser = "smsschm_user" 'User Name to use when connecting to the database
sPassword = "(password)"
sCatalog="SMS"
sSource="(machine name)"
sTimeout=300

'the entire connection string
Session("strConn") = "Provider=SQLOLEDB.1;User ID=" & sUser & ";Password=" & sPassword & ";Initial Catalog=" & sCatalog & ";Data Source=" & sSource

'the timeout period (in seconds) to wait before generating an error
Session("iTimeOut") = sTimeout

'the user name to uses to connect to the SMS database
Session("sUser") = sUser

'the name of the database to connect to
Session("sCatalog") = sCatalog

'the NetBios name of the SQL server machine that holds the database
Session("sSource") = sSource

End Sub
 
Please note I replaced the sPassword and sSource only for posting purposes. They are valid details.
 
there is a possibility the path is invalid in the global.
try Server.MapPath(sCatalog)


_________________________________________________________
[sub]$str = "sleep is good for you. sleep gives you the energy you need to function";
$Nstr = ereg_replace("sleep","coffee",$str); echo $Nstr;[/sub]
onpnt2.gif
[sup] [/sub]
 
Where will I enter that ? (my asp knowledge is very limited)
 
'the name of the database to connect to
Session("sCatalog") = Server.MapPath(sCatalog)

_________________________________________________________
[sub]$str = "sleep is good for you. sleep gives you the energy you need to function";
$Nstr = ereg_replace("sleep","coffee",$str); echo $Nstr;[/sub]
onpnt2.gif
[sup] [/sub]
 
OLEDB doesn't require mappath for SQL Server. Are you connecting to a SQL Server database?

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rich Cook
 
DO you have cookies enabled? If not, the session variables do not persist. I usually use application variables to ensure connection pooling.

On your asp page where you are getting the error try this:

response.write session("strConn")
response.end

does it look right?

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rich Cook
 
Cookies are enabled.

I get a blank page if I add the (response.write) lines to the asp page, and if I remove them, I get the connection error.

SMS, SQL and IIS are all running on the same server. I am unable to view the reports from either the server or a workstation.
 
if you are getting a blank page, that means that there is no value in session("strConn"). On an of your asp pages, try to view each of your session variables and see if any of them exist. You may have a typo or perhaps the session_onStart is not firing...


response.write Session(&quot;strConn&quot;) & &quot;<--<br>&quot;
response.write Session(&quot;iTimeOut&quot;) & &quot;<--<br>&quot;
response.write Session(&quot;sUser&quot;) & &quot;<--<br>&quot;
response.write Session(&quot;sCatalog&quot;) & &quot;<--<br>&quot;
response.write Session(&quot;sSource&quot;) & &quot;<--<br>&quot;

response.end

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rich Cook
 
Still a blank page. None of the variables exist. I did a
response.write &quot;TEST&quot;, and it displayed fine.
 
have you made sure that you've started a new session? In IIS, stop the site and restart it to ensure that you have killed all of the pages. Another option is to

session.abandon
response.redirect &quot;anotherASPpage.asp&quot;

which will call your session_onStart again..

You may also want to simplify your session_onStart for debugging....

Sub Session_OnStart
session(&quot;strConn&quot;) = &quot;Test String&quot;

End Sub



Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rich Cook
 
Verify that your web site has an Application Space set up for it...under IIS...if you don't see a Remove button next to the Application Name field then your global.asa will never get read...
 
Tried it all - still not working.

Could it have anything to do with access rights ? I read a Miscrosoft article that said global.asa needs special access rights. I tried changing the settings as per the instructions, but still had no luck (there's also no special security settings on the server)

It's clearly a case of the variables not being stored or the session_onStart not firing.

The asp pages work fine if I manually enter the connection string
 
is your global.asa file in the root directory of the site and named &quot;global.asa&quot;?

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rich Cook
 
I am having the exact same errors. If anyone knows the answer, please reply as soon as possible.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top