Rafal Solinski wrote on 06.08.2006 18:51:
> Hi,
>
[quoted text clipped - 8 lines]
> INSERT INTO ... sql instruction, but I am hoping for a simplier
> solution.
Do a SELECT on the source, then use a PreparedStatement for the INSERT on the
target. The use getObject() on the ResultSet you obtain from the source, and do
a setObject() for each column on the target INSERT. But be aware that some
drivers do not correctly implement getObject() and it is not guaranteed that the
Object returned by the driver from the source DB will return a class that the
driver from the target can handle.
But there are OpenSource solutions at sourceforge (don't know the name right
now) which have already solved those problems...
Regards
Thomas
Tom Cole - 15 Aug 2006 18:09 GMT
Create a CASE statement using the DATA_TYPE value returned in the
getColumns method of DatabaseMetaData. The int in the DATA_TYPE value
of the resulting ResultSet maps to a java.sql.Types value. Use it in
the case to know which setXxx method to call.
> Rafal Solinski wrote on 06.08.2006 18:51:
> > Hi,
[quoted text clipped - 22 lines]
> Regards
> Thomas