IIS 7 and database connections in global.asa

Discussion in 'Classic ASP' started by Brad, Jul 29, 2013.

  1. I'm trying to migrate my Classic ASP site from IIS 5 to IIS 7, but am running into an issue with my global.asa file that outputs the following error:

    error '80004005'
    /LM/W3SVC/3/ROOT/global.asa, line 20

    In Session_OnStart, I am trying to connect to my database using the following logic:

    Sub Session_OnStart
    dim db2, rs2
    Set db2 = Server.CreateObject("ADODB.Connection")
    Set rs2 = Server.CreateObject("ADODB.Recordset")
    db2.Open Application("connectionString")
    rs2.ActiveConnection = db2

    sql = "SELECT * FROM myTable"
    rs2.Open sql,,1,2 (line 20)


    I know my connection string is good because if I comment out these lines in global.asa, all of my .asp pages work flawlessly (they connect to the db with identical logic). The SQL statement is also correct.

    I've searched all over the web and haven't had much luck. Any help would be greatly appreciated.

    Thanks,
    Brad
     
  2. I may have resolved this, though I'm not sure why it works.

    I've replaced my original connection string:

    Provider= Microsoft.ACE.OLEDB.12.0;Data Source=e:\web\mysite\htdocs\App_Data\myDatabase.mdb​

    With this:

    Driver=Microsoft Access Driver (*.mdb);DBQ=e:\web\mysite\htdocs\App_Data\myDatabase.mdb;UID=;PWD=;​

    But as I mentioned above, the original connection string works fine outside of global.asa
     
  3. FrankC

    FrankC DiscountASP.NET Staff

    that is rather strange. Does the error contain more details?
     

Share This Page