aspose file tools*
The moose likes JDBC and the fly likes JDBC, Help please Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "JDBC, Help please" Watch "JDBC, Help please" New topic
Author

JDBC, Help please

Ambrose Tati
Ranch Hand

Joined: Oct 03, 2000
Posts: 55
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

Joined: Oct 03, 2000
Posts: 161
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).]


Multi Platform Database Developer & DBA on E.S.T.
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
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.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Monty Ireland
Ranch Hand

Joined: Oct 03, 2000
Posts: 161
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

Joined: Nov 29, 2000
Posts: 6
Drivers can be found at
http://technet.oracle.com/software/tech/java/sqlj_jdbc/software_index.htm
Ram
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JDBC, Help please