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.
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
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
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.
>
>
>
>
>
>
>
>
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.
> >
> >
> >
> >
> >
> >
> >
> >
>
>