• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Oracle JDBC unable to get connection

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just started learning JDBC and I have Oracle 8.1.7 and JDK1.3.1 installed on my computer.
This is my autoexec.bat:
set path=c:\jdk1.3.1\bin;c:\oracle\ora81\bin;c:\oracle\ora81\jdbc\lib;
set classpath=c:\oracle\ora81\jdbc\lib\classes12.zip;c:\oracle\ora81\jdbc\lib\nls_charset12.zip
1. is this the correct setting ?
the documentation said that classes12.zip is dedicated for jdk1.2
is there a specific oracle.jdbc.driver for jdk1.3?
When I was installing oracle 8.1.7 ( downloaded from oracle site)
I was asked to enter the database name, and I entered "Oracle"
and the suggested SID is also "Oracle"
so the database (host:port:sid) for connection is:
@localhost:1521:Oracle
or @127.0.0.1:1521:Oracle
is this correct, since I keep getting error messages?
Please somebody help me.
Thanks
(Edited by Dave to fix the smilie problems)
[ January 03, 2002: Message edited by: David O'Meara ]
 
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What error messages are you getting? What operating system are you on?
 
Paulus Liem
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Stanley
I currently use Windows 98 second Ed.
Here is the error message:
Error Messages:
java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:210)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:323)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:263)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:365)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:260)
at java.sql.DriverManager.getConnection(DriverManager.java:517)
at java.sql.DriverManager.getConnection(DriverManager.java:177)
at JDBCVersion.main(JDBCVersion.java:10)
But it works fine if I use OCI8 instead of thin driver ( "jdbc:oracle:oci8:@","scott","tiger")
Thanks
( Edited by Dave to fix the :o )
[ January 03, 2002: Message edited by: David O'Meara ]
 
Stanley Tan
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You must have listeners set up which I don't know how to do on Windows 98.
Just a wild guest: have you tried "ORCL" instead of "Oracle" for the SID.
 
Stanley Tan
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
BTW, what's your connection string?
It should be something like:
conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "username", "password");
[ January 04, 2002: Message edited by: Stanley Tan ]
(Edited by Dave to remove try &#58;o instead)
[ February 21, 2002: Message edited by: David O'Meara ]
 
Paulus Liem
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have tried all combination of connection string:
("jdbc:oracle:thin:@localhost:1521:oracle",user,pwd);
("jdbc:oracle:thin:@localhost:1521:orcl",user,pwd);
("jdbc:oracle:thin:@mycom:1521:orcl",user,pwd);
("jdbc:oracle:thin:@mycom:1521:oracle",user,pwd);
// where "mycom" is my computer name
(Edited by Dave to remove try &#58;o instead)
[ February 21, 2002: Message edited by: David O'Meara ]
 
Stanley Tan
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am on Windows XP so I am able to start and stop listeners. Check your Oracle documentation on how to do this for Windows 98. You want to start a TNS listener.
Sorry I am not of much help.
Or perhaps you could just use the JDBC ODBC driver for now.
 
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
if you do a search on the jdbc forum using the parameters 'localhost connection oracle' you get five results that might be helpful to you
Jamie
 
Paulus Liem
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks alot guys.
By the way, I also have Windows XP installed on my machine. If someday I want to install Oracle on it, which Oracle version should I use?
Is it the one for Windows NT ?
Thanks again
 
Stanley Tan
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yup, the one for NT as XP is actually NT 5.1.
Good luck!
 
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just figured this one out. Had the exact problem - could connect using the oci driver but not the thin client. Real problem is that the listener has not been started. Solution (on linux) is to go into the "lsnrctl" commandline utility and enter "start". Does anyone know how to automatically start the listener services on a unix box when the server starts? Much appreciated.
 
Paulus Liem
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I managed to solve this problem just by re-installing Oracle and everything is just fine.
Paulus Liem
 
First, you drop a couch from the plane, THEN you surf it. Here, take this tiny ad with you:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic