Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
    Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

PrepareStatement Insert using field name

 
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();
 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Report post to moderator
Doubleposted: https://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.
 
sunglasses are a type of coolness prosthetic. Check out the sunglasses on this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic