-
insert query in odbc
why the following code gives error ???
import java.sql.*;
public class Main {
/**
* @param args
*/
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
Class.forName("jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:dsn1", "scott", "tiger");
Statement stmt = con.createStatement();
int x = stmt.executeUpdate("insert into emp (empno, ename, job) values (1000, 'asit dhal', 'clerk')");
System.out.println(x + " rows updated");
con.close();
}
}
-
1. What error are you getting (stack trace and all), and on what line...ie point out the line.
2. Put code in CODE tags to retain the formatting there's a button ('#') above the message box.
-
hello lipun4u,
it is sun.jdbc.odbc.JdbcOdbcDriver.
create the appropriate dsn and run....
-
By the way, if this is an Oracle db (and it looks like it might be, unless scott/tiger is used by everyone as a demo login) you should be using the Oracle drivers.