Showing posts with label db2. Show all posts
Showing posts with label db2. Show all posts

Monday, March 26, 2012

Microsoft OLEDB provider for DB2 performance issue (Missing where clause on DB2 site)

Hi!

I have just installed Microsoft OLEDB provider for DB2 on a SQL server 2005. I created a Linked server against our DB2 V.8 Z/OS database. I tested the connection via execution of a simple select call, something like:

SELECT FIELD_A FROM DB2SRV.DB2DB.CREATOR_A.TABLE_A

WHERE FIELD_A='ABC'

I traced the call on the DB2 site. The SQL running on DB2 site was to my surprise without the “where clause”:

SELECT FIELD_A FROM DB2DB.CREATOR_A.TABLE_A

So, all rows are moved to SQL server before the where clause is executed, resulting in bad performance. The index on FIELD_A is not used and so on … !

If anyone out there has an idea of what could be wrong, please let me know!

NB. I know that by using OPENQUERY pass-through query, all execution is done on the DB2 site.

Moving to engine to resolve linked server specific issues. With regard to the driver, this blog is probably the place to go for experts on the driver itself:

http://blogs.msdn.com/dotnetinterop/archive/2006/01/19/514702.aspx

Hope this helps,

John

|||

Thanks !

The specific blog reference you gave me didn’t have any answers. But do you suggest that a raise my problem here ?

Brgds Henrik

|||If you are using WHERE clauses, you mihgt have to set the "Dervie Parameters", initialization property of the OLE DB data source to TRUE. It will instruct the provider to derive parameter info from the data source. I think you det it in the Advanced Options page of the Data Source Wizard, or maybe in the Data Links dialog. You might have to set it in the initialization string.|||

Fyi ! I have solved the problem myself. By setting option “collation compatible” to true, the where clause was executed on the DB2 site.

The option can be changed via Microsoft SQL Server Management Studio - linked servers “properties” and “server options” or by executing :

EXEC master.dbo.sp_serveroption @.server=N'DB2TSRV', @.optname=N'collation compatible', @.optvalue=N'true'

Henrik Garde

Microsoft OLEDB provider for DB2 performance issue (Missing where clause on DB2 site)

Hi!

I have just installed Microsoft OLEDB provider for DB2 on a SQL server 2005. I created a Linked server against our DB2 V.8 Z/OS database. I tested the connection via execution of a simple select call, something like:

SELECT FIELD_A FROM DB2SRV.DB2DB.CREATOR_A.TABLE_A

WHERE FIELD_A='ABC'

I traced the call on the DB2 site. The SQL running on DB2 site was to my surprise without the “where clause”:

SELECT FIELD_A FROM DB2DB.CREATOR_A.TABLE_A

So, all rows are moved to SQL server before the where clause is executed, resulting in bad performance. The index on FIELD_A is not used and so on … !

If anyone out there has an idea of what could be wrong, please let me know!

NB. I know that by using OPENQUERY pass-through query, all execution is done on the DB2 site.

Moving to engine to resolve linked server specific issues. With regard to the driver, this blog is probably the place to go for experts on the driver itself:

http://blogs.msdn.com/dotnetinterop/archive/2006/01/19/514702.aspx

Hope this helps,

John

|||

Thanks !

The specific blog reference you gave me didn’t have any answers. But do you suggest that a raise my problem here ?

Brgds Henrik

|||If you are using WHERE clauses, you mihgt have to set the "Dervie Parameters", initialization property of the OLE DB data source to TRUE. It will instruct the provider to derive parameter info from the data source. I think you det it in the Advanced Options page of the Data Source Wizard, or maybe in the Data Links dialog. You might have to set it in the initialization string.|||

Fyi ! I have solved the problem myself. By setting option “collation compatible” to true, the where clause was executed on the DB2 site.

The option can be changed via Microsoft SQL Server Management Studio - linked servers “properties” and “server options” or by executing :

EXEC master.dbo.sp_serveroption @.server=N'DB2TSRV', @.optname=N'collation compatible', @.optvalue=N'true'

Henrik Garde

Microsoft OLEDB provider for DB2 performance issue (Missing where clause on DB2 site)

Hi!

I have just installed Microsoft OLEDB provider for DB2 on a SQL server 2005. I created a Linked server against our DB2 V.8 Z/OS database. I tested the connection via execution of a simple select call, something like:

SELECT FIELD_A FROM DB2SRV.DB2DB.CREATOR_A.TABLE_A

WHERE FIELD_A='ABC'

I traced the call on the DB2 site. The SQL running on DB2 site was to my surprise without the “where clause”:

SELECT FIELD_A FROM DB2DB.CREATOR_A.TABLE_A

So, all rows are moved to SQL server before the where clause is executed, resulting in bad performance. The index on FIELD_A is not used and so on … !

If anyone out there has an idea of what could be wrong, please let me know!

NB. I know that by using OPENQUERY pass-through query, all execution is done on the DB2 site.

Moving to engine to resolve linked server specific issues. With regard to the driver, this blog is probably the place to go for experts on the driver itself:

http://blogs.msdn.com/dotnetinterop/archive/2006/01/19/514702.aspx

Hope this helps,

John

|||

Thanks !

The specific blog reference you gave me didn’t have any answers. But do you suggest that a raise my problem here ?

Brgds Henrik

|||If you are using WHERE clauses, you mihgt have to set the "Dervie Parameters", initialization property of the OLE DB data source to TRUE. It will instruct the provider to derive parameter info from the data source. I think you det it in the Advanced Options page of the Data Source Wizard, or maybe in the Data Links dialog. You might have to set it in the initialization string.|||

Fyi ! I have solved the problem myself. By setting option “collation compatible” to true, the where clause was executed on the DB2 site.

The option can be changed via Microsoft SQL Server Management Studio - linked servers “properties” and “server options” or by executing :

EXEC master.dbo.sp_serveroption @.server=N'DB2TSRV', @.optname=N'collation compatible', @.optvalue=N'true'

Henrik Garde

Friday, March 23, 2012

Microsoft OLE DB Provider for DB2 in SSIS vs. ODBC in DTS

I finally made data transfer between AS400 and SQL2005 work by using Microsoft OLE DB provider for DB2. I have tried other methods, some do not have build-in destination, some have unicode conversion problem. The only issue I have with this method is the peformance. For example, 300,000 rows load from AS400 take only 3 minutes with the ODBC connection in DTS, but more than 5 minutes with the microsoft OLD DB provider for DB2 in SSIS.

Does anyone have the same issue or figured out any tweaking that may speed up the transfer?

Thanks.

In the 5 minute example, what was your destination?|||The destination is the same - an OLE DB connection that connect to a SQL 2005 server.|||

Jane2006 wrote:

The destination is the same - an OLE DB connection that connect to a SQL 2005 server.

And are you using the "fast load" option?|||

Since I also need to load data back from SQL2005 to AS400, I could not use ADO.NET/ODBC method unless as someone else suggested, build a component for that missing destination microsoft does not have time to build. Also, the unicode issue drives me crazy. So I decide to use Microsoft OLE DB Provider for DB2.

Based on my experience, only the version released in April 2007 is good on 64-bit machine. The old versions did not work on our 64-bit machine even thought it said it should.

|||

Are you talking about the Data access mode in OLE DB Destination Editor? Yes. I am using the fast load. Actually this is a default unless changed.

|||

Jane2006 wrote:

Since I also need to load data back from SQL2005 to AS400, I could not use ADO.NET/ODBC method unless as someone else suggested, build a component for that missing destination microsoft does not have time to build. Also, the unicode issue drives me crazy. So I decide to use Microsoft OLE DB Provider for DB2.

Based on my experience, only the version released in April 2007 is good on 64-bit machine. The old versions did not work on our 64-bit machine even thought it said it should.

This is irrelevant. On the OLE DB destination, are you using the "Table or view - fast load" option when loading your results from AS400 to SQL Server?|||Yes. I think there must be some settings in Microsoft Provider OLE DB Provider for DB2 that needs to be tuned up. I just don't know where.|||How many rows are you retrieving and what is your MaxInsertCommitSize set to?|||Retrieving 3048740 rows from AS400. Maximum insert commit size is 0.|||Try setting MaxInsertCommitSize to 20000 and see what happens.|||Just give it a try. Not much difference. Still more than 5 minutes.|||Any transformations? Or just source -> destination?

Are you specifying a query in the source connection, or selecting a table from the drop down list?|||The one fundamental difference here is that you are using a Microsoft DB2 driver. It isn't a native AS400 driver. It's a 3rd party driver as far as connecting to the mainframe is concerned. You can download the IBM DB2 driver and you might have luck with that.

This isn't the same as using ODBC, which would (perhaps) use a native driver to connect.|||

No transformation. A straight source to destination. I am using SQL commnd for this particular one.

I have used tables in other scenarions as well. The row sizes are much smaller than this one, but ODBC consistently has better performance, even though only several seconds better.

Microsoft OLE DB Provider for DB2

The Microsoft OLE DB Provider for DB2 can be downloaded as a part of the SQL Server 2005 Feature Pack located at:
http://www.microsoft.com/downloads/details.aspx?familyid=D09C1D60-A13C-4479-9B91-9E8B9D835CDC&displaylang=en

Thanks - it will be good to hear if anyone has comments on their experience with this provider.

Donald

|||It worked great for me to receive data, but when it came to Inserting data or updating data, I could not get it to work. Using the statement Select col1, col2 from LinkedServer.DB2.X.Y works, but using Insert Into LinkedServer.DB2.X.Y values(col1Val, Col2Val) returned an error saying that it was unable to open the table. I checked permissions and it all looked good to me, so I cannot figure it out.|||

Did you use a component from dataflow task (if yes, which one - OLEDBDest, OLEDBCommand?), or you used ExecuteSQLTask to perform the insert/update?

Thanks

Wenyang

|||I used a straight SQL query, Insert Into table values (x, y, z).|||

Did you use SSIS at all? I understand you used a straignt SQL query, but I also want to know where you perform this query?

Thanks

Wenyang

|||

It should work. I have this sample here and you may try it out.

insert into MY_DB2_DATABASE.PERSON (SSN, AGE) values (11, '25')

Be sure that your connection works before you run/test your SQL task. You may start with creating a UDL file to DB2 first to establish a correct connection string. And make sure to use RUW (i.e. Units of Work=RUW). And then create a link-server to verify your connection string.

I doubted the Microsoft DB2OLEDB from feature pack supports distributed transaction. Do not enable transaction.

- Steve

|||I am performing the query using the query editor in the Database Engine inside of the Management Studio.|||

My connection string works when I read from the AS400, but not when I try to insert. My Connection String is below:

Provider=DB2OLEDB;User ID=*****;Password=*****;Initial Catalog=SQ2;Network Transport Library=TCP;Host CCSID=37;PC Code Page=1252;Network Address=192.168.212.71;Network Port=446;Package Collection=QGPL;Default Schema=QGPL;Process Binary as Character=False;Units of Work=RUW;DBMS Platform=DB2/AS400;Defer Prepare=True;Persist Security Info=True;Data Source=SQ2;Connection Pooling=False;Derive Parameters=True;

The Exact select query that i use is:

Select Top 1 * from SQ4.SQ2.MRPLVOBJ.FOEINTPL

The result is:

IPLACE IPLDSC

JP001 JAPAN 001

The query that doesnt work is:

Insert Into SQ4.SQ2.MRPLVOBJ.FOEINTPL (IPLACE, IPLDSC) values ('JP002', 'Japan 002')

The result is:

sg 7306, Level 16, State 2, Line 1

Cannot open the table ""SQ2"."MRPLVOBJ"."FOEINTPL"" from OLE DB provider "DB2OLEDB" for linked server "SQ4". Unknown provider error.

|||

I see. then this is not a SSIS issue. You'll probably need to post your question to other SQLServer forums so as to expect a better/faster helps. This forum is for SSIS only.

thanks

wenyang

|||

Alright.

Let me post my connection string so you can compare with yours.

Provider=DB2OLEDB;Password=****;Persist Security Info=True;User

ID=*****;Initial Catalog=CORPI502;Network Transport Library=TCPIP;Host

CCSID=37;PC Code Page=1252;Network Address=CORPI502;Network Port=446;Package

Collection=STEVEDB;Default Schema=STEVEDB;DBMS Platform=DB2/AS400;Process

Binary as Character=False;Connection Pooling=False;Units of Work=RUW

And the insert statement is:

insert into STEVEDB.PERSON (SSN, AGE) values (15, '25').

And that works well.

Back to your insert statement, try this:

Insert Into MRPLVOBJ.FOEINTPL (IPLACE, IPLDSC) values ('JP002', 'Japan 002')

|||I used your connection string and changed my password, library, etc. Once again the select statement worked, but the Insert Statement did not. I cannot figure out how this is possible since I am using the same credentials as the third party driver which can do the insert statement. I will continue to work on it, I appreciate your help.|||

OK, let us back up a little bit and follow a step-by-step approach.

Please start to create a linked server first. Use the connection string (i posted above) to create a linked server. Then run the "Select" query and "insert..." to against your linked server to see if it works.

You may use 4-part query or open query to do that like (note that STEVEDB is the schema name whereas PERSON is the table name):

Select * from MY_LINKED_SERVER.CORPI502.STEVEDB.PERSON

insert into MY_LINKED_SERVER.CORPI502.STEVEDB.PERSON (SSN, AGE) values (101, '23')

OR

SELECT * FROM OPENQUERY(MY_LINKED_SERVER, 'SELECT * FROM STEVEDB.PERSON')

INSERT into OPENQUERY(MY_LINKED_SERVER, 'SELECT * FROM STEVEDB.PERSON') values (999, '999')

NOTE: DO NOT ENABLE and RUN distributed transaction sinnce DB2OLEDB does NOT support it on this feature pack.

Once you get the linked server WORK, then you can try your SSIS package.

One more reminder - you may have to journal your table on DB2/AS400 before you run "insert". Give it a try.

It had worked for me and I used it in my project.

- Steve (from Minnesota)

|||

I gave it another try, now I have the following error: The OLE DB provider "DB2OLEDB" for linked server "SQ4" could not INSERT INTO table "[DB2OLEDB]".

I have not done a thing with the distributed transaction options, the service is disabled in my services tab. As for journaling the table, should I have to do it since I could do the same query from my other OLE provider?

|||

Well, i guess that I have written as specific as possible in the above. The next would be a private hands-on demo for you if needed.

As another thought - I would encourage you to try to download an EVALUATION version of Host Integration Server 2004 to replace DB2OLEDB from the feature pack. Give it a shot to see if DB2OLEDB from HIS 2004 works out. You can find HIS 2004 from Microsoft's website.

- Steve

Microsoft OLE DB Provider for DB2

The Microsoft OLE DB Provider for DB2 can be downloaded as a part of the SQL Server 2005 Feature Pack located at:
http://www.microsoft.com/downloads/details.aspx?familyid=D09C1D60-A13C-4479-9B91-9E8B9D835CDC&displaylang=en

Thanks - it will be good to hear if anyone has comments on their experience with this provider.

Donald

|||It worked great for me to receive data, but when it came to Inserting data or updating data, I could not get it to work. Using the statement Select col1, col2 from LinkedServer.DB2.X.Y works, but using Insert Into LinkedServer.DB2.X.Y values(col1Val, Col2Val) returned an error saying that it was unable to open the table. I checked permissions and it all looked good to me, so I cannot figure it out.|||

Did you use a component from dataflow task (if yes, which one - OLEDBDest, OLEDBCommand?), or you used ExecuteSQLTask to perform the insert/update?

Thanks

Wenyang

|||I used a straight SQL query, Insert Into table values (x, y, z).|||

Did you use SSIS at all? I understand you used a straignt SQL query, but I also want to know where you perform this query?

Thanks

Wenyang

|||

It should work. I have this sample here and you may try it out.

insert into MY_DB2_DATABASE.PERSON (SSN, AGE) values (11, '25')

Be sure that your connection works before you run/test your SQL task. You may start with creating a UDL file to DB2 first to establish a correct connection string. And make sure to use RUW (i.e. Units of Work=RUW). And then create a link-server to verify your connection string.

I doubted the Microsoft DB2OLEDB from feature pack supports distributed transaction. Do not enable transaction.

- Steve

|||I am performing the query using the query editor in the Database Engine inside of the Management Studio.|||

My connection string works when I read from the AS400, but not when I try to insert. My Connection String is below:

Provider=DB2OLEDB;User ID=*****;Password=*****;Initial Catalog=SQ2;Network Transport Library=TCP;Host CCSID=37;PC Code Page=1252;Network Address=192.168.212.71;Network Port=446;Package Collection=QGPL;Default Schema=QGPL;Process Binary as Character=False;Units of Work=RUW;DBMS Platform=DB2/AS400;Defer Prepare=True;Persist Security Info=True;Data Source=SQ2;Connection Pooling=False;Derive Parameters=True;

The Exact select query that i use is:

Select Top 1 * from SQ4.SQ2.MRPLVOBJ.FOEINTPL

The result is:

IPLACE IPLDSC

JP001 JAPAN 001

The query that doesnt work is:

Insert Into SQ4.SQ2.MRPLVOBJ.FOEINTPL (IPLACE, IPLDSC) values ('JP002', 'Japan 002')

The result is:

sg 7306, Level 16, State 2, Line 1

Cannot open the table ""SQ2"."MRPLVOBJ"."FOEINTPL"" from OLE DB provider "DB2OLEDB" for linked server "SQ4". Unknown provider error.

|||

I see. then this is not a SSIS issue. You'll probably need to post your question to other SQLServer forums so as to expect a better/faster helps. This forum is for SSIS only.

thanks

wenyang

|||

Alright.

Let me post my connection string so you can compare with yours.

Provider=DB2OLEDB;Password=****;Persist Security Info=True;User

ID=*****;Initial Catalog=CORPI502;Network Transport Library=TCPIP;Host

CCSID=37;PC Code Page=1252;Network Address=CORPI502;Network Port=446;Package

Collection=STEVEDB;Default Schema=STEVEDB;DBMS Platform=DB2/AS400;Process

Binary as Character=False;Connection Pooling=False;Units of Work=RUW

And the insert statement is:

insert into STEVEDB.PERSON (SSN, AGE) values (15, '25').

And that works well.

Back to your insert statement, try this:

Insert Into MRPLVOBJ.FOEINTPL (IPLACE, IPLDSC) values ('JP002', 'Japan 002')

|||I used your connection string and changed my password, library, etc. Once again the select statement worked, but the Insert Statement did not. I cannot figure out how this is possible since I am using the same credentials as the third party driver which can do the insert statement. I will continue to work on it, I appreciate your help.|||

OK, let us back up a little bit and follow a step-by-step approach.

Please start to create a linked server first. Use the connection string (i posted above) to create a linked server. Then run the "Select" query and "insert..." to against your linked server to see if it works.

You may use 4-part query or open query to do that like (note that STEVEDB is the schema name whereas PERSON is the table name):

Select * from MY_LINKED_SERVER.CORPI502.STEVEDB.PERSON

insert into MY_LINKED_SERVER.CORPI502.STEVEDB.PERSON (SSN, AGE) values (101, '23')

OR

SELECT * FROM OPENQUERY(MY_LINKED_SERVER, 'SELECT * FROM STEVEDB.PERSON')

INSERT into OPENQUERY(MY_LINKED_SERVER, 'SELECT * FROM STEVEDB.PERSON') values (999, '999')

NOTE: DO NOT ENABLE and RUN distributed transaction sinnce DB2OLEDB does NOT support it on this feature pack.

Once you get the linked server WORK, then you can try your SSIS package.

One more reminder - you may have to journal your table on DB2/AS400 before you run "insert". Give it a try.

It had worked for me and I used it in my project.

- Steve (from Minnesota)

|||

I gave it another try, now I have the following error: The OLE DB provider "DB2OLEDB" for linked server "SQ4" could not INSERT INTO table "[DB2OLEDB]".

I have not done a thing with the distributed transaction options, the service is disabled in my services tab. As for journaling the table, should I have to do it since I could do the same query from my other OLE provider?

|||

Well, i guess that I have written as specific as possible in the above. The next would be a private hands-on demo for you if needed.

As another thought - I would encourage you to try to download an EVALUATION version of Host Integration Server 2004 to replace DB2OLEDB from the feature pack. Give it a shot to see if DB2OLEDB from HIS 2004 works out. You can find HIS 2004 from Microsoft's website.

- Steve

Microsoft OLE DB Provider for DB2

The Microsoft OLE DB Provider for DB2 can be downloaded as a part of the SQL Server 2005 Feature Pack located at:
http://www.microsoft.com/downloads/details.aspx?familyid=D09C1D60-A13C-4479-9B91-9E8B9D835CDC&displaylang=en

Thanks - it will be good to hear if anyone has comments on their experience with this provider.

Donald

|||It worked great for me to receive data, but when it came to Inserting data or updating data, I could not get it to work. Using the statement Select col1, col2 from LinkedServer.DB2.X.Y works, but using Insert Into LinkedServer.DB2.X.Y values(col1Val, Col2Val) returned an error saying that it was unable to open the table. I checked permissions and it all looked good to me, so I cannot figure it out.|||

Did you use a component from dataflow task (if yes, which one - OLEDBDest, OLEDBCommand?), or you used ExecuteSQLTask to perform the insert/update?

Thanks

Wenyang

|||I used a straight SQL query, Insert Into table values (x, y, z).|||

Did you use SSIS at all? I understand you used a straignt SQL query, but I also want to know where you perform this query?

Thanks

Wenyang

|||

It should work. I have this sample here and you may try it out.

insert into MY_DB2_DATABASE.PERSON (SSN, AGE) values (11, '25')

Be sure that your connection works before you run/test your SQL task. You may start with creating a UDL file to DB2 first to establish a correct connection string. And make sure to use RUW (i.e. Units of Work=RUW). And then create a link-server to verify your connection string.

I doubted the Microsoft DB2OLEDB from feature pack supports distributed transaction. Do not enable transaction.

- Steve

|||I am performing the query using the query editor in the Database Engine inside of the Management Studio.|||

My connection string works when I read from the AS400, but not when I try to insert. My Connection String is below:

Provider=DB2OLEDB;User ID=*****;Password=*****;Initial Catalog=SQ2;Network Transport Library=TCP;Host CCSID=37;PC Code Page=1252;Network Address=192.168.212.71;Network Port=446;Package Collection=QGPL;Default Schema=QGPL;Process Binary as Character=False;Units of Work=RUW;DBMS Platform=DB2/AS400;Defer Prepare=True;Persist Security Info=True;Data Source=SQ2;Connection Pooling=False;Derive Parameters=True;

The Exact select query that i use is:

Select Top 1 * from SQ4.SQ2.MRPLVOBJ.FOEINTPL

The result is:

IPLACE IPLDSC

JP001 JAPAN 001

The query that doesnt work is:

InsertInto SQ4.SQ2.MRPLVOBJ.FOEINTPL (IPLACE, IPLDSC)values('JP002','Japan 002')

The result is:

sg 7306, Level 16, State 2, Line 1

Cannot open the table ""SQ2"."MRPLVOBJ"."FOEINTPL"" from OLE DB provider "DB2OLEDB" for linked server "SQ4". Unknown provider error.

|||

I see. then this is not a SSIS issue. You'll probably need to post your question to other SQLServer forums so as to expect a better/faster helps. This forum is for SSIS only.

thanks

wenyang

|||

Alright.

Let me post my connection string so you can compare with yours.

Provider=DB2OLEDB;Password=****;Persist Security Info=True;User

ID=*****;Initial Catalog=CORPI502;Network Transport Library=TCPIP;Host

CCSID=37;PC Code Page=1252;Network Address=CORPI502;Network Port=446;Package

Collection=STEVEDB;Default Schema=STEVEDB;DBMS Platform=DB2/AS400;Process

Binary as Character=False;Connection Pooling=False;Units of Work=RUW

And the insert statement is:

insert into STEVEDB.PERSON (SSN, AGE) values (15, '25').

And that works well.

Back to your insert statement, try this:

InsertIntoMRPLVOBJ.FOEINTPL (IPLACE, IPLDSC)values('JP002','Japan 002')

|||I used your connection string and changed my password, library, etc. Once again the select statement worked, but the Insert Statement did not. I cannot figure out how this is possible since I am using the same credentials as the third party driver which can do the insert statement. I will continue to work on it, I appreciate your help.|||

OK, let us back up a little bit and follow a step-by-step approach.

Please start to create a linked server first. Use the connection string (i posted above) to create a linked server. Then run the "Select" query and "insert..." to against your linked server to see if it works.

You may use 4-part query or open query to do that like (note that STEVEDB is the schema name whereas PERSON is the table name):

Select * from MY_LINKED_SERVER.CORPI502.STEVEDB.PERSON

insert into MY_LINKED_SERVER.CORPI502.STEVEDB.PERSON (SSN, AGE) values (101, '23')

OR

SELECT * FROM OPENQUERY(MY_LINKED_SERVER, 'SELECT * FROM STEVEDB.PERSON')

INSERT into OPENQUERY(MY_LINKED_SERVER, 'SELECT * FROM STEVEDB.PERSON') values (999, '999')

NOTE: DO NOT ENABLE and RUN distributed transaction sinnce DB2OLEDB does NOT support it on this feature pack.

Once you get the linked server WORK, then you can try your SSIS package.

One more reminder - you may have to journal your table on DB2/AS400 before you run "insert". Give it a try.

It had worked for me and I used it in my project.

- Steve (from Minnesota)

|||

I gave it another try, now I have the following error: The OLE DB provider "DB2OLEDB" for linked server "SQ4" could not INSERT INTO table "[DB2OLEDB]".

I have not done a thing with the distributed transaction options, the service is disabled in my services tab. As for journaling the table, should I have to do it since I could do the same query from my other OLE provider?

|||

Well, i guess that I have written as specific as possible in the above. The next would be a private hands-on demo for you if needed.

As another thought - I would encourage you to try to download an EVALUATION version of Host Integration Server 2004 to replace DB2OLEDB from the feature pack. Give it a shot to see if DB2OLEDB from HIS 2004 works out. You can find HIS 2004 from Microsoft's website.

- Steve

Microsoft OLE DB Provider for DB2

The Microsoft OLE DB Provider for DB2 can be downloaded as a part of the SQL Server 2005 Feature Pack located at:
http://www.microsoft.com/downloads/details.aspx?familyid=D09C1D60-A13C-4479-9B91-9E8B9D835CDC&displaylang=en

Thanks - it will be good to hear if anyone has comments on their experience with this provider.

Donald

|||It worked great for me to receive data, but when it came to Inserting data or updating data, I could not get it to work. Using the statement Select col1, col2 from LinkedServer.DB2.X.Y works, but using Insert Into LinkedServer.DB2.X.Y values(col1Val, Col2Val) returned an error saying that it was unable to open the table. I checked permissions and it all looked good to me, so I cannot figure it out.|||

Did you use a component from dataflow task (if yes, which one - OLEDBDest, OLEDBCommand?), or you used ExecuteSQLTask to perform the insert/update?

Thanks

Wenyang

|||I used a straight SQL query, Insert Into table values (x, y, z).|||

Did you use SSIS at all? I understand you used a straignt SQL query, but I also want to know where you perform this query?

Thanks

Wenyang

|||

It should work. I have this sample here and you may try it out.

insert into MY_DB2_DATABASE.PERSON (SSN, AGE) values (11, '25')

Be sure that your connection works before you run/test your SQL task. You may start with creating a UDL file to DB2 first to establish a correct connection string. And make sure to use RUW (i.e. Units of Work=RUW). And then create a link-server to verify your connection string.

I doubted the Microsoft DB2OLEDB from feature pack supports distributed transaction. Do not enable transaction.

- Steve

|||I am performing the query using the query editor in the Database Engine inside of the Management Studio.|||

My connection string works when I read from the AS400, but not when I try to insert. My Connection String is below:

Provider=DB2OLEDB;User ID=*****;Password=*****;Initial Catalog=SQ2;Network Transport Library=TCP;Host CCSID=37;PC Code Page=1252;Network Address=192.168.212.71;Network Port=446;Package Collection=QGPL;Default Schema=QGPL;Process Binary as Character=False;Units of Work=RUW;DBMS Platform=DB2/AS400;Defer Prepare=True;Persist Security Info=True;Data Source=SQ2;Connection Pooling=False;Derive Parameters=True;

The Exact select query that i use is:

Select Top 1 * from SQ4.SQ2.MRPLVOBJ.FOEINTPL

The result is:

IPLACE IPLDSC

JP001 JAPAN 001

The query that doesnt work is:

Insert Into SQ4.SQ2.MRPLVOBJ.FOEINTPL (IPLACE, IPLDSC) values ('JP002', 'Japan 002')

The result is:

sg 7306, Level 16, State 2, Line 1

Cannot open the table ""SQ2"."MRPLVOBJ"."FOEINTPL"" from OLE DB provider "DB2OLEDB" for linked server "SQ4". Unknown provider error.

|||

I see. then this is not a SSIS issue. You'll probably need to post your question to other SQLServer forums so as to expect a better/faster helps. This forum is for SSIS only.

thanks

wenyang

|||

Alright.

Let me post my connection string so you can compare with yours.

Provider=DB2OLEDB;Password=****;Persist Security Info=True;User

ID=*****;Initial Catalog=CORPI502;Network Transport Library=TCPIP;Host

CCSID=37;PC Code Page=1252;Network Address=CORPI502;Network Port=446;Package

Collection=STEVEDB;Default Schema=STEVEDB;DBMS Platform=DB2/AS400;Process

Binary as Character=False;Connection Pooling=False;Units of Work=RUW

And the insert statement is:

insert into STEVEDB.PERSON (SSN, AGE) values (15, '25').

And that works well.

Back to your insert statement, try this:

Insert Into MRPLVOBJ.FOEINTPL (IPLACE, IPLDSC) values ('JP002', 'Japan 002')

|||I used your connection string and changed my password, library, etc. Once again the select statement worked, but the Insert Statement did not. I cannot figure out how this is possible since I am using the same credentials as the third party driver which can do the insert statement. I will continue to work on it, I appreciate your help.|||

OK, let us back up a little bit and follow a step-by-step approach.

Please start to create a linked server first. Use the connection string (i posted above) to create a linked server. Then run the "Select" query and "insert..." to against your linked server to see if it works.

You may use 4-part query or open query to do that like (note that STEVEDB is the schema name whereas PERSON is the table name):

Select * from MY_LINKED_SERVER.CORPI502.STEVEDB.PERSON

insert into MY_LINKED_SERVER.CORPI502.STEVEDB.PERSON (SSN, AGE) values (101, '23')

OR

SELECT * FROM OPENQUERY(MY_LINKED_SERVER, 'SELECT * FROM STEVEDB.PERSON')

INSERT into OPENQUERY(MY_LINKED_SERVER, 'SELECT * FROM STEVEDB.PERSON') values (999, '999')

NOTE: DO NOT ENABLE and RUN distributed transaction sinnce DB2OLEDB does NOT support it on this feature pack.

Once you get the linked server WORK, then you can try your SSIS package.

One more reminder - you may have to journal your table on DB2/AS400 before you run "insert". Give it a try.

It had worked for me and I used it in my project.

- Steve (from Minnesota)

|||

I gave it another try, now I have the following error: The OLE DB provider "DB2OLEDB" for linked server "SQ4" could not INSERT INTO table "[DB2OLEDB]".

I have not done a thing with the distributed transaction options, the service is disabled in my services tab. As for journaling the table, should I have to do it since I could do the same query from my other OLE provider?

|||

Well, i guess that I have written as specific as possible in the above. The next would be a private hands-on demo for you if needed.

As another thought - I would encourage you to try to download an EVALUATION version of Host Integration Server 2004 to replace DB2OLEDB from the feature pack. Give it a shot to see if DB2OLEDB from HIS 2004 works out. You can find HIS 2004 from Microsoft's website.

- Steve

sql

Microsoft OLE DB Provider for DB2

The Microsoft OLE DB Provider for DB2 can be downloaded as a part of the SQL Server 2005 Feature Pack located at:
http://www.microsoft.com/downloads/details.aspx?familyid=D09C1D60-A13C-4479-9B91-9E8B9D835CDC&displaylang=en

Thanks - it will be good to hear if anyone has comments on their experience with this provider.

Donald

|||It worked great for me to receive data, but when it came to Inserting data or updating data, I could not get it to work. Using the statement Select col1, col2 from LinkedServer.DB2.X.Y works, but using Insert Into LinkedServer.DB2.X.Y values(col1Val, Col2Val) returned an error saying that it was unable to open the table. I checked permissions and it all looked good to me, so I cannot figure it out.|||

Did you use a component from dataflow task (if yes, which one - OLEDBDest, OLEDBCommand?), or you used ExecuteSQLTask to perform the insert/update?

Thanks

Wenyang

|||I used a straight SQL query, Insert Into table values (x, y, z).|||

Did you use SSIS at all? I understand you used a straignt SQL query, but I also want to know where you perform this query?

Thanks

Wenyang

|||

It should work. I have this sample here and you may try it out.

insert into MY_DB2_DATABASE.PERSON (SSN, AGE) values (11, '25')

Be sure that your connection works before you run/test your SQL task. You may start with creating a UDL file to DB2 first to establish a correct connection string. And make sure to use RUW (i.e. Units of Work=RUW). And then create a link-server to verify your connection string.

I doubted the Microsoft DB2OLEDB from feature pack supports distributed transaction. Do not enable transaction.

- Steve

|||I am performing the query using the query editor in the Database Engine inside of the Management Studio.|||

My connection string works when I read from the AS400, but not when I try to insert. My Connection String is below:

Provider=DB2OLEDB;User ID=*****;Password=*****;Initial Catalog=SQ2;Network Transport Library=TCP;Host CCSID=37;PC Code Page=1252;Network Address=192.168.212.71;Network Port=446;Package Collection=QGPL;Default Schema=QGPL;Process Binary as Character=False;Units of Work=RUW;DBMS Platform=DB2/AS400;Defer Prepare=True;Persist Security Info=True;Data Source=SQ2;Connection Pooling=False;Derive Parameters=True;

The Exact select query that i use is:

Select Top 1 * from SQ4.SQ2.MRPLVOBJ.FOEINTPL

The result is:

IPLACE IPLDSC

JP001 JAPAN 001

The query that doesnt work is:

Insert Into SQ4.SQ2.MRPLVOBJ.FOEINTPL (IPLACE, IPLDSC) values ('JP002', 'Japan 002')

The result is:

sg 7306, Level 16, State 2, Line 1

Cannot open the table ""SQ2"."MRPLVOBJ"."FOEINTPL"" from OLE DB provider "DB2OLEDB" for linked server "SQ4". Unknown provider error.

|||

I see. then this is not a SSIS issue. You'll probably need to post your question to other SQLServer forums so as to expect a better/faster helps. This forum is for SSIS only.

thanks

wenyang

|||

Alright.

Let me post my connection string so you can compare with yours.

Provider=DB2OLEDB;Password=****;Persist Security Info=True;User

ID=*****;Initial Catalog=CORPI502;Network Transport Library=TCPIP;Host

CCSID=37;PC Code Page=1252;Network Address=CORPI502;Network Port=446;Package

Collection=STEVEDB;Default Schema=STEVEDB;DBMS Platform=DB2/AS400;Process

Binary as Character=False;Connection Pooling=False;Units of Work=RUW

And the insert statement is:

insert into STEVEDB.PERSON (SSN, AGE) values (15, '25').

And that works well.

Back to your insert statement, try this:

Insert Into MRPLVOBJ.FOEINTPL (IPLACE, IPLDSC) values ('JP002', 'Japan 002')

|||I used your connection string and changed my password, library, etc. Once again the select statement worked, but the Insert Statement did not. I cannot figure out how this is possible since I am using the same credentials as the third party driver which can do the insert statement. I will continue to work on it, I appreciate your help.|||

OK, let us back up a little bit and follow a step-by-step approach.

Please start to create a linked server first. Use the connection string (i posted above) to create a linked server. Then run the "Select" query and "insert..." to against your linked server to see if it works.

You may use 4-part query or open query to do that like (note that STEVEDB is the schema name whereas PERSON is the table name):

Select * from MY_LINKED_SERVER.CORPI502.STEVEDB.PERSON

insert into MY_LINKED_SERVER.CORPI502.STEVEDB.PERSON (SSN, AGE) values (101, '23')

OR

SELECT * FROM OPENQUERY(MY_LINKED_SERVER, 'SELECT * FROM STEVEDB.PERSON')

INSERT into OPENQUERY(MY_LINKED_SERVER, 'SELECT * FROM STEVEDB.PERSON') values (999, '999')

NOTE: DO NOT ENABLE and RUN distributed transaction sinnce DB2OLEDB does NOT support it on this feature pack.

Once you get the linked server WORK, then you can try your SSIS package.

One more reminder - you may have to journal your table on DB2/AS400 before you run "insert". Give it a try.

It had worked for me and I used it in my project.

- Steve (from Minnesota)

|||

I gave it another try, now I have the following error: The OLE DB provider "DB2OLEDB" for linked server "SQ4" could not INSERT INTO table "[DB2OLEDB]".

I have not done a thing with the distributed transaction options, the service is disabled in my services tab. As for journaling the table, should I have to do it since I could do the same query from my other OLE provider?

|||

Well, i guess that I have written as specific as possible in the above. The next would be a private hands-on demo for you if needed.

As another thought - I would encourage you to try to download an EVALUATION version of Host Integration Server 2004 to replace DB2OLEDB from the feature pack. Give it a shot to see if DB2OLEDB from HIS 2004 works out. You can find HIS 2004 from Microsoft's website.

- Steve