GithubHelp home page GithubHelp logo

Comments (4)

solinad21 avatar solinad21 commented on June 23, 2024

Hello i am using this lib thanks. do you have some basic example about how to use dbconnectionpool ?

i am building an app with diferent conns for each user.

from yank.

timmolter avatar timmolter commented on June 23, 2024

Multiple connections is really easy. In your DB.properties file you just need multiple entries. For example:

driverclassname=org.hsqldb.jdbcDriver

# User1
user1.url=jdbc:hsqldb:mem:aname;shutdown=true
user1.user=user1
user1.password=
user1.maxconn=10

# User2
user2.url=jdbc:hsqldb:mem:aname;shutdown=true
user2.user=user2
user2.password=
user2.maxconn=10

Then, whenever you use the DBProxy class to run SQL queries, you need to reference the specific pool name like this:

DBProxy.executeSQL("user1", SQL, params);
DBProxy.executeSQL("user2", SQL, params);

Each user get's its own connection pool.

from yank.

solinad21 avatar solinad21 commented on June 23, 2024

thanks for your quick response.

I quite understand the idea.

I use mysql, I guess this works for different urls.

from yank.

timmolter avatar timmolter commented on June 23, 2024

For MySQL the driverclassname and url would look somthing like this:

driverclassname=com.mysql.jdbc.Driver
user2.url=jdbc:mysql://localhost:3306/DB_NAME

from yank.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.