It's not a secret anymore!*
The moose likes JDBC and the fly likes PrepareStatement Insert using field name Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Reply locked New topic
Author

PrepareStatement Insert using field name

vinod balaji
Ranch Hand

Joined: May 18, 2006
Posts: 84
Hello

Is it Possible to insert the value using the field , i couldnt find the suitable API for it

String Query = "Insert into tablename(GROUP_NAME,SOURCE) values (?,?)";


PreparedStatement ps = conn.prepareStatement(Query,Statement.RETURN_GENERATED_KEYS);
// Need something like the bekiw

ps.setValue(GROUP,"abc");
ps.setValue(SOURCE,"123");



ps.executeUpdate();
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Doubleposted: http://www.coderanch.com/t/439922/JDBC/Insert-into-PrepareStatement-Using-Field
Please stick to one topic. Please use message's edit button to edit message. Please do not use browser's back button for edit.
 
GeeCON Prague 2014
 
subject: PrepareStatement Insert using field name