Re: ADODB.Connection object not returning correct ConnectonString prop





"Eliz" <Eliz@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:822B738C-7977-42A4-87DE-D79C13E396CC@xxxxxxxxxxxxxxxx
I have a Windows Server 2008 box with Oracle 10.2.0.4 (32bit) drivers
installed.

I have a small script that
1. creates an ADO connection object,
2. sets the ConnectionString to a VALID ODBC Connectsion (using the
{DRIVER=} parameter),
3. Opens the connection (successfully)
4. Returns the Conn.ConnectionString property.

The connectionstring property returns the MSDASQL provider BUT, it does
not
return the rest of the Extended Properties data needed to be a valid
connection string.

Has anyone seen this or know of a fix?

I've attached the script below. (It happens using both a .vbs or a .js)

Run the script using the wscript.exe in the SYSWOW64 folder.

' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Option Explicit

Dim conn
Dim connStr
connStr = "DRIVER={Oracle in
OraClient10gWin2K8x86};DBQ=ORCL;UID=SCOTT;PWD=TIGER;"
Set conn = CreateObject("ADODB.Connection")
conn.ConnectionString = connStr
MsgBox conn.ConnectionString
conn.Open connStr
'Should NOT return "Provider=MSDASQL.1;"
MsgBox "Connection Opened"
MsgBox conn.ConnectionString
MsgBox "Done."


[Warning! A partially (or even fully) unsatisfactory answer follows.]

I'm not positive but a guess is that ADO is using the MSDASQL Provider to
provide OLE DB support for ODBC.

All data access is through a layer of components. In your current situation:
The ADO data access library as a client has to use an OLE DB service.
A provider that provides OLE DB service for the ADO client and talk to an
ODBC Driver. (MSDASQL)
The ODBC Driver in turn provides an ODBC interface for the client (in this
case MSDASQL), and supports talking to an Oracle ODBC service which can talk
to the Natvie Oracle OCI.
ie, you have a stack that looks something like this ...
ADO Data Access Library
OLE DB for ODBC Provider
ODBC Driver
ODBC for Oracle OCI engine
Oracle Engine

This kind of setup is notorious for confusing the 'H' out of programmers and
components. Behaviors range from unsupported ADODB methods, to intermittent
connnection problems, to spurious ugly but benign 'errors', to mix 'n match
issues (ProviderA works with DriverB and DriverC, but not with DriverA which
works with ProviderB, to ...) I'm not surprised that your query returned
'erronous' information. For as far as ADO is concerned - MSDASQL *IS* the
provider.

The solution? DO NOT USE ODBC with ADO!
There is no good reason to do so. All it does is add layers the opportunity
for problems.
Use the MS or Oracle OLE DB Provider. (I'd go with Oracle's)
Then your stack will look like this...
ADO Data Access Library
OLE DB for Oracle OCI Provider
Oracle Engine

Everyone is happy. Things run faster. Trees sing, the sun shines, squirrels
dance, and everyone gets to go home at 5pm.

hth
-ralph




.



Relevant Pages

  • Re: Problem updating a record containing a negative Value
    ... If it is the same in ADO or ADO.NET then this is definitely a bug in ODBC ... driver from the vendor. ...
    (microsoft.public.data.ado)
  • Re: DSN-less connection for Informix database
    ... build an odbc for using the specificed driver ... ... Pervasive ODBC client Interface ... ... having to SETUP an odbc connection profile .. ... in your connection string, replace the DNS=jaco ... ...
    (microsoft.public.dotnet.languages.vb)
  • Re: DSN-less connection for Informix database
    ... registry to get this information ... ... for each installed ODBC driver you have a key / value combination ... ... on is having to SETUP an odbc connection profile .. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: DSN-less connection for Informix database
    ... Is there a way to find out the ODBC driver version on the client ... on is having to SETUP an odbc connection profile .. ... in your connection string, replace the DNS=jaco ... ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Cobol MS-Access
    ... Micro Focus COBOL.> ... ODBC driver, sometimes without requiring any change to the COBOL code, BUT ... Cursors in ODBC hold the DB connection for as long as the cursor is open. ... DAO or ADO, both of which are many times more efficient than ODBC. ...
    (comp.lang.cobol)