Problem in connecting Oracle 11g through JDBC thin driver ( Domino Java )
32,482
OK Guys, Now I'm able to connect.. Here are all possible connection string I've tried and all works,
1- "jdbc:oracle:thin:@server.cgg.com:1569:ServiceName"
2- "jdbc:oracle:thin:@//server.cgg.com:1569/ServiceName"
3- "jdbc:oracle:thin:@server.cgg.com:1569/ServiceName"
Author by
Ris
Updated on April 25, 2020Comments
-
Ris about 4 years
I'm unable to connect Oracle 11 database remotely using following piece of code. However, same code works fine if I try to connect Oracle 9 database which is installed on my machine. What is missing ?
( I'm not getting any error, Lotus Notes hangs )
import lotus.domino.*; import java.sql.*; import oracle.jdbc.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); Database db = agentContext.getCurrentDatabase(); //Calling connection method Connection conn= getOracleConnection(db); if(conn!=null){ System.out.println("Connected.."); } else { System.out.println("There is a problem in connecting database.."); System.exit(0); } } catch(Exception e) { e.printStackTrace(); System.exit(0); } } private static Connection getOracleConnection(Database db) throws Exception { // Register driver DriverManager.registerDriver (new oracle.jdbc.OracleDriver()); //Retrieving connection string from profile document. String host = "SPRPRG020.int.server.com"; String ip = "1521"; String user = "system"; String password = "password"; String sid = "XE"; String url="jdbc:oracle:thin:@"+host+":"+ip+":"+sid; return DriverManager.getConnection(url, user, password); } }
-
Vineet Reynolds over 13 yearsIf you step through the code in a debugger, do you, by chance happen to encounter the line whose execution hangs the thread?
-
Ris over 13 years@Vineet, Not able to do so, Code freezes Lotus Notes.
-
Ris over 13 yearsAlso,I assume nothing wrong in using thin driver to connect remote Oracle database.I'm suspecting something syntactically wrong in my connection string.
-
Gary Myers over 13 yearsHang could be waiting for network response. Can you ping SPRPRG020.int.server.com ? If so, can you telnet to SPRPRG020.int.server.com on port 1521 ? Alternatively, can you connect through something like SQL*Plus in instant Client ?
-