dcsimg
jdbc,oracle 9i
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   ankita_sharma
Posted On:   Tuesday, April 19, 2005 07:55 AM

i installed j2sdk1.4 and oracle 9i .i need help in connecting oracle 9i with java ,jdbc connections what classpath i should set and parameters to be given for drivermanager.getconnection.i am using this driver


Please use html tags to format code blocks.

Re: jdbc,oracle 9i

Posted By:   Anonymous  
Posted On:   Wednesday, April 20, 2005 10:19 AM

Hi, if you are using DSN less JDBC drivers to connect to the oracle database(presuming you have downloaded them from the oracle website), u need to put them into your jdk/jre/lib/ext directory. Then set the following environment variables:



PATH = your jdk/bin directory

JAVA_HOME = your jdk directory



Now compile your programs in the following way:

>javac -classpath . thejavafile.java



In the java file use the following statement for your connection with database:



Class.forName("oracle.jdbc.driver.OracleDriver");

Connection con=DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:mydatabase","SCOTT","TIGER");



where mydatabase is tha name of the database and scott and tiger are the username and passwords respectively.



Hope this helps!

Best of Luck!

Re: jdbc,oracle 9i

Posted By:   suc_Jag  
Posted On:   Tuesday, April 19, 2005 05:02 PM

First include classes111.jar in your class path.

then you can use the following code in java file to connect to the database


Class.forName(oracle.jdbc.driver.OracleDriver)

String URLString = "jdbc:oracle:thin:@hoststring:port:databasename"

Connection con = DriverManager.getConnection(URLString,"DatabaseUserName","DatabasePassword");

here the letters in italics are the one that you enter specific to your environment. for example host string is www.xyz.com ...etc.
About | Sitemap | Contact