cancel
Showing results for 
Search instead for 
Did you mean: 

Oracle Exception in Web Dynpro.

Former Member
0 Kudos

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?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

Please check

Regards

Abhijith YS

Former Member
0 Kudos

Hi

Abhijith

Can you please explorer this problem.

Because this threads are not have same problem like.

This threads are talking about diff issues.

Please provide me help why this error is coming?

Regards

Sunny.

Former Member
0 Kudos

HI

please check

1 . conn =DriverManager.getConnection ("jdbc:oracle:thin:@ServerIp:1521:adaniinframs","scott", "tiger");

whether it is correct

2. try to ping your DB system.

3. Ask yuor system admin and DB admin for opening required ports

4. Check the other forums given below (NON SAP)

a) <a href="http://www.cryer.co.uk/brian/oracle/ORA12505.htm">Thread 1</a>

b)<a href="http://ora-12505.ora-code.com/">Thread 2</a>

c)

<b>keep updates even i ll try to give few more sugessions</b>

Regards

Abhijith YS

Former Member
0 Kudos

Hi

in your code

conn =DriverManager.getConnection ("jdbc:oracle:thin:@ServerIp:1521:adaniinframs","scott", "tiger");

you have given

ServerIp:1521 as server name and ip

are you sure its your servername?

check that and try to give exact ip of your DB system.

Regards

Abhijith YS

Former Member
0 Kudos

Hi

Abhijit

I am hiding Server 's actual IP by writing ServerIp.

and port no is 1521.

and my tnsnames.ora file is

like

  1. tnsnames.ora Network Configuration File: C:\oracle\product\10.2.0\client_1\NETWORK\ADMIN\tnsnames.ora

  2. Generated by Oracle configuration tools.

ADANIINFRAMS =

(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP)(HOST = 132.132.48.4)(PORT = 1521))

)

(CONNECT_DATA =

(SERVICE_NAME = orclahd.adaniahd.com)

)

)

Hope that this helps in problem solving.

Regards

Sunny Shah.

Former Member
0 Kudos

Hi

Have you followed all steps what i have suggested in my previous post which is at 11.01 am, please check whether the port is opened or not

Regards

Abhijith YS

Former Member
0 Kudos

Hi

Abhijith.

Will you please tell me how ca i check port?

and my DBA is on leave for 2 days. and he only provide me this settings previously.

and i am checking similar threads on oracle forums also as you suggested.

Regards

Sunny.

former_member751941
Active Contributor
0 Kudos

Hi Sunny,

Check the hosts file entry under C:\WINDOWS\system32\drivers\etc

IP hostname alias

-


132.132.48.4 testhost -


In tnsnames.ora instead of IP put hostname (testhost).

In Connection :

Connection conn = DriverManager.getConnection

("jdbc:oracle:thin:@testhost: 1521:adaniinframs","scott","tiger");

Ping to the server check whether it is running or not.

Check this

<a href="http://download-uk.oracle.com/docs/cd/B19306_01/network.102/b14212/gettingstart.htm#i484751">link</a>

Regards,

Mithu

Answers (1)

Answers (1)

Former Member
0 Kudos

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!!