Win a copy of The Java Performance Companion this week in the Performance forum!
    Bookmark Topic Watch Topic
  • New Topic

PrepareStatement Insert using field name

 
vinod balaji
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 2458
  • Mark post as helpful
  • send pies
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
    Bookmark Topic Watch Topic
  • New Topic