hi,
i am using MS Access as database and jdk 1.3 and i created a dsn called
akiladb and no description in the odbc dialog box. I created a directory called akiladb and storing a table employee in that.
The table employee contains name , empno,deptno,salary as fields and i have populated the table with 4 rows. i have written a program which is below and it compiles fine but gives runtime error as follows
[Microsoft][ODBC Microsoft Access Driver}
It may not be a database that your application recongnizes or the file may be corrupt.
This is the first time i am writing a
JDBC application. Please correct me where i am wrong
The program is as follows.
import java.sql.*;
public class CreateCoffee {
public static void main(
String args[]) {
String url = "jdbc

dbc:akiladb";
Connection con;
String updateString;
updateString = "update employee " +
"set deptno=135 " +
"where name like 'akila'" ;
Statement stmt;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con = DriverManager.getConnection(url, "", "");
stmt = con.createStatement();
stmt.executeUpdate(updateString);
stmt.close();
con.close();
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
}
}