Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDBC, Help please

 
Ambrose Tati
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear All,
I'm told that to do database access from within my Java programs I don't need a JDBC driver at all. My environment is:
Personal Oracle7, Java1.3, Win98.
Can somebody please help me with a sample code and on how to set up things to get me started?
Thanks in advance
------------------
 
Monty Ireland
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Who told you that tail... I have hear of stories being told around the camp fire.... but....
I have never heard of this one....
Please correct me if I am wrong..!
I very !
Please review the following code that uses the oracle jdbc driver CLASSES111.ZIP. This file must be in you CLASSPATH.
The following code works with JDK1.3 on NT and Oracle 7.3.4 on unix.
<code>
import java.sql.*;

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

String url = "jdbc racle:thin:@S0030947:1521:ispd1";
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>
------------------
We learn more from our mistake's than from our success's.
[This message has been edited by Monty Ireland (edited October 16, 2000).]
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just as a note, we've moved over from the old classes111.zip to a newer classes12_01.zip to access Oracle 7. It has one or two peculiarities, but does seem to fix some serious peoblems which were present in the 111 driver. Good luck trying to find any support for Oracle 7 from Oracle's site, though.
 
Monty Ireland
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where can I find the new driver....
I been on oracle's technet...
Pls provide URL.
TIA

------------------
We learn more from our mistake's than from our success's.
 
menon
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Drivers can be found at
http://technet.oracle.com/software/tech/java/sqlj_jdbc/software_index.htm
Ram
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic