Problem accessing SQL server from ASP


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 7 of 7

Thread: Problem accessing SQL server from ASP

  1. #1
    Thomas Guest

    Problem accessing SQL server from ASP

    I'm trying to debug a VI application that uses a SQL server database. I'm
    VERY NEW at using SQL Server.

    In the ASP Application_OnStart, the connect string is setup:
    Application("DBConnectString") = "DSN=MyDatabase;UID=sa;PWD=;"

    This variable is passed to VB components that connect to the database. I
    have checked the values of the VB objects from VI debugger, and the connect
    string is correct. This same connect string works fine in VB client
    applications hitting the same VB DLL component.

    However, the ASP calls that use the database fail. In the application log,
    I have an entry like this (application & computernames changed):

    The VB Application identified by the event source logged this Application
    XYZName: Thread ID: 3272 ,Logged: A SSDBMgr error occurred in module
    'EmailType', in the method 'RetrieveEmailTypes', the error text is as
    follows: [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for
    user 'computername\IWAM_computername'.SQL=SELECT ID as 'ID', Description as
    'Description' .....

    Other hits to the database report a similar error except that user is
    IUSR_computername instead of IWAM_computername.

    What have I done incorrectly?

    Thanks.









  2. #2
    Pramod Patil Guest

    Re: Problem accessing SQL server from ASP


    "Thomas" <thomas3617@spamcop.net> wrote:
    >I'm trying to debug a VI application that uses a SQL server database. I'm
    >VERY NEW at using SQL Server.
    >
    >In the ASP Application_OnStart, the connect string is setup:
    > Application("DBConnectString") = "DSN=MyDatabase;UID=sa;PWD=;"
    >
    >This variable is passed to VB components that connect to the database.

    I
    >have checked the values of the VB objects from VI debugger, and the connect
    >string is correct. This same connect string works fine in VB client
    >applications hitting the same VB DLL component.
    >
    >However, the ASP calls that use the database fail. In the application log,
    >I have an entry like this (application & computernames changed):
    >
    >The VB Application identified by the event source logged this Application
    >XYZName: Thread ID: 3272 ,Logged: A SSDBMgr error occurred in module
    >'EmailType', in the method 'RetrieveEmailTypes', the error text is as
    >follows: [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for
    >user 'computername\IWAM_computername'.SQL=SELECT ID as 'ID', Description

    as
    >'Description' .....
    >
    >Other hits to the database report a similar error except that user is
    >IUSR_computername instead of IWAM_computername.
    >
    >What have I done incorrectly?
    >
    >Thanks.
    >
    >
    >
    >
    >
    >
    >
    >

    Firs of all don't initiate any object in the application on_start event,
    if u r aware with ASP, then u know this object will initiate once when first
    time the the site is visited and destroy only when the server put down.

    If possible then just try to open the connection with database on the page
    itself where u want to retrieve the data.
    If the same connection string is been working in VB then the same must have
    to work with ASP.

    This is from me.

    Bye for now
    Regards,
    -pramod

  3. #3
    Thomas Guest

    Re: Problem accessing SQL server from ASP

    Thanks for the reply.

    I am aware of the perpetual nature of the object instantiated in Application
    On_Start. This is one object that manages the application running behind
    the ASP.

    I "fixed" the problem I was having by disallowing anonymous access to the
    Web site (my local copy of the site). Since ASP instantiated the VB
    objects, it "owned" them under the anonymous user account IUSR_

    I think this solution is only practical with the development machines.
    Anyone think otherwise?



    "Pramod Patil" <patilp@rediffmail.com> wrote in message
    news:3b25f56a$1@news.devx.com...
    >
    > "Thomas" <thomas3617@spamcop.net> wrote:
    > >I'm trying to debug a VI application that uses a SQL server database.

    I'm
    > >VERY NEW at using SQL Server.
    > >
    > >In the ASP Application_OnStart, the connect string is setup:
    > > Application("DBConnectString") = "DSN=MyDatabase;UID=sa;PWD=;"
    > >
    > >This variable is passed to VB components that connect to the database.

    > I
    > >have checked the values of the VB objects from VI debugger, and the

    connect
    > >string is correct. This same connect string works fine in VB client
    > >applications hitting the same VB DLL component.
    > >
    > >However, the ASP calls that use the database fail. In the application

    log,
    > >I have an entry like this (application & computernames changed):
    > >
    > >The VB Application identified by the event source logged this Application
    > >XYZName: Thread ID: 3272 ,Logged: A SSDBMgr error occurred in module
    > >'EmailType', in the method 'RetrieveEmailTypes', the error text is as
    > >follows: [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for
    > >user 'computername\IWAM_computername'.SQL=SELECT ID as 'ID', Description

    > as
    > >'Description' .....
    > >
    > >Other hits to the database report a similar error except that user is
    > >IUSR_computername instead of IWAM_computername.
    > >
    > >What have I done incorrectly?
    > >
    > >Thanks.
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >

    > Firs of all don't initiate any object in the application on_start event,
    > if u r aware with ASP, then u know this object will initiate once when

    first
    > time the the site is visited and destroy only when the server put down.
    >
    > If possible then just try to open the connection with database on the page
    > itself where u want to retrieve the data.
    > If the same connection string is been working in VB then the same must

    have
    > to work with ASP.
    >
    > This is from me.
    >
    > Bye for now
    > Regards,
    > -pramod




  4. #4
    Sergey Kats Guest

    Re: Problem accessing SQL server from ASP

    First why use ODBC? You're adding an extra layer to the connection.
    Use OLE DB driver for SQL Server:
    Provider=SQLOLEDB.1;Initial Catalog=YourDB;Data Source=YourSQLServer;User
    ID=sa;Password=;Persist Security Info=True;

    I believe that should take care of your problem too.

    Sergey Kats
    Brainbench VB MVP
    http://www.brainbench.com

    "Thomas" <thomas3617@spamcop.net> wrote in message
    news:3b253548@news.devx.com...
    > I'm trying to debug a VI application that uses a SQL server database. I'm
    > VERY NEW at using SQL Server.
    >
    > In the ASP Application_OnStart, the connect string is setup:
    > Application("DBConnectString") = "DSN=MyDatabase;UID=sa;PWD=;"
    >
    > This variable is passed to VB components that connect to the database. I
    > have checked the values of the VB objects from VI debugger, and the

    connect
    > string is correct. This same connect string works fine in VB client
    > applications hitting the same VB DLL component.
    >
    > However, the ASP calls that use the database fail. In the application

    log,
    > I have an entry like this (application & computernames changed):
    >
    > The VB Application identified by the event source logged this Application
    > XYZName: Thread ID: 3272 ,Logged: A SSDBMgr error occurred in module
    > 'EmailType', in the method 'RetrieveEmailTypes', the error text is as
    > follows: [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for
    > user 'computername\IWAM_computername'.SQL=SELECT ID as 'ID', Description

    as
    > 'Description' .....
    >
    > Other hits to the database report a similar error except that user is
    > IUSR_computername instead of IWAM_computername.
    >
    > What have I done incorrectly?
    >
    > Thanks.
    >
    >
    >
    >
    >
    >
    >
    >




  5. #5
    Thomas Guest

    Re: Problem accessing SQL server from ASP

    That's true, but I was trying to debug an application that was setup this
    way. We'll probably change it before updating the site.

    The actual problem was an authentication problem with the SQL server
    database setup that is fixed now.

    Thanks for the reply.

    "Sergey Kats" <sctrl@hotmail.com.spam> wrote in message
    news:3b276735$1@news.devx.com...
    > First why use ODBC? You're adding an extra layer to the connection.
    > Use OLE DB driver for SQL Server:
    > Provider=SQLOLEDB.1;Initial Catalog=YourDB;Data Source=YourSQLServer;User
    > ID=sa;Password=;Persist Security Info=True;
    >
    > I believe that should take care of your problem too.
    >
    > Sergey Kats
    > Brainbench VB MVP
    > http://www.brainbench.com
    >
    > "Thomas" <thomas3617@spamcop.net> wrote in message
    > news:3b253548@news.devx.com...
    > > I'm trying to debug a VI application that uses a SQL server database.

    I'm
    > > VERY NEW at using SQL Server.
    > >
    > > In the ASP Application_OnStart, the connect string is setup:
    > > Application("DBConnectString") = "DSN=MyDatabase;UID=sa;PWD=;"
    > >
    > > This variable is passed to VB components that connect to the database.

    I
    > > have checked the values of the VB objects from VI debugger, and the

    > connect
    > > string is correct. This same connect string works fine in VB client
    > > applications hitting the same VB DLL component.
    > >
    > > However, the ASP calls that use the database fail. In the application

    > log,
    > > I have an entry like this (application & computernames changed):
    > >
    > > The VB Application identified by the event source logged this

    Application
    > > XYZName: Thread ID: 3272 ,Logged: A SSDBMgr error occurred in module
    > > 'EmailType', in the method 'RetrieveEmailTypes', the error text is as
    > > follows: [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for
    > > user 'computername\IWAM_computername'.SQL=SELECT ID as 'ID', Description

    > as
    > > 'Description' .....
    > >
    > > Other hits to the database report a similar error except that user is
    > > IUSR_computername instead of IWAM_computername.
    > >
    > > What have I done incorrectly?
    > >
    > > Thanks.
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >

    >
    >




  6. #6
    Join Date
    Nov 2009
    Posts
    1
    "
    Re: Problem accessing SQL server from ASP
    That's true, but I was trying to debug an application that was setup this
    way. We'll probably change it before updating the site.

    The actual problem was an authentication problem with the SQL server
    database setup that is fixed now"

    could you please tell me how you resolved the authentication peoblem with sql server
    thanks
    regards
    anamika

  7. #7
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    You responded to a thread that is over 8 years old...

    Whatever they did back then might not even work for the version of SQL Server you are running today.

    By the way, what version of SQL Server are you running and what type of authentication are you using (or trying to use)?
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center