Home » Open Source » Programming Interfaces » ODBC connection works but not JDBC (Oracle 8i)
ODBC connection works but not JDBC [message #360131] Wed, 19 November 2008 13:05
Messages: 3
Registered: October 2008
Location: Pittsburgh, PA
Junior Member

I am trying to use the thin client connection of the JDBC connection to connect to an Oracle 8i database on another server.

I can connect via ODBC with the following code in VBA just fine.

Dim cn As ADODB.Connection 'as you are typing adodb vb will automatically autohelp - if not then you don't have a reference to ado
    Dim rs As ADODB.RecordSet
    Set cn = New ADODB.Connection
    cn.Open "Promise", "name", "password"
    Set rs = New ADODB.RecordSet
    Set rs = New ADODB.RecordSet
    rs.Open "select * from v$version;", cn
    MsgBox (rs.Fields(0))
    Set rs = Nothing
    Set cn = Nothing

However, the following code does not work in JDBC.

    	DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
  		Connection con = DriverManager.getConnection("jdbc:oracle:thin:@xxx.xxx.xxx.xxx:yyyyy:zzzzz", "name", "password");

I blanked out the login names, IP, port and SIDs for security reasons obviously.

In my JDBC attempt, I get the following message.
ORA-01017: invalid username/password; logon denied

I am using the same login name and password for the ODBC connection in VBA and the JDBC connection in Java.

Interestingly enough, when I change the password in my ODBC VBA attempt to a wrong entry, I get the same error.

Why won't this connection in JDBC work?

I know the SID, port and IP are correct as I copied them strait from the tnsnames.ora file.

Any suggestions? Thanks in advance.

Previous Topic: cx_Oracle dosen't work with Thin Client
Next Topic: Oracle Lite + ADO.NET + C#
Goto Forum:

Current Time: Sat Sep 25 08:05:16 CDT 2021