2

My problem is that i attempt to connect to a remote Oracle database. Its version is 9.2.0.6, i use jdk 1.7 and ojdbc14.jar .

This is the code :

Connection connection = null;

    try {

        connection = DriverManager.getConnection("jdbc:oracle:thin:@//10.130.34.3:1522/myDB", "binette","Passer");

    } catch (SQLException e) {

        System.out.println("Connection Failed! Check output console");
        e.printStackTrace();
        return;

    }

And i got this error :

Connection Failed! Check output console
java.sql.SQLException: Exception d'E/S: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=153093632)(ERR=12514)(ERROR_STACK=(ERROR=(CODE=12514)(EMFI=4))))
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:334)
    at oracle.jdbc.ttc7.TTC7Protocol.handleIOException(TTC7Protocol.java:3668)
    at oracle.jdbc.ttc7.TTC7Protocol.logon(TTC7Protocol.java:353)
    at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:371)
    at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:551)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:351)
    at java.sql.DriverManager.getConnection(DriverManager.java:571)

I tried to chande the jdbc jar to classes12.jar but it is the same error. I have already search on internet but I can't figure out the problem.Any idea please?

1

4 Answers 4

1

Looks like ORA-12514: TNS:listener does not currently know of service requested in connect descriptor(according to error code). So maybe your service name isn't myDB?

Sign up to request clarification or add additional context in comments.

Comments

0

Depending on your database configuration you should try

connection = DriverManager.getConnection("jdbc:oracle:thin:@//10.130.34.3:1522:myDB", "binette","Passer");

instead of

connection = DriverManager.getConnection("jdbc:oracle:thin:@//10.130.34.3:1522/myDB", "binette","Passer");

2 Comments

What is difference between two connection string??
Inthe first ine port and instance name are separated by ':', in the second one port and instance name are separated by '/'.
0

I thinks its a firewall issue. Try to open the port 1522 in the firewall and then check.

Comments

0

I have resolved my problem.So i wasn't connecting to the right database.Now the connection pass!thank you! :-)

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.