on 09-21-2007 8:25 AM
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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>
<b>keep updates even i ll try to give few more sugessions</b>
Regards
Abhijith YS
Hi
Abhijit
I am hiding Server 's actual IP by writing ServerIp.
and port no is 1521.
and my tnsnames.ora file is
like
tnsnames.ora Network Configuration File: C:\oracle\product\10.2.0\client_1\NETWORK\ADMIN\tnsnames.ora
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.
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
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!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.