File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Oracle and java connectivity Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Oracle and java connectivity" Watch "Oracle and java connectivity" New topic
Author

Oracle and java connectivity

Aparna Ramanujam
Greenhorn

Joined: Jun 30, 2001
Posts: 1
I am learning java and now doing my JDBC I want to connect java with Oracle please help me with the kind of driver needed and the place where it will be available?
SoonAnn Lim
Ranch Hand

Joined: Jun 21, 2001
Posts: 155
I am not sure you can get Oracle driver for free unless your friends or organization have it. I used thin driver(general name i use to call it) to connect to Oracle database. It is on Solaris, i believe same driver is used on Windows.
SAFROLE YUTANI
Ranch Hand

Joined: Jul 06, 2001
Posts: 257
That's not true. You can download Oracle 8i Enterprise Edition for FREE, let alone just the JDBC drivers for it!
Just go to www.oracle.com and click on 'Download'. Then select 'Oracle JDBC drivers' from the right drop-down menu. You need to be a registered member, dont worry, it's free. After you download the zip file, just place it in your CLASSPATH and make sure you do the following in your code to use the driver to access your database.
/* import statement for driver */
import oracle.jdbc.driver.OracleDriver;
/* load the driver */
Class.forName("oracle.jdbc.driver.OracleDriver");
/* create a connection, replace all variables in "[]" with your environment settings of course */
Connection c = DriverManager.getConnection("jdbc racle:thin:@[HOSTNAME]:[PORT]:[ORACLE-SID]", "[USERNAME]", "[PASSWORD]");

hope it helps,
SAF
SAFROLE YUTANI
Ranch Hand

Joined: Jul 06, 2001
Posts: 257
Sorry, dont include the smiley face in your code like I did, it should be like this...
/* create a connection, replace all variables in "[]" with your environment settings*/
Connection c = DriverManager.getConnection("jdbcracle:thin:@[HOSTNAME]:[PORT]:[ORACLE-SID]", "[USERNAME]", "[PASSWORD]");
SAF
Venugopal nandikolla
Greenhorn

Joined: Feb 02, 2001
Posts: 22
If you are having the oracle client loaded in your machine(for ex c:\) then you can go to c:\orant\jdbc\lib .... you will find classes111.zip(which contains) the oracle thin driver.Add these claases into your classpath and use your normal jdbc code to connect to the DB.
If you are working on windows go to control panel and on to the settings create a 32odbc(DSN) specify the database,username and the DSN(DataSourceName) then you can use jdbc dbc bridge to connect to oracle from java.
Browse the net to get few examples on both the types.Hope you got my point.
-venu
SoonAnn Lim
Ranch Hand

Joined: Jun 21, 2001
Posts: 155
Thanks for pointing out my ignorance. I don't have to worry about the driver when i code it because it is ready to be used. Now i know i can get it free, what a wonderful world. May be i am friegthened by MS too much.
 
 
subject: Oracle and java connectivity
 
Similar Threads
Why Oracle, not Sun, sued Google over Java
OCPJP 5 or OCPJP 6?
Any performance Issue b/w oci8 and thin cliient ?
Which database effective for Java?
Which way in JAVA is the best and modern to connect Oracle