Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SQLServer to DB2(AS/400) export

 
Jerome Donaldson
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Class 1 newbie, AS/400 programmer learning Java(And I like java)

Does anyone have any examples of using 1 jdbc to build a result set(for example sql server) but write back the result set with another jdbc(for example DB2/400)

Or is there some other way of doing this. Im having to extract data from MSSQL to be processed on the 400.

Thanks in advance all

 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34837
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ty,
Welcome to JavaRanch!

Any reason not to do a table export (to comma separated value format) and then a table import on the new database?

If you need to do this with JDBC, you need to use two sets of connections/statements/resultsets so you can read a record/write a record (or batches of records) at the same time.
 
Jerome Donaldson
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Im doing that now, but was looking for a way to make it a 1 step process.

If you have any examples of such a connection I could sure use it.

Im confused about how to use the forClass or DriverManager with 2 drivers.

Thank You for Any help ... :-)
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34837
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ty,
If you put it in a shell script, it's one step .

There's nothing special about Class.forName or DriverManager. You use the same code with a different driver class name. Then you get two connection, one each. Basically, you have all the JDBC code twice. Note that this solution is much more complicated than the command line export/import. It's also likely to be significantly less efficient.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic