i have created program below ,but it does not run successfully why
import java.sql.*;
public class Bank {
public static void main(String[] args) throws Exception {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
// TODO code application logic here
try{
Connection cn=DriverManager.getConnection("jdbc:odbc:rushiDSN");
System.out.println("Connected Successfully");
Statement stmt=cn.createStatement();
stmt.executeUpdate("CREATE TABLE Author(AuID Number(3), AuName Char(15), AuAddr Char(30))");
System.out.println("Table created successfully");
stmt.close();
cn.close();
}catch(Exception e){System.out.println(e.getMessage());}
}
}
it shows following error
error:
Connected Successfully
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in CREATE TABLE statement.
at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6956)
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7113)
at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:3109)
at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:337)
at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(JdbcOdbcStatement.java:287)
at Bank.main(Bank.java:16)