| Author |
Insert a Date into DB JDBC
|
Eric Qez
Greenhorn
Joined: Jan 19, 2004
Posts: 1
|
|
I need to insert a date variable into DB. The field in DB table is date. The date is in default format 'yyyy-mm-dd'. I try to use statement like this and didn't work. Any idea? String wkEnding = "2004-01-19"; sql = "Insert into Timesheet Wk_Ending values( {d '" + wkEnding + "'} )";
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26173
|
|
Eric, It's generally a good idea to use a prepared statement. That way, you do not have to worry about db specific formats. What db are you using?
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
 |
|
|
subject: Insert a Date into DB JDBC
|
|
|