I create (Sales.mdb) and use Microsoft Access Driver(*mdb). Then I compile the file below and then run it. It show no errors, but the tables are not created. Does anyone know why? Please help. Thanks
chuck
/* Source: L. Kvasny * Creates and populates the Sales database */
import java.sql.*; import sun.jdbc.odbc.*;
public class Create { public static void main (String args[]) { try{ //Load drivers new JdbcOdbcDriver(); String url = "jdbc:odbc:Sales";
//Connect to database String user = ""; String password = ""; Connection con = DriverManager.getConnection(url, user, password); Statement stmt = con.createStatement(); //Create and load tables stmt.executeUpdate("CREATE TABLE Customer (CustomerID VARCHAR(4), CustomerName" + " VARCHAR(25), Address VARCHAR(25), BalanceDue CURRENCY)"); stmt.executeUpdate ("INSERT INTO Customer VALUES (1234,'Fred Flynn','22 First St.',1667.00)"); stmt.executeUpdate ("INSERT INTO Customer VALUES (5678,'Darnell Davis','33 Second St.',130.95)"); stmt.executeUpdate ("INSERT INTO Customer VALUES (4321,'Marla Martinez','44 Third St.',0)"); stmt.executeUpdate ("INSERT INTO Customer VALUES (8765,'Carla Kahn','55 Fourth St.', 0)");