Home » Developer & Programmer » JDeveloper, Java & XML » Unable to connect Oracle database: JDBC issue
Unable to connect Oracle database: JDBC issue [message #247044] Sat, 23 June 2007 02:43 Go to next message
SenthilGugan
Messages: 9
Registered: June 2007
Junior Member
Hi all,
I have successfully installed the Oracle 10g Express edition in my Lniux10.2 suse OS, after that I have set the ORACLE_HOME, ORACLE_SID and the PATH environment variables as follows.
exportPATH=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin
export ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server.
ORACLE_SID=XE

Now I have this problem.
I am unable to connect the oracle database through Jdbc.
when I run the Jdbc java program, it gives me,

manickam:~/workspace # java MainClass
error: failed to create a connection object.
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:
localhost:1521:database

at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:261)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:387)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:414)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at MainClass.getConnection(MainClass.java:18)
at MainClass.main(MainClass.java:26)

Looking forward to a solution,
Thanks in advance,
Senthil.
Re: Unable to connect Oracle database: JDBC issue [message #247058 is a reply to message #247044] Sat, 23 June 2007 06:19 Go to previous messageGo to next message
Frank
Messages: 7901
Registered: March 2000
Senior Member
the sid in your jdbc-url seems to be wrong:
localhost:1521:database

should be
localhost:1521:xe
Re: Unable to connect Oracle database: JDBC issue [message #247269 is a reply to message #247058] Mon, 25 June 2007 05:44 Go to previous message
SenthilGugan
Messages: 9
Registered: June 2007
Junior Member
Hi Frank,
Thanks, the problem is solved now. I changed the database name accordingly and now everything working fine.

Thanks,
Senthil.
Previous Topic: Missing equal to sign between atrribute to attribute value
Next Topic: Java Resource
Goto Forum:
  


Current Time: Sun Nov 24 23:57:15 CST 2024