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

How to use PreparedStatement with Auto_Increment

 
Tarun Oohri
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Everyone
I am facing problem to use prepared statement with auto increment primary key. How should we insert values in such table ? Say i have 2 columns where "id" is int type, primary key, not null & auto increment. How should i enter the values in the name column which is of varchar type ?

Thanks !!!
 
K. Tsang
Bartender
Posts: 3457
14
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the "id" is primary key and auto-increment, why do you need to specify it in your code? If you do specify the id then it's not really auto-increment.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic