quality@glassfish.java.net

DB2 JDBC Type 4 Support?

From: Jagadish Prasath Ramu <Jagadish.Ramu_at_Sun.COM>
Date: Fri, 17 Nov 2006 14:08:55 +0530

Hi Iran,

The exception
"com.ibm.db2.jcc.b.DisconnectException: A communication error has been
detected.

Communication protocol being used: Reply.fill(). Communication API being used:
InputStream.read(). Location where the error was detected: Read timed out.
Communication function detecting the error: *. Protocol specific error codes(s)
TCP/IP SOCKETS "

seems to be because of intermittent network failures/ stale connections.

Setting validation ON must solve the issue.
Since autocommit/meta-data does not solve (because these values are cached by
db-2 driver and hence actual validation request does not go to db-server) the issue,
"table" validation is the only way out.

Possible ways to solve the issue:

1)
Is it possible for you to create a table like "dual" as that in oracle ?
It will have a dummy row (you can also give only "select" grant to that table)

2)
In your pool setting, I could see : steady-pool-size:8, max-pool-size:16, idle-timeout:600

For 9.0:
Can you set steady-pool-size to 0 and max-pool-size to 16 and pool-resize quantity to 4
[idle-timeout to be lesser than fire-wall timeout]

For 9.1 :
Can you change the idle-timeout-in-seconds to lesser period (300 or keep it to
be lesser than fire-wall timeout.)

3)
9.1 latest builds have a new feature in connection pool called
max-connection-usage. [connections will be recycled after specified number of usages]
This will further avoid stale connections lying in the pool.

4)
9.1 latest builds will have com.sun.appserv.jdbc.DataSource.markConnectionAsBad() available.
Since the exception you get explictly states that it is a DisconnectException, application can
catch this, markConnectionAsBad and close the connection.

http://fisheye5.cenqua.com/browse/~raw,r=1.4/glassfish/jdbcra/src/com/sun/appserv/jdbc/DataSource.java


On an average, after how long do you see the DisconnectException ?


Thanks,
-Jagadish








------------------------------------------------------------------------
Make sure you set the DB2 driver property driverType = 4 when you

configure the DB2 driver connection pool as i believe this defaults to 2
(type 2).

Shreedhar Ganapathy wrote:
> cc'ing the dev and users aliases for broader audience and any further
> ideas.
>
> Shreedhar Ganapathy wrote:
>> Hi Iran
>> Could you try the solution in this forum entry?
>> http://forum.java.sun.com/thread.jspa?threadID=730463&messageID=4203771
>>
>> If it works please let us know, I will follow up with the appropriate
>> team for doc updates.
>>
>> regards
>> Shreedhar
>>
>> iran_at_nc.rr.com wrote:
>>> Thanks for the reply. We are already familiar with the Type 2 driver
>>> documentation. It requires you to catalog your DB2 database on the
>>> application server machine and have the native driver *.so or *.dll
>>> available in the application server classpath. This is not our desired
>>> configuration. The only listed Type 4 driver is the Sun driver made
>>> from Data Direct drivers. Those drivers are only available for client
>>> development stations unless we are missing something. From our
>>> research, it seems you'd have to buy server licenses which we are trying
>>> to avoid as we have the DB2 drivers that work elsewhere.
>>>
>>> Iran.
>>>
>>> ----- Original Message -----
>>> From: sreeni <smunnangi_at_gmail.com>
>>> Date: Sunday, November 12, 2006 8:29 pm
>>> Subject: Re: DB2 JDBC Type 4 Support?
>>> To: issues_at_glassfish.dev.java.net
>>> Cc: quality_at_glassfish.dev.java.net
>>>
>>>
>>>> Pl. refer to Sun Java System Application Server 9.0 doc.
>>>> specifically on
>>>> support for
>>>> IBM DB2 8.1 and 8.2 Type 2 Driver
>>>>
>>>> http://docs.sun.com/app/docs/doc/819-3658/6n5s5nklf?a=view
>>>>
>>>> thanks
>>>> sreeni
>>>>
>>>>
>>>> Iran Hutchinson wrote:
>>>>
>>>>> We are trying to use GlassFish for several large projects(ranging
>>>>>
>>>> from
>>>>
>>>>> 3,000 users to > 200,000) and one database we have to connect to
>>>>>
>>>> is
>>>>
>>>>> DB2 8.2. The URL:
>>>>>
>>>> https://glassfish.dev.java.net/quality/matrix.html
>>>>
>>>>> says this has been tested but there is no documentation for
>>>>> configuring a Type 4 JDBC driver for DB2 only a Type 2 driver
>>>>>
>>>> which we
>>>>
>>>>> don't use. We are experiencing several issues with connection
>>>>> pooling configuration and usage ranging from timeouts on
>>>>>
>>>> connections
>>>>
>>>>> where there should be none to not being able to get a new
>>>>>
>>>> connection
>>>>
>>>>> after a period of time. One killer is that we cannot connect to
>>>>>
>>>> a
>>>>
>>>>> database that we only have access to stored procedures, we cannot
>>>>> configure it to validate on "table" as we have no access to
>>>>>
>>>> tables.
>>>>
>>>>> All the other validation methods lead to a myriad TCP/IP
>>>>>
>>>> disconnect
>>>>
>>>>> errors.
>>>>>
>>>>> We filed a bug to document some of what we are experiencing:
>>>>>
>>>>>
>>>> https://glassfish.dev.java.net/issues/show_bug.cgi?submit=Go+to&id=1377
>>>>
>>>>> . Is the DB2 JDBC Type 4 driver supported for connection pooling
>>>>>
>>>> or
>>>>
>>>>> will it be supported? We are hoping it is a configuration issue,
>>>>>
>>>> but
>>>>
>>>>> can't get confirmation on that either. We have not had this
>>>>>
>>>> issue on
>>>>
>>>>> the other application servers with the IBM DB2 driver, so we were
>>>>> assuming either a bug or a miss-configuration. We'd be willing
>>>>>
>>>> to
>>>>
>>>>> help in anyway needed.
>>>>>
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Iran.
>>>>>
>>>>> ------------------------------------------------------------------
>>>>>
>>>> ---
>>>>
>>>>> To unsubscribe, e-mail: issues-unsubscribe_at_glassfish.dev.java.net
>>>>> For additional commands, e-mail: issues-help_at_glassfish.dev.java.net
>>>>>
>>>>>
>>>> --------------------------------------------------------------------
>>>> -
>>>> To unsubscribe, e-mail: issues-unsubscribe_at_glassfish.dev.java.net
>>>> For additional commands, e-mail: issues-help_at_glassfish.dev.java.net
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: issues-unsubscribe_at_glassfish.dev.java.net
>>> For additional commands, e-mail: issues-help_at_glassfish.dev.java.net
>>>
>>>