• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

inserting date into database using jdbc

 
Bhasker Reddy
Ranch Hand
Posts: 176
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
PreparedStatement stmt_utl = dbconn.prepareStatement("INSERT INTO UTL_PROD_HISTORY VALUES (?,?,?,?,?)");
stmt_utl.setInt(1, y);
stmt_utl.setDate(2,"SYSDATE");
stmt_utl.setString(3, userid_uc);
stmt_utl.setString(4, proc_name);
stmt_utl.setInt(5, num);

stmt_utl.executeUpdate();
I am having problems inserting date into the database, how
do i retreive the date from the system.
My database is oracle, i am working on java servlets using jdbc
can anyone suggest me something
 
Daniel Dunleavy
Ranch Hand
Posts: 276
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
first off, you can make the date field have a default value of sysdate
Dan
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about this?

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic