Question : Access 2003 pass thru query to Oracle DB fails on first use

I have a pass thru query to an Oracle database that fails with the message "ODBC - connection to 'servername' failed". I also have a linked table to this same Oracle DB using a system DSN. The password is saved for this linkage; in other words the user does not get prompted for the password when opening the linked table.

When I initially set up the pass thru query, each time I ran it I'd get prompted to select the data source so I set the ODBC Connect Str property of the query as follows:

ODBC;DSN=myDSN;SERVER=myServer;UID=myUID;PWD=myPWD;

The values preceded with "my" are of course not the actual values used but I've checked and double-checked that I've made no mistakes entering these values.

If I don't set the ODBC Connect Str property of the query I am prompted for the data source. When I set this property, if I open the Access database and attempt to run the query before doing anything else, I get the "ODBC - connection to 'servername' failed" message. If, however, I open the linked table first, the query runs fine. Now, the odd thing is if I change the the password to an incorrect value, the query will still work if I've opened the link table first, which implies the ODBC Connect Str property is at least partially ignored if a successful connection was already made to the Oracle DB, and it also implies there is something wrong with how I've entered the ODBC Connect Str property.

So bottom line is I'm looking for some help getting this setup so the user could open Access and run this query before opening the linked table. Thanks!

Answer : Access 2003 pass thru query to Oracle DB fails on first use

The thing I would do is design the attached table, go into properties and copy the Description property from their and paste it into the connection property of the pass through query, you will need remove the table part from at the end of the description.

If you embed the User Name and Password then you should not need to open the table first.

If you are opening the table first then the connection is made so opening the query doesn't require the username and password so it doesn't fail, if you waited long enough the connection will be closed so you will then get the error again.

Cheers, Andrew
Random Solutions  
 
programming4us programming4us