Connecting to a Oracle 11 database remotely

1124835 pts.
Tags:
Oracle 11
Oracle Database
I'm trying to connect to an Oracle 11 database remotely using the following piece of code but I'm unable to do so. But the same code works fine when I connect it to an Oracle 9 database. Am I missing something here?
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);
  }
0

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: