help with JDBC oracle9i

Reply

Join Date: May 2005
Posts: 82
Reputation: indianscorpion2 is an unknown quantity at this point 
Solved Threads: 1
indianscorpion2 indianscorpion2 is offline Offline
Junior Poster in Training

help with JDBC oracle9i

 
0
  #1
Mar 6th, 2006
hi everyone.
i am an amateur programmer in java.
can anyone please tell me how do i go about connecting my java application to oracle 9i database?
please be specific about what is the URL that i should use and how should i install the oracle JDBC driver.where should i install it.
if it is already available with either JDK 1.5(which i am using) or oracle 9i. where can i locate it and how should i install it. please let me know all the details. thank you.
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 2,108
Reputation: server_crash is on a distinguished road 
Solved Threads: 18
server_crash server_crash is offline Offline
Postaholic

Re: help with JDBC oracle9i

 
0
  #2
Mar 6th, 2006
Have you read the documentation???
Reply With Quote Quick reply to this message  
Join Date: Mar 2004
Posts: 762
Reputation: Phaelax is on a distinguished road 
Solved Threads: 38
Phaelax Phaelax is offline Offline
Master Poster

Re: help with JDBC oracle9i

 
0
  #3
Mar 6th, 2006
Here are the drivers of Oracle for java.
http://www.oracle.com/technology/sof...dbc/index.html

Install the jar into the "\jre\lib\ext\" directory of wherever your jsdk is installed at.

This code would print out the database names on the server:
  1. Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
  2. String url = "jdbc:mysql://192.168.2.184/";
  3. String user = "guest";
  4. String password = "guestPass";
  5. connection = DriverManager.getConnection(url, user, password);
  6. DatabaseMetaData dbmd = connection.getMetaData();
  7. ResultSet result = dbmd.getCatalogs();
  8. databases.removeAllElements();
  9. while(result.next())
  10. {
  11. System.out.println(result.getString(1));
  12. }
Reply With Quote Quick reply to this message  
Join Date: May 2005
Posts: 82
Reputation: indianscorpion2 is an unknown quantity at this point 
Solved Threads: 1
indianscorpion2 indianscorpion2 is offline Offline
Junior Poster in Training

Re: help with JDBC oracle9i

 
0
  #4
Mar 7th, 2006
Originally Posted by server_crash
Have you read the documentation???
where can i find the documentation u r talkin abt.please be specific
Reply With Quote Quick reply to this message  
Join Date: May 2005
Posts: 82
Reputation: indianscorpion2 is an unknown quantity at this point 
Solved Threads: 1
indianscorpion2 indianscorpion2 is offline Offline
Junior Poster in Training

Re: help with JDBC oracle9i

 
0
  #5
Mar 8th, 2006
Originally Posted by Phaelax
Here are the drivers of Oracle for java.
http://www.oracle.com/technology/sof...dbc/index.html

Install the jar into the "\jre\lib\ext\" directory of wherever your jsdk is installed at.

This code would print out the database names on the server:
  1. Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
  2. String url = "jdbc:mysql://192.168.2.184/";
  3. String user = "guest";
  4. String password = "guestPass";
  5. connection = DriverManager.getConnection(url, user, password);
  6. DatabaseMetaData dbmd = connection.getMetaData();
  7. ResultSet result = dbmd.getCatalogs();
  8. databases.removeAllElements();
  9. while(result.next())
  10. {
  11. System.out.println(result.getString(1));
  12. }


thank you very much sir.i did what u have told me to.
even then i am getting an error saying
"the network adapter could not establish a connection"

"no default driver specified"

"wrong data source name"

what could be the problem?
Reply With Quote Quick reply to this message  
Join Date: Mar 2004
Posts: 762
Reputation: Phaelax is on a distinguished road 
Solved Threads: 38
Phaelax Phaelax is offline Offline
Master Poster

Re: help with JDBC oracle9i

 
0
  #6
Mar 8th, 2006
Well you'll need to make changes to the code for it to work for you. Such as the username and password and the server address. You may even have to change the driver name.

I believe Server Crash was referring to the java api documentation.
http://java.sun.com/j2se/1.4.2/docs/...erManager.html
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,145
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 212
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: help with JDBC oracle9i

 
0
  #7
Mar 8th, 2006
and put in the correct jdbc URI.
The example used a mySQL database as an example, and of course a different database name and machine.

See the documentation (which you should have, it's available from Oracle and I think comes with the driver) for the details.
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Java Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC