Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

oracle connection error

Status
Not open for further replies.

juliam921

Programmer
May 23, 2002
13
US
I previously was running my visual basic program on vb6, Win 2000 with mdac 2.5 and an oracle 8.1.6 client. Now, I am running Windows XP with vb6, mdac 2.7 and an oracle 9.2 client on my machine and i get the following error at the cnnOrclConnection.Open line:

method open of object _connection failed

Public cnnOrclConnection As New ADODB.Connection, _
primaryRS As New ADODB.Recordset

Public Sub GetConnections()

cnnOrclConnection.Open "DSN=museum;UID=museum;PWD=123;SERVER=museump;"

Exit Sub

The odbc connection tests fine and so does a tnsping. So what has changed now that I need to fix? Is it Oracle 9 that is causing this? Any help is appreciated!!
-Julia

 
Yes, that is the name of our dsn museump p is for production.
-Julia

Thank you! Any other ideas?
 
Is your UID, PWD and SERVER set up in the DSN? If so it may be redundant in your code and/or causing confusion. Try,

Code:
cnnOrclConnection.Open "DSN=museum;"

See this site for examples of connection strings.


Take Care,

zemp
 
I tried that and still the same. The password is not stored in the dsn, so I need that (and I tried just dsn and passowrd and same error). I am using the ODBC Connection Microsoft ODBC for Oracle. Do I need to specify the provider in the connection string? How do I find out what it is?

Thanks,
Julia
 
Check the link in my last post for connection string examples.

Double check your DSN. Place the password in the DSN and try to connect. Usually if the DSN connection is successsful then ADO has no trouble using it.

I would also double check that the user and password are valid and have the proper permissions.

Take Care,

zemp
 
The Microsoft ODBC for Oracle doesn't allow you to store a password in the connection. I can connect to the database using sql plus using this id and password. Also, this application worked before I upgraded to XP and Oracle 9i. So its not the id or password. Could it be the version of the dlls that Oracle 9i uses?

Thanks,
Julia
 
You could try either Microsoft Data Link or the ADO data control to build you a connection string for your oracle database - perhaps there are extra bits that have to be catered for in the higher version?

Best of luck
 
I have the ADO data control checked under "components". What else do I have to do? I have never used a control to build a connection string.

Thanks.
Julia
 
If you select (custom) from the properties window for the control, select "Use Connection String" and "Build" - then you will go through the data link properties which will build you a connection string. You can then cut and paste this connection string into your apps.

Hope this helps...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top