• 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 and java connectivity

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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("jdbc:oracle:thin:@[HOSTNAME]:[PORT]:[ORACLE-SID]", "[USERNAME]", "[PASSWORD]");
SAF
 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic