Unclosed WmDB Connections

Hello,

We have a WmDB operation service: pub.db:connect, pub.db:insert, pub.db:close. But if there is any exception between the connect and close, there will be a unclosed connection. So when we checked in DB server, we could find a connection from the webMethods server with the “AWAITING COMMAND”.

We aslo tried to invoke the pub.db:close in the “Catch” sequence,but it dosen’t work. Any one can help? Thanks.

Here are some informations of our environment:
IS: 6.1
WmDB: 6.1
DB: SQL Server 2000
Driver: JTDS 1.2

Hello,
we use a lot WmDB, and this is the right way to go:

-map (to create a document that will hold the db connection object, let’s call it localVars)
-try…catch block
–try
—pub.db:open (and map the output connection into localVars)

—pub.db:close (referring the connection insite localVars)
–catch

—pub.db:close (referring the connection insite localVars)
-map (drop localVars)

The reason to use localVars is inside [url]wmusers.com

Regards,
Sandro

Thanks Sandro,

It works fine as your way. Thanks a lot.

If you don’t want to use a global service variable to store the dbConnection, you can get the connection from the lastError/pipeline variable in the catch block.

Hi ylo,

When I tried to use the connection under the lastError/pipeline, I got the error “java.lang.ClassCastException”. It seems the connection object was unavailable after the exception. So are there some tips? Would you please share me a sample about this? Thanks a lot.

I really dislike the ylo approach (just a personal feeling); I’d rather explicit declaration without playing with pipeline variables in the catch branch.

Sandro