vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| bug report: postgresql: 8.2.0 jdbc: postgresql-8.2-504.jdbc3.jar the following generates a number format exception: preparedStatement.setObject(indx,"2004-August-15",java.sql.Types.DATE) the following works: preparedStatement.setObject(indx,"2004-08-15",java.sql.Types.DATE) i prefer to use the former. -- Soli Deo gloria, Floyd Shackelford ---------------------------(end of broadcast)--------------------------- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to majordomo@postgresql.org so that your message can get through to the mailing list cleanly |
| ||||
| On Wed, 14 Feb 2007, Floyd Shackelford wrote: > the following generates a number format exception: > preparedStatement.setObject(indx,"2004-August-15",java.sql.Types.DATE) > > the following works: > preparedStatement.setObject(indx,"2004-08-15",java.sql.Types.DATE) > > i prefer to use the former. > I'm not sure that's actually a bug as there are many, many possible date formats and the JDBC spec doesn't specify what conversions must be supplied. Do you use this same code on other databases? Using a SimpleDateFormat object to convert from String to Date yourself is the most portable and guaranteed correct method. Kris Jurka ---------------------------(end of broadcast)--------------------------- TIP 4: Have you searched our list archives? http://archives.postgresql.org |