The error comes from DB2, not SQL Server. I Googled below:
SQLSTATE 57030
And found for instance http://dbforums.com/t521957.html.
Perhaps each OPENQUERY opens a new connection (or what it is called in DB2 language)? One thing you
can check is the different settings for remote servers available with sp_configure. But you will
also want a DB" technician available to troubleshoot this.

Signature
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
> Hello, every body.
>
[quoted text clipped - 64 lines]
> Regards,
> Ling, Xiao-li
Yes, it comes from DB2. But I think the reason is every SQL Server
OPENQUERY statement can't timely release connection then lead to this
problem.
So wether there are some ways to get OPENQUERY release their
connection? Changing Query timeout of LInked Server is not reasonable
because query takes long time depending on DB2 data scale.
Thanks for your reply.
> The error comes from DB2, not SQL Server. I Googled below:
> SQLSTATE 57030
[quoted text clipped - 78 lines]
> > Regards,
> > Ling, Xiao-li
Erland Sommarskog - 22 Sep 2006 08:29 GMT
> Yes, it comes from DB2. But I think the reason is every SQL Server
> OPENQUERY statement can't timely release connection then lead to this
> problem.
This is not impossible, as OLE DB employs connection pooling. That is,
if you connect to a server and disconnect, OLE DB lingers to the connection
for some time, typically 60 seconds. A new connection with the same
properties will reuse that connection.
To verify that there may be a problem with connection pooling run a
query with OPENQUERY from SQL Server, and look in DB2 if this cause a
new connection. Then run a new query from SQL Server and see if you get
a new connection. (Note: I have never seen DB2, so I cannot assist with
that part.)
In the definition of the linked server, you can try to add this to the
connection string:
"OLE DB Services = -2;"
This turns off connection pooling. But be careful with this, as could
result in DB2 being swamped in connection attempts when you run your
cursor.
A better approach may be to replace the cursor with a single query,
but without the details, it's difficult to say how this should be done.
But generally, running cursors is very expensive.

Signature
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Thanks, Erland.
I can't use a single query, because linked DB2 server has large scale
data (million level). I had practised to join linked DB2 server tables
with local table, the result was very frustrating, the performance very
low, because local SQL Server fetched all data from linked DB2 server,
then executed the distributed query.
I used the IBM DB2 OLE DB Provider instead of Microsoft OLE DB Provider
For DB2.
Don't know whether this provider support "OLE DB Services = -2;"
property. I should wait to next Monday to test.
Do you think whether things will be better if I use Microsoft OLE DB
Provider For DB2?
And where to get the Microsoft OLE DB Provider For DB2? Could you give
me a link?
Many Thanks.
> The error comes from DB2, not SQL Server. I Googled below:
> SQLSTATE 57030
[quoted text clipped - 78 lines]
> > Regards,
> > Ling, Xiao-li
Erland Sommarskog - 23 Sep 2006 21:20 GMT
> I used the IBM DB2 OLE DB Provider instead of Microsoft OLE DB Provider
> For DB2.
> Don't know whether this provider support "OLE DB Services = -2;"
> property. I should wait to next Monday to test.
Since this property is in OLE DB Core Services, I would expect so,
although I cannot vouch for it.
> Do you think whether things will be better if I use Microsoft OLE DB
> Provider For DB2?
Didn't I say that I have no experience of DB2? I don't want to speculate
about software I don't know about. But if you try the other provider,
you may want to try to run the full query again. If the provider provides
the SQL Server optimizer with better statistics, the query plan may be
better.
> And where to get the Microsoft OLE DB Provider For DB2? Could you give
> me a link?
A couple of clicks at www.google.com lead me to:
http://www.microsoft.com/downloads/details.aspx?familyid=d09c1d60-a13c-4479-
9b91-9e8b9d835cdc&displaylang=en

Signature
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx