DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   Java (http://www.daniweb.com/forums/forum9.html)
-   -   help with JDBC oracle9i (http://www.daniweb.com/forums/thread40575.html)

indianscorpion2 Mar 6th, 2006 1:19 am
help with JDBC oracle9i
 
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.

server_crash Mar 6th, 2006 5:10 pm
Re: help with JDBC oracle9i
 
Have you read the documentation???

Phaelax Mar 6th, 2006 11:24 pm
Re: help with JDBC oracle9i
 
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:
                        Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
                        String url = "jdbc:mysql://192.168.2.184/";
                        String user = "guest";
                        String password = "guestPass";
                        connection = DriverManager.getConnection(url, user, password);
                        DatabaseMetaData dbmd = connection.getMetaData();
                        ResultSet result = dbmd.getCatalogs();
                        databases.removeAllElements();
                        while(result.next())
                        {
                                System.out.println(result.getString(1));
                        }

indianscorpion2 Mar 7th, 2006 12:38 am
Re: help with JDBC oracle9i
 
Quote:

Originally Posted by server_crash
Have you read the documentation???

where can i find the documentation u r talkin abt.please be specific

indianscorpion2 Mar 8th, 2006 3:51 am
Re: help with JDBC oracle9i
 
Quote:

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:
                        Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
                        String url = "jdbc:mysql://192.168.2.184/";
                        String user = "guest";
                        String password = "guestPass";
                        connection = DriverManager.getConnection(url, user, password);
                        DatabaseMetaData dbmd = connection.getMetaData();
                        ResultSet result = dbmd.getCatalogs();
                        databases.removeAllElements();
                        while(result.next())
                        {
                                System.out.println(result.getString(1));
                        }



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?

Phaelax Mar 8th, 2006 9:43 am
Re: help with JDBC oracle9i
 
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

jwenting Mar 8th, 2006 2:27 pm
Re: help with JDBC oracle9i
 
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.


All times are GMT -4. The time now is 11:48 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC