File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Oracle and java connectivity

 
Aparna Ramanujam
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 155
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 257
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 257
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 22
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 155
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic