B4J Question Connection pool <Solved>

Daestrum

Expert
Licensed User
Longtime User
Not having used connection pooling, two simple questions.

Do all connections go through one username/password logon to the database?

If so, can you have more than one connection pool?
 
I don't know. Create another pool object (2) and try it out.


Code: Copy
Sub Process_Globals
    Public pool As ConnectionPool
    Public pool2 As ConnectionPool
End Sub

Public Sub init
    Dim JdbcUrl As String = Main.settings.Get("JdbcUrl")
    Dim driverClass As String = Main.settings.Get("DriverClass")
    Dim dbuser As String = Main.settings.Get("DBUser")
    Dim dbpassword As String = Main.settings.Get("DBPassword")

    pool.Initialize(driverClass, JdbcUrl, dbuser, dbpassword)

     ' pool 2 with diff user and password...
    Dim dbuser2 As String = Main.settings.Get("DBUser2")
    Dim dbpassword2 As String = Main.settings.Get("DBPassword2")

    pool2.Initialize(driverClass, JdbcUrl, dbuser2, dbpassword2)

End Sub

Then to access...

Code: Copy
Dim sql1 As SQL = pool.GetConnection

'or

Dim sql1 As SQL = pool2.GetConnection
 
Last edited:
Upvote 0
Ty, will have a read to see what the settings are, then try it.
 
Upvote 0
Just make sure you don't have more than one MySql Server running or it will F@#% you up like it did me!
2 days it took to discover - smart guys would have nailed this within 1 hour...(that is NOT me) Live and Learn....

Every day I learn more, retain less and progress slowly...

Hey, even when you are falling on your face, you are still moving forward... (or so it seems)
 
Upvote 0
Solved you can have multiple pools - thanks @Harris for the pointers.
 
Upvote 0
Back
Top