Reputation: 29
I am trying to connect to remote DB via simple JDBC but i am getting below
error:
*** SQLException caught ***
ORA-28040: No matching authentication protocol
code :
import java.sql.*;
import oracle.jdbc.*;
import java.io.*;
import oracle.jdbc.pool.OracleDataSource;
public class JDBC {
public static void main (String args []) throws SQLException {
try
{
//Connecting to Oracle server
OracleDataSource ds = new oracle.jdbc.pool.OracleDataSource();
ds.setURL("jdbc:oracle:thin:@remotehostname:1521:dbname");
Connection conn = ds.getConnection("my username", "my password");
System.out.println("Connected to DB");
}
catch (SQLException ex) { System.out.println ("\n*** SQLException
caught ***\n" + ex.getMessage());}
catch (Exception e) {System.out.println ("\n*** other Exception caught ***\n");}
}
}
I have added ojdbc6.jar and all supporting jars to build path. I am able to connect to remote via VPN but not via JDBC .. any guidance much appreciated...
Upvotes: 0
Views: 1166
Reputation: 241
From docs.oracle.com If the client version does not meet or exceed the value defined by SQLNET.ALLOWED_LOGON_VERSION_SERVER parameter(sqlnet.ora file), then authentication fails with an ORA-28040: No matching authentication protocol error or an ORA-03134: Connections to this server version are no longer supported error.
You can check your driver version using below command
$java -jar ojdbc6.jar -getversion
Try setting SQLNET.ALLOWED_LOGON_VERSION_SERVER in sqlnet.ora file to lower Oracle version like 8,9 or 10 .
Check this issue for more info.
Upvotes: 1