Skip to Content
author's profile photo Former Member
Former Member

Oracle Exception in Web Dynpro.

Hi

Experts

I am getting this error while connecting to oracle server through web Dynpro.

I can connect directly to oracle server with SQL plus.

java.sql.SQLException: Listener refused the connection with the following error: ORA-12505, TNS:listener does not currently know of SID given in connect descriptor The Connection descriptor used by the client was: Server IP:1521:adaniinframs

I am giving my code.

MessageManager msgMgr = (MessageManager)wdThis.wdGetAPI().getComponent().getMessageManager();
	
	Connection conn=null;
		try
		{
		wdComponentAPI.getMessageManager().reportException("after 0",false);
		Class.forName("oracle.jdbc.driver.OracleDriver");
		wdComponentAPI.getMessageManager().reportException("after 1st",false);
		DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
		wdComponentAPI.getMessageManager().reportException("after 2nd",false);
		conn =DriverManager.getConnection ("jdbc:oracle:thin:@ServerIp:1521:adaniinframs","scott", "tiger");
		wdComponentAPI.getMessageManager().reportException("after 3",false);
		Statement stmt=conn.createStatement(); 
		wdComponentAPI.getMessageManager().reportException("after 4",false);
		ResultSet rs=stmt.executeQuery("select ename from emp where empno=7369"); // select statment
		wdComponentAPI.getMessageManager().reportException("after 5",false);
		while(rs.next())
		{
		wdComponentAPI.getMessageManager().reportException("after 6",false);
		IPrivateDatabaseConnectView.INodeEmpElement a = wdContext.createNodeEmpElement();
		a.setEmpName(rs.getString(1));
		a.setEmpJob(rs.getString(2));
		wdContext.nodeNodeEmp().addElement(a);
		}
		}
		catch(Exception ex)
		{ 
		//System.out.println("Error");
		wdComponentAPI.getMessageManager().reportException(ex.toString(),false);
		//wdContext.currentContextElement().setError(ex.toString());
		ex.printStackTrace();
		}
 
		finally
		{
		 try
		{
		conn.close(); // closing the connection
		}
		catch(Exception e)
		{  
		System.out.println("Error"); 
		}
		}   

Can anyone help me to solve this error?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 21, 2007 at 07:32 AM

    Hi

    Please check

    Oracle upgrade from 8.0.4.0 t 8.1.7.4 (urgent)

    Regards

    Abhijith YS

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 21, 2007 at 08:58 AM

    Hello Sunny,

    Try with this:

    String serverName = "jdbc:oracle:thin:@ServerIp:1521:adaniinframs";

    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());

    con = DriverManager.getConnection(serverName, db_user, db_pwd);

    If you are getting the same error make sure the server ip (ServerIp) is on the host file or try with the full IP.

    Remember syntax is like this: jdbc:oracle:thin:@<ip>:<port>:<DBSchema>.

    Goog luck!!

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.