Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: (0x80004005) Unspecified error


Message #1 by "Bryan S Couch" <stacey@t...> on Thu, 19 Dec 2002 00:35:15
Please can anybody help with the following problem?  I am trying to open a 
connection a MS Access database with this string:

JET STRING DOES NOT WORK
set rsSecurity = Server.CreateObject("ADODB.Recordset")
SecurityString = "Provider=Microsoft.Jet.OLEDB.4.0; Data 
Source=\dbdir\authorities\webSecurity.mdb; User Id=admin; Password="
rsSecurity.ActiveConnection = SecurityString
rsSecurity.Source = ("SELECT Security.UserName, Security.Password, 
Security.Connection FROM Security;")
rsSecurity.Open 

This gives me the error ?(0x80004005) Unspecified error?.  If I use this 
connection string everything works fine but I know there are problems with 
this type of connection:

ACCESS DRIVER STRING DOES WORK
set rsSecurity = Server.CreateObject("ADODB.Recordset")
rsSecurity.ActiveConnection = "Driver={Microsoft Access Driver 
(*.mdb)};DBQ=c:\dbdir\authorities\webSecurity.mdb"
rsSecurity.ActiveConnection = SecurityString
rsSecurity.Source = ("SELECT Security.UserName, Security.Password, 
Security.Connection FROM Security;")
rsSecurity.Open 

I am using the JET driver to connect to other databases with this 
connection string, which works fine:

JET STRING THAT DOES WORK
set rsSummonsData = Server.CreateObject("ADODB.Recordset")
rsSummonsData.ActiveConnection = Debtor_Connectionrs
SummonsData.Source = ("SELECT [SUMMONS RECORDS].[UNIQUE KEY]" _
& "FROM   [SUMMONS RECORDS] " _
& "WHERE  [SUMMONS RECORDS].[UNIQUE KEY] = ('" & searchString & "');")
rsSummonsData.CursorLocation = adUseClient
rsSummonsData.Open()

I have installed the latest MDAC and JET drivers from Microsoft.  Please 
can anybody help I am really in need of some help here.  I am running W2K 
Pro with IIS 5 and Access 2000 but it is going to be deployed on a NT 4 SP 
6a machine.

Again any help would be appreciated.
Message #2 by "Ken Schaefer" <ken@a...> on Thu, 19 Dec 2002 11:32:07 +1100
Hi Bryan,

Try this:

rsSecurity.Source = ("SELECT Security.UserName, Security.[Password],
Security.Connection FROM Security;")

as "Password" is a reserved word. The ODBC driver automagically puts [ ]
around reserved words, the OLEDB Provider doesn't.

Also, don't use a connection string for the ActiveConnection property - use
an actual connection object.

Set objRS.ActiveConnection = objConn

Cheers
Ken


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Bryan S Couch" <stacey@t...>
Subject: [access_asp] (0x80004005) Unspecified error


: Please can anybody help with the following problem?  I am trying to open a
: connection a MS Access database with this string:
:
: JET STRING DOES NOT WORK
: set rsSecurity = Server.CreateObject("ADODB.Recordset")
: SecurityString = "Provider=Microsoft.Jet.OLEDB.4.0; Data
: Source=\dbdir\authorities\webSecurity.mdb; User Id=admin; Password="
: rsSecurity.ActiveConnection = SecurityString
: rsSecurity.Source = ("SELECT Security.UserName, Security.Password,
: Security.Connection FROM Security;")
: rsSecurity.Open
:
: This gives me the error ?(0x80004005) Unspecified error?.  If I use this
: connection string everything works fine but I know there are problems with
: this type of connection:
:
: ACCESS DRIVER STRING DOES WORK
: set rsSecurity = Server.CreateObject("ADODB.Recordset")
: rsSecurity.ActiveConnection = "Driver={Microsoft Access Driver
: (*.mdb)};DBQ=c:\dbdir\authorities\webSecurity.mdb"
: rsSecurity.ActiveConnection = SecurityString
: rsSecurity.Source = ("SELECT Security.UserName, Security.Password,
: Security.Connection FROM Security;")
: rsSecurity.Open
:
: I am using the JET driver to connect to other databases with this
: connection string, which works fine:
:
: JET STRING THAT DOES WORK
: set rsSummonsData = Server.CreateObject("ADODB.Recordset")
: rsSummonsData.ActiveConnection = Debtor_Connectionrs
: SummonsData.Source = ("SELECT [SUMMONS RECORDS].[UNIQUE KEY]" _
: & "FROM   [SUMMONS RECORDS] " _
: & "WHERE  [SUMMONS RECORDS].[UNIQUE KEY] = ('" & searchString & "');")
: rsSummonsData.CursorLocation = adUseClient
: rsSummonsData.Open()
:
: I have installed the latest MDAC and JET drivers from Microsoft.  Please
: can anybody help I am really in need of some help here.  I am running W2K
: Pro with IIS 5 and Access 2000 but it is going to be deployed on a NT 4 SP
: 6a machine.
:
: Again any help would be appreciated.

Message #3 by "Bryan S Couch" <stacey@t...> on Thu, 19 Dec 2002 00:59:52
SOrry Ken tried what you suggested and it doesn't work still get some 
error message.  I was a little confused though by your last comment 
objConn part.  Cany you give me a little more information.

Thanks

Stacey
Message #4 by "Bryan S Couch" <stacey@t...> on Thu, 19 Dec 2002 01:21:11
Ken 

IT WORKED!!!

What I did the second time round is put all the fields in [ ] and it now 
works.  You're a life saver !!!!

Thanks very much

Stacey

Code now looks like this:

SecurityString = "Provider=Microsoft.Jet.OLEDB.4.0; Data 
Source=\dbdir\authorities\webSecurity.mdb; User Id=admin; Password="
rsSecurity.ActiveConnection = SecurityString
rsSecurity.Source = ("SELECT Security.[UserName], Security.[Password], 
Security.[Connection] FROM Security;")
rsSecurity.Open 
Message #5 by "Ken Schaefer" <ken@a...> on Thu, 19 Dec 2002 13:15:41 +1100
Connection may also be a reserved word...

In terms of using a connection object, I mean:

Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open SecurityString

Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open strSQL, objConn

' - OR-  the way you are doing it
objRS.Source = strSQL
Set objRS.ActiveConnection = objConn

Why? Connection Pooling:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnmdac/html
/pooling2.asp
explains connection pooling

http://support.microsoft.com/default.aspx?scid=kb;EN-US;191572
explaing connection pool management in ASP

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
----- Original Message -----
From: "Bryan S Couch" <stacey@t...>
To: "Access ASP" <access_asp@p...>
Sent: Thursday, December 19, 2002 1:21 AM
Subject: [access_asp] Re: (0x80004005) Unspecified error


: Ken
:
: IT WORKED!!!
:
: What I did the second time round is put all the fields in [ ] and it now
: works.  You're a life saver !!!!
:
: Thanks very much
:
: Stacey
:
: Code now looks like this:
:
: SecurityString = "Provider=Microsoft.Jet.OLEDB.4.0; Data
: Source=\dbdir\authorities\webSecurity.mdb; User Id=admin; Password="
: rsSecurity.ActiveConnection = SecurityString
: rsSecurity.Source = ("SELECT Security.[UserName], Security.[Password],
: Security.[Connection] FROM Security;")
: rsSecurity.Open


  Return to Index