navige
navige

Reputation: 2517

Connection pool to DB with JAX-WS

I'm trying to build a JAX-WS that does a call to a database. In all the tutorials I found the WS has a static variable that holds the connection

    private static Connection connection;

This connection is then used for all the operations done in the database.

Now my question really is: Does that make sense - especially with high(er) traffic? Isn't it better to create a pool of connections and randomly pick one and use that?

Upvotes: 0

Views: 284

Answers (1)

Pradeep Pati
Pradeep Pati

Reputation: 5919

The tutorials probably are doing it the quick and dirty way. Always use a Managed Connection pool, else you are bound to run into issues, and don't need higher traffic for that.

Upvotes: 1

Related Questions