File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes DataBase drivers in Linux Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "DataBase drivers in Linux" Watch "DataBase drivers in Linux" New topic

DataBase drivers in Linux

Tom Diamond
Ranch Hand

Joined: May 10, 2001
Posts: 98
Hello all,
I am trying to learn some things about JDBC these days. I tried a couple of programs on my Win 2K professional platform using Java 2 (JDK 1.3) and the pre-installed "ODBC Data Source Administrator" program.
However, I want to test these things on my Linux platform (SuSe 7.1 professional). Is there an equivalent app to "ODBC Data Source Administrator"?
Any advice would be very helpfull.
Thanx in advance,
Sean Casey
Ranch Hand

Joined: Dec 16, 2000
Posts: 625
Which database are you using? I use MySQL and I had to download the appropriate drivers and then include them in my classpath.
Tom Diamond
Ranch Hand

Joined: May 10, 2001
Posts: 98
Well, I don't use a specific database.I just want to create a .dbf file and then update it using Java.
The code I use is the following :
//Start of
import java.sql.*;
public class CreateCoffees {
public static void main(String args[]) {
String url = "jdbc dbc:dBASE Files";
Connection con;
String createString;
createString = "create table COFFEES " +
String add1 = "INSERT INTO COFFEES " +
"VALUES ('Colombian', 101, 7.99, 0, 0)";
String add2 = "INSERT INTO COFFEES " +
"VALUES ('Espresso', 150, 9.99, 0, 0)";
String add3 = "INSERT INTO COFFEES " +
"VALUES ('Colombian_Decaf', 101, 8.99, 0, 0)";
String add4 = "INSERT INTO COFFEES " +
"VALUES ('French_Roast_Decaf', 49, 9.99, 0, 0)";

Statement stmt;
try {
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
try {
con = DriverManager.getConnection(url, "", "");
stmt = con.createStatement();
stmt.executeUpdate(createString); //Create dBase file
stmt.executeUpdate(add1); //Modifying...
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
//End of
This thing creates a table stored in COFFEES.dbf and then adds some data into it.
Watch line 3 :: I say "jdbc dbc:dBASE Files" because the "OBDC Data Source Administrator" program has linked "dBASE Files" with the appropriate driver.
What will I have to write in a Linux platform?
I agree. Here's the link:
subject: DataBase drivers in Linux
It's not a secret anymore!