Copy record from one database to another

Hi there. Really simple question for someone to answer I hope.

I have two databases that contain the same tables. I simply want to select a record from one and insert it into another.

It is not as simple as selecting it and iterating through the columns using the getString though because some of the columns have different types and some of them have a null value.

Is there an easy way to just copy one record in one table in one database to another database without having to go through each field and specify which type it is...

Thanks, Boomah.

[580 byte] By [Boomaha] at [2007-11-27 8:24:56]
# 1
You would have to speficy each field (AFAIK), but you can do it in a generic manner using ResultSetMetaData. Read up on that class in the API.
masijade.a at 2007-7-12 20:14:10 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2
Thanks for the response. I was sort of hoping for a method call I had missed. Oh well, looks like I'll do it the long way!Thanks, Boomah.
Boomaha at 2007-7-12 20:14:10 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 3
Well, have you tried using getObject from ResultSet and setObject from PreparedStatement.It seems as though that may work.
masijade.a at 2007-7-12 20:14:10 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...