Home » Developer & Programmer » JDeveloper, Java & XML » One connection question
One connection question [message #91033] Fri, 01 March 2002 10:29 Go to next message
Chen Wen
Messages: 26
Registered: February 2002
Junior Member
How to connect to Oracle server by JDBC?
I tried by following codes, but failed.
1.
Driver driver =
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
DriverManager.registerDirver(driver);
Connection con =
DriverManager.getConnection("jdbc:oracle:oracle:@134.68.140.4:1521:orc
l","user","password");
2.
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con =
DriverManager.getConnection("jdbc:oracle:oracle:@134.68.140.4:1521:orc
l","user","password");
Re: One connection question [message #91088 is a reply to message #91033] Sun, 31 March 2002 19:39 Go to previous messageGo to next message
Kavita Rajdeo
Messages: 1
Registered: March 2002
Junior Member
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con =DriverManager.getConnection("jdbc:oracle:thin:@server:port:sid","user","password");

Just try this code with the ip of ur server, the respective port,the sid and ur user and password
Re: One connection question [message #91095 is a reply to message #91088] Wed, 03 April 2002 04:19 Go to previous message
karun
Messages: 3
Registered: April 2002
Junior Member
To use the code provided by Kavita, make sure that you have the classes12.zip file from Oracle specified in your classpath. Else that piece of code wont work..
Previous Topic: Re: JSP database connectivity
Next Topic: Re: Loading XML into database
Goto Forum:
  


Current Time: Mon Dec 23 07:11:56 CST 2024