wood burning stoves 2.0*
The moose likes Oracle/OAS and the fly likes Oracle database connection problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Oracle/OAS
Bookmark "Oracle database connection problem" Watch "Oracle database connection problem" New topic
Author

Oracle database connection problem

David Mbura
Ranch Hand

Joined: Apr 06, 2010
Posts: 65
Hello guys!
I am trying to configure eclipse with oracle database 11g but I am getting the below exception when i try to test the connection (ping failed).The reason is i cant remember the host name for the database so the url is not correct.How do i find the ip address the database is running on (jdbcracle:thin:@ IPaddress:1521:xe)?Thank you in advance!

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


at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)

at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:131)

at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:197)

at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:525)

at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:413)

at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:508)

at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:203)

at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:33)

at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:510)

at oracle.eclipse.tools.database.connectivity.db.OracleJDBCConnection.createConn(OracleJDBCConnection.java:199)

at oracle.eclipse.tools.database.connectivity.db.OracleJDBCConnection.createConnection(OracleJDBCConnection.java:149)

at org.eclipse.datatools.connectivity.DriverConnectionBase.internalCreateConnection(DriverConnectionBase.java:104)

at org.eclipse.datatools.connectivity.DriverConnectionBase.open(DriverConnectionBase.java:53)

at org.eclipse.datatools.connectivity.drivers.jdbc.JDBCConnection.open(JDBCConnection.java:72)

at oracle.eclipse.tools.database.connectivity.db.OracleJDBCConnectionFactory.createConnection(OracleJDBCConnectionFactory.java:26)

at org.eclipse.datatools.connectivity.internal.ConnectionFactoryProvider.createConnection(ConnectionFactoryProvider.java:83)

at org.eclipse.datatools.connectivity.internal.ConnectionProfile.createConnection(ConnectionProfile.java:355)

at org.eclipse.datatools.connectivity.ui.PingJob.createTestConnection(PingJob.java:76)

at org.eclipse.datatools.connectivity.ui.PingJob.run(PingJob.java:59)

at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

Caused by: oracle.net.ns.NetException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor


at oracle.net.ns.NSProtocol.connect(NSProtocol.java:361)

at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:966)

at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:292)

... 15 more

Ireneusz Kordal
Ranch Hand

Joined: Jun 21, 2008
Posts: 423
David Mbura wrote: (jdbcracle:thin:@ IPaddress:1521:xe)?Thank you in advance!

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

Your IP address and port number are probably good (the listener is responding), but SID is not known.
SID (System ID)- is a name of your database. SID = xe in your connection string.

Ask your DBA for SID of your database.
If you have access to the DB server, try to locate tnsnames.ora file,
it should be under $ORACLE_HOME/network/admin subdirectory (ORACLE_HOME is an environment variable pointing to the DB subdirectory),
here is an example of this file from my home PC (sid is marked in red):

# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

IRKO =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = krokodilko)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = irko)
)
)


David Mbura
Ranch Hand

Joined: Apr 06, 2010
Posts: 65
Thanks Kordal,Actually i just found what my database name is,Database name is sparks_database,so that means if try (jdbcracle:thin:@ localhost:1521:sparks_database) should work?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Oracle database connection problem
 
Similar Threads
[EJB3UNIT] Data insertion in my database
Oracle Toplink Workbench - ORA-12505, TNS:listener error
Using JDBC to connect oracle
error while connecting with oracle 9
WSAD-Oracle10