Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

JDBC Connection Pooling

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, I want to access a db using properties object(connection pooling I think). Is there any one here who could give me an example how to do this? The reason why I want to do this is because the JDBC code should not be tempered with any time some one comes new. One just have to change the logon properties (basically the userid and pwd)in an external file.Below is the code.

 
author & internet detective
Posts: 40198
816
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Erik,
Welcome to JavaRanch!

You can create a Properties file by calling its load() method. Then you can use the getters to get the individual properties instead of hardcoding them in the connection request.

Note that this is not connection pooling. Connection pooling gets a connection from a datasource on an application server (or other pool.) Also, I don't see where you close the resultset.
 
Clowns were never meant to be THAT big! We must destroy it with this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic