aspose file tools
The moose likes JDBC and Relational Databases and the fly likes inserting date into database using jdbc Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "inserting date into database using jdbc" Watch "inserting date into database using jdbc" New topic
Author

inserting date into database using jdbc

Bhasker Reddy
Ranch Hand

Joined: Jun 13, 2000
Posts: 176
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


Bhasker Reddy
Daniel Dunleavy
Ranch Hand

Joined: Mar 13, 2001
Posts: 276
first off, you can make the date field have a default value of sysdate
Dan
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

How about this?

 
 
subject: inserting date into database using jdbc