Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how we can create database connection dynamically.

 
ashish jadhav
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
i want create one application in that application we read DSN name,table name,url etc. database related information and as per that information i want to create DB connection.means when any user can change only text file data from that data connect to perticular DB. please help me
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use .properties file to load the DSN , user name, etc information from the file. Use Properties class to read file data OR Use java properties file example to get more information.
 
ashish jadhav
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks sagar..
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
 
ashish jadhav
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi sagar,

I have developed a DB application, using this web application we can connect to any DB and TABLE. Just we have to type DB name and TABLE name in the properties file in key-value pair format.
when our web application runs it automatically read table related information from properties file and connect to specified table.
Now i want to create my own API for this application, so we can use this application anywhere through API.
Do you have any idea??please inform me.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic