[jdom-interest] ResultSetBuilder and Date Problems

philip.nelson at omniresources.com philip.nelson at omniresources.com
Sat May 26 06:14:12 PDT 2001

> I successfully converted a JDBC ResultSet into a JDOM 
> structure. The XML
> produced looks as follows
> <result>
> 	<entry>
>         <CREATED_AT>Thu May 24 00:00:00 GMT+05:30 2001</CREATED_AT>
> 	</entry>
> </result>
> Now I want to read this XML and insert into another DB
> But when I try to convert the String (CREATED_AT) produced by 
> the ResultSet
> Builder into a date I get an exception.
> How Can I convert the string produced by the ResultSet Builder into a
> java.sql.date ?

Not having worked with ResultSetBuilder, I can't comment specifically on
that.  I can say with absolute certainty that database date formats are a
mess.  XML schema is struggling with pretty much the same issue.

My best advice is to have the database format the date closer to what you
want with a database function call in the query that builds your result set.

ResultSetBuilder does a getString on each column.  You could choose to try
to enhance the code if you like and use the metadata to determine the column
type and then vary behaviour when a date column appears. I am not sure this
is possilbe though. If you do and it makes dates interchangeable, let us

More information about the jdom-interest mailing list