Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
622 views
in Technique[技术] by (71.8m points)

.net - Connect to an Oracle 10g database with Microsoft ODBC for Oracle

I'm trying to connect to an Oracle 10g database using the built in Microsoft ODBC for Oracle driver. I want to use an dnsless connection, so I grab my connection string from www.connectionstrings.com.

Ideally I won't have to setup a DNS entry or an Oracle TNS entry, and I may be mistaken, but I thought the above would do that for me. I'm getting the following:

ERROR [NA000] [Microsoft][ODBC driver for Oracle][Oracle]ORA-12514:
TNS:listener does not currently know of service requested in connect
descriptor

ERROR [IM006] [Microsoft][ODBC Driver Manager]
Driver's SQLSetConnectAttr failed

ERROR [01000] [Microsoft][ODBC Driver Manager] 
The driver doesn't support the version of ODBC behavior that the
application requested (see SQLSetEnvAttr)."

As far as I can tell online, other people have used the Microsoft ODBC for Oracle driver to connect to 10g, but maybe I'm missing something. I'm connecting from a vb.net application by the way.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

With 10g, you can use the EZCONNECT feature. To connect to an Oracle instance named ORCL on the server myServer, the connection string would look like this :

Driver={Microsoft ODBC for Oracle};Server=myServer:1521/ORCL;Uid=myUsername;Pwd=myPassword;

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...