B4J Question How to limit jRDC2 connections to an Oracle server [SOLVED]

cheveguerra

Member
Licensed User
Longtime User
Hi everybody,

I'm using jRDC2 to connect to an Oracle database. Everything works fine, but when I run a query that returns more than … let's say 50 records, the jRDC2 server creates 15 connections, and doesn’t release them.

The Oracle server has limited connections, and other services also connect to it, so I need to reduce if possible the number of connections.

So, are there any ways to, either, create fewer connections or disconnect and free them up for other processes after they’re used?

I am using the default B4J jRDC2 application, so no extra code beside the added oracle driver.

Best regards
 
Last edited:
Solution
Hi again, I will answer my own question,

After asking ChatGPT and getting a wrong answer, I found this solution by @EnriqueGonzalez :

B4X:
   pool.Initialize(config.Get("DriverClass"), config.Get("JdbcUrl"), config.Get("User"), config.Get("Password"))
   Dim jo As JavaObject = pool
   jo.RunMethod("setMaxPoolSize", Array(10)) 'number of concurrent connections

It works just perfect!!!

Best regards

cheveguerra

Member
Licensed User
Longtime User
Hi again, I will answer my own question,

After asking ChatGPT and getting a wrong answer, I found this solution by @EnriqueGonzalez :

B4X:
   pool.Initialize(config.Get("DriverClass"), config.Get("JdbcUrl"), config.Get("User"), config.Get("Password"))
   Dim jo As JavaObject = pool
   jo.RunMethod("setMaxPoolSize", Array(10)) 'number of concurrent connections

It works just perfect!!!

Best regards
 
Last edited:
Upvote 0
Solution
Cookies are required to use this site. You must accept them to continue using the site. Learn more…