How to set connection pool size,max wait time for connection through java code
posted 1 year ago
There is one devloped java code in which the code is interacting with As400 Db and drivers used are JT400(version 8.2). The method used to connect to Db is getjdbctype4connection() ,statement and result set are used to interact DB queries. So is there any possible way to set connection pool size,max wait time for connection through code? if yes then what changes do I need to do in current code?
Are you talking about a connection pool defined in Websphere application server, or do you want to create a Connection Pool outside Websphere - for example inside a stand-alone java program ?
In the first case, I'm not aware of a method to set properties you pointed out, but, even if they exist, I won't use them if I were you - Datasource config should be handled within an appserver context, not programmatically (IMHO).
Besides this, why you use getjdbctype4connection() ? You should work with DataSources, look up them and use getConnection() method to retrieve connections to database. You should not rely on which JDBC driver is actually
used in your application.
In the second case, yes, I remember that you can setup a connection pool with JT400 - i don't remember details, though. But you should find a lot of examples on IBM's toolbox web site.