0

I am getting following error when i try to connect the oracle database while i am successfully able to connect to same by LCConnection class in lotusscript agent

[13C0:0499-11BC] 01/22/2016 06:18:09 PM  HTTP JVM: before connection:::::
[13C0:0499-11BC] 01/22/2016 06:18:09 PM  HTTP JVM: inside dobi
[13C0:0499-11BC] 01/22/2016 06:18:09 PM  HTTP JVM: inside dobi 2
[13C0:0499-11BC] 01/22/2016 06:18:09 PM  HTTP JVM: java.sql.SQLException: Listener refused the connection with the following error:
[13C0:0499-11BC] 01/22/2016 06:18:09 PM  HTTP JVM: ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
[13C0:0499-11BC] 01/22/2016 06:18:09 PM  HTTP JVM: The Connection descriptor used by the client was:
[13C0:0499-11BC] 01/22/2016 06:18:09 PM  HTTP JVM: 10.12.14.139:1510:hst
[13C0:0499-11BC] 01/22/2016 06:18:09 PM  HTTP JVM:  at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
[13C0:0499-11BC] 01/22/2016 06:18:09 PM  HTTP JVM:  at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:280)
[13C0:0499-11BC] 01/22/2016 06:18:09 PM  HTTP JVM:  at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:319)
[13C0:0499-11BC] 01/22/2016 06:18:09 PM  HTTP JVM:  at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:344)
[13C0:0499-11BC] 01/22/2016 06:18:09 PM  HTTP JVM:  at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:148)
[13C0:0499-11BC] 01/22/2016 06:18:09 PM  HTTP JVM:  at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
[13C0:0499-11BC] 01/22/2016 06:18:09 PM  HTTP JVM:  at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:545)
[13C0:0499-11BC] 01/22/2016 06:18:09 PM  HTTP JVM:  at java.sql.DriverManager.getConnection(DriverManager.java:419)
[13C0:0499-11BC] 01/22/2016 06:18:09 PM  HTTP JVM:  at java.sql.DriverManager.getConnection(DriverManager.java:467)
[13C0:0499-11BC] 01/22/2016 06:18:09 PM  HTTP JVM:  at JavaAgent.getConnection(Unknown Source)
[13C0:0499-11BC] 01/22/2016 06:18:09 PM  HTTP JVM:  at JavaAgent.NotesMain(Unknown Source)
[13C0:0499-11BC] 01/22/2016 06:18:09 PM  HTTP JVM:  at lotus.domino.AgentBase.runNotes(Unknown Source)
[13C0:0499-11BC] 01/22/2016 06:18:09 PM  HTTP JVM:  at lotus.domino.NotesThread.run(Unknown Source)
[13C0:0499-11BC] 01/22/2016 06:18:09 PM  HTTP JVM: after connection:::::
[13C0:049A-11BC] 01/22/2016 06:18:09 PM  HTTP JVM: Exception in thread "AgentThread: JavaAgent" 
[13C0:049B-11BC] 01/22/2016 06:18:09 PM  HTTP JVM: java.lang.NullPointerException
[13C0:049D-11BC] 01/22/2016 06:18:09 PM  HTTP JVM:  at JavaAgent.NotesMain(Unknown Source)
[13C0:049F-11BC] 01/22/2016 06:18:09 PM  HTTP JVM:  at lotus.domino.AgentBase.runNotes(Unknown Source)
[13C0:04A1-11BC] 01/22/2016 06:18:09 PM  HTTP JVM:  at lotus.domino.NotesThread.run(Unknown Source)

What am i exactly missing out here.I am using ojdbc14.jar and placed it in java build path and also as well as in path C:\Lotus\Domino\jvm\lib\ext of lotus notes.Please help me.

I am using following code in lotus java agent:

import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;


import lotus.domino.*;

public class JavaAgent extends AgentBase {

    private static final String DB_DRIVER_CLASS = "oracle.jdbc.driver.OracleDriver";
    private static final String DB_URL = "jdbc:oracle:thin:@10.12.14.139:1510:hst";
    private static final String DB_USERNAME = "usname";
    private static final String DB_PASSWORD = "password";

    public static Connection getConnection() {
        Connection con = null;
        try {
            System.out.println("inside dobi");
            // load the Driver Class
            Class.forName(DB_DRIVER_CLASS);
            System.out.println("inside dobi 2");
            // create the connection now
            con = DriverManager.getConnection(DB_URL,DB_USERNAME,DB_PASSWORD);
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return con;
    }


    public void NotesMain() {
        Connection con = null;
        CallableStatement stmt = null;
        try {
            Session session = getSession();
            AgentContext agentContext = session.getAgentContext();
            System.out.println("before connection:::::");
            con = JavaAgent.getConnection();
            System.out.println("after connection:::::");
            //stmt = con.prepareCall("{call insertEmployee(?,)}");
        } catch(Exception e) {
            e.printStackTrace();
        }finally{
            try {
                stmt.close();
                con.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
    }
}
Utkarsh Saraf
  • 475
  • 8
  • 31
  • actually i am facing this problem in lotus domino notes development while connecting it with a java agent. – Utkarsh Saraf Jan 22 '16 at 13:32
  • 2
    That doesn't really matter: if you are specifying the wrong JDBC URL, then you can't connect. It doesn't matter if you do that from Domino, or from a 'normal' Java application. – Mark Rotteveel Jan 22 '16 at 14:31
  • Thanks a lot for your suggestion,actual problem is when i am connecting to another database with same code,it is getting connected but not with this,so what might be the possible error in this case.Is any port not open or something i am missing in environment.I am 100% sure that url is correct as i made same with the case. – Utkarsh Saraf Jan 25 '16 at 07:08
  • Please read the error message: _"TNS:listener does not currently know of SID given in connect descriptor"_ that means that the SID name you use is incorrect. As in the linked question, you may need to use `jdbc:oracle:thin:@10.12.14.139:1510/hst` instead (or an altogether different connection string). – Mark Rotteveel Jan 25 '16 at 09:51
  • Thanks Mark,it solved my issue....only difference was there should be double slash for `jdbc:oracle:thin:@//10.12.14.139:1510/hst` before 10.12.14.139 while calling by service name `hst`:) – Utkarsh Saraf Jan 25 '16 at 11:54

0 Answers0