Results 1 to 4 of 4
Thread: insert query in odbc
- 07-18-2009, 08:25 AM #1
Member
- Join Date
- Jul 2009
- Location
- bhubaneswar
- Posts
- 5
- Rep Power
- 0
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();
}
}
- 07-20-2009, 02:59 PM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
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.
- 07-20-2009, 08:17 PM #3
Member
- Join Date
- Jul 2009
- Posts
- 12
- Rep Power
- 0
hello lipun4u,
it is sun.jdbc.odbc.JdbcOdbcDriver.
create the appropriate dsn and run....
- 07-21-2009, 09:14 AM #4
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Similar Threads
-
Connect to Access without MS ODBC?
By ribbs2521 in forum New To JavaReplies: 5Last Post: 04-16-2009, 03:33 AM -
Help me this error in JDBC-ODBC connection
By lordelf in forum Java ServletReplies: 3Last Post: 04-04-2009, 08:37 AM -
How to insert large data into database using one insert query
By sandeepsai39 in forum New To JavaReplies: 3Last Post: 02-28-2009, 09:17 AM -
Using JDBC-ODBC bridge
By Java Tip in forum Java TipReplies: 0Last Post: 02-06-2008, 09:21 AM -
without ODBC
By Heather in forum JDBCReplies: 2Last Post: 06-29-2007, 02:42 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks