This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes JDBC and the fly likes jdbc and oracle Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "jdbc and oracle" Watch "jdbc and oracle" New topic
Author

jdbc and oracle

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
I am trying to connect to oracle 8i using oracle 8.1.6 thin driver but with little luck. My computer environment is
WINNT 4.0.1
ORACLE 8i
JDK 1.2
ORACLE 8.1.6 OCI THIN DRIVER

can anybody help on the steps required to connect to oracle
All help appreciated
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi Valli
static{
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection ("jdbc racle:thin:@localhost:1521 rcl","scott","tiger");
}catch(Exception e){}
go to oracle sight /download section it will ask u to create a login ..creaTE IT THEN U WILL GET A LIST OF ALL DOWNLOADABLES
SELECT ORACLE JDBC DRIVER THEN U WILL GET THE LIST ALL THE DRIVER INFO DOWNLOAD JDBC-THIN 100%JAVA (CLASSES12.ZIP,1.5MB) (THIN DRIVER) FOR ORACLE
SET THE CLASS PATH FOR CLASSES12.ZIP FILE FOR U R CODE
THEN COMPILE U R CODE
IF U UNZIP THE FILE U CAN SEE THE SUB DIR ORACLE/JDBC/DRIVER/OracleDriver.class u need to set class path for oracle dir
"localhost" is u r machine & "1521" is a port number on which oracle service is running & "orcl" is host String
if u have any more problems u can mail me ravi_gali@hotmail.com
ravi
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi Valli
static{
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection ("jdbc racle:thin:@localhost:1521 rcl","scott","tiger");
}catch(Exception e){}
go to oracle sight /download section it will ask u to create a login ..creaTE IT THEN U WILL GET A LIST OF ALL DOWNLOADABLES
SELECT ORACLE JDBC DRIVER THEN U WILL GET THE LIST ALL THE DRIVER INFO DOWNLOAD JDBC-THIN 100%JAVA (CLASSES12.ZIP,1.5MB) (THIN DRIVER) FOR ORACLE
SET THE CLASS PATH FOR CLASSES12.ZIP FILE FOR U R CODE
THEN COMPILE U R CODE
IF U UNZIP THE FILE U CAN SEE THE SUB DIR ORACLE/JDBC/DRIVER/OracleDriver.class u need to set class path for oracle dir
"localhost" is u r machine & "1521" is a port number on which oracle service is running & "orcl" is host String
if u have any more problems u can mail me ravi_gali@hotmail.com
ravi
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Example code that work in on my machine...
WINNT 4.0
ORACLE 7.3.4
JDK 1.3 JDBC 2.0
ORACLE THIN DRIVER from CLASS111.ZIP (added to my CLASSPATH)
/*
A modified version of sample code provided by sun
Copyright 1997, 1998, 1999 Sun Microsystems, Inc. All Rights Reserved.
*/
<code>
import java.sql.*;

public class CreateCoffees {
public static void main(String args[]) {

String url = "jdbc racle:thin:@hostname:1521:sid";
Connection con;
String createString;
createString = "create table COFFEES " +
"(COF_NAME varchar(32), " +
"SUP_ID int, " +
"PRICE float, " +
"SALES int, " +
"TOTAL int)";
Statement stmt;

try {
Class.forName("oracle.jdbc.driver.OracleDriver");
}

catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con = DriverManager.getConnection(url,
"userid", "password");

stmt = con.createStatement();
stmt.executeUpdate(createString);

stmt.close();
con.close();

} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
}
}
</code>
Fyi, OCI my not be support by you driver...
Hope this helps...
Monty6

[This message has been edited by monty6 (edited September 11, 2000).]
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: jdbc and oracle
 
Similar Threads
Oracle JDBC Driver for JDK 1.3
Oracle thin driver for jdk1.3
MDB calls EJB requires new transaction
Driver to connect to the database
Network Adapter Error WHY????