2

Right now I'm just writing methods that does Base.open(), do some operation, and then Base.close(). However, this is extremely inefficient especially when lots of these method calls are made, so I'd like to use some kind of connection pool with ActiveJDBC. Is there a way to use something like a connection pool with ActiveJDBC, or some other way to approach this problem instead of doing Base.open() and Base.close() each time I access the DB?

Thanks in advance! :)

Hongyi Li
  • 1,059
  • 2
  • 11
  • 19

1 Answers1

3

Here is an example of using ActiveJDBC with a pool: https://github.com/javalite/activejdbc/blob/master/activejdbc/src/test/java/org/javalite/activejdbc/C3P0PoolTest.java

However, you still need to open and close a connection, except you are getting a connection from pool and returning back to pool. If you provide more information on what type of application you develop, I can potentially provide better advice

-- igor

ipolevoy
  • 5,432
  • 2
  • 31
  • 46