applekanna
asked on
prepared statements
Hi,
I am using prepared statements and i have my code as
String query = "Insert into test (id , phone) values (?, ?)"
pstmt.setInt( 1, 19);
pstmt.setInt( 2, 12345567);
pstmt.executeUpdate(query) ;
This throws an exception
but if use
pstmt.executeUpdate(); it works.
y?
Thx
I am using prepared statements and i have my code as
String query = "Insert into test (id , phone) values (?, ?)"
pstmt.setInt( 1, 19);
pstmt.setInt( 2, 12345567);
pstmt.executeUpdate(query)
This throws an exception
but if use
pstmt.executeUpdate(); it works.
y?
Thx
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The PreparedStatement has an implicit statment to execute, so passing it a query as well doesn't make much sense. I'm not even sure why it's available, apart from the fact that PreparedStatement inherits from Statement ;-)
All statement instances know how to send sql to server.
PreparedStatement pstmt = conn.prepareStatement(quer