Connecting to AS400 DB2

  • I have read a bit on this site about querying a DB2 table on the AS400 from SQL server once a linked server is established. 

    Is there any way to query a DB2 table from SQL server without creating a linked server?

  • We use HiT software's SQL Server drivers to connect to AS400 DB2, and it does require a linked server definition:

    http://www.hitsw.com/products_services/sqlmiddleware.html

  • You can also create a DTS package...make a connection DB2/AS400 and then use the in-built execute task to execute SQLs on DB2.

  • Yes, know how to create a DTS package, etc.  The problem is I am calling stored procedures from a stand-alone Java program.  I can also make the connection from the Java program to the AS400.  I was just trying to incorporate the queries to the AS400 and SQL server within the same stored procedure.

  • And why would you not want to use linked servers then ? You either have to make two connections (one to SQL and one to DB2) or if you are going to use one connection, then either use linked servers and access DB2 via SQL or use the Gateways product from IBM and query DB2 and use the pass-through queries to query SQL.

  • I have tried using DTS to convert an AS400 file to an SQL table...  I gave up.  I had the (apparently common) problem of having the DTS package run fine in Enterprise Manager or from a command line, but could not get it to run programmatically (with the xp_cmdshell procedure).  I ended up setting up the AS400 as a linked server and then just creating a table on the SQL server and populating it with an INSERT statement...  works fine.  And much simpler (in my opinion).  Hope this helps.


    Dan Moyer
    IS Staff
    Stanley Electric U.S. Co., Inc.

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply