OPENROWSET on DB2

  • I trying to use following OPENROWSET to select a bunch of rows from a DB2 table:

    SELECT a.*

    FROM OPENROWSET('IBMDADB2','xxx.xxx.xxx.xx,50000';'myuserid';'mypassword',

    'SELECT * FROM mycatalog.mySchema.T_LastNames') AS a

    This is the error message I am getting..

    OLE DB provider 'IBMDADB2' reported an error.

    [OLE/DB provider returned message: CLI0124E Invalid argument value. SQLSTATE=HY009]

    OLE DB error trace [OLE/DB Provider 'IBMDADB2' IDBInitialize::Initialize returned 0x80004005: ].

    Am I missing something here...I am new to this... could somebody point me in the right direction. Thanks

  • I thought the syntax was not:

    SELECT a.*

    FROM OPENROWSET('IBMDADB2','xxx.xxx.xxx.xx,50000';'myuserid';'mypassword',

    'SELECT * FROM mycatalog.mySchema.T_LastNames') AS a

    but more along the lines of:

    SELECT a.*

    FROM OPENROWSET(

                    'IBMDADB2',

                    'address=xxx.xxx.xxx.xx,50000;uid=myuserid;pwd=mypassword',

                    'SELECT * FROM mycatalog.mySchema.T_LastNames'

                   ) AS a

    But thats just guessing from looking at other doco and that doco I'm looking at is using the SQLolddb

    provider

     

    Good luck

  • I've found that DB2 (on a 400) is case sensitive in some places.  In particular, I suggest that you capitolize the library.schema.table name, which you have in lower case. 

     

  • Hi, 

     Can you please send a sample of code for Connecting to DB2 using OPENROWSET.

    Thanks

    Buddy

Viewing 4 posts - 1 through 3 (of 3 total)

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