wood burning stoves 2.0*
The moose likes JDBC and the fly likes how we can create database connection dynamically. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "how we can create database connection dynamically." Watch "how we can create database connection dynamically." New topic
Author

how we can create database connection dynamically.

ashish jadhav
Ranch Hand

Joined: Nov 20, 2008
Posts: 62
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

Joined: Feb 19, 2008
Posts: 2902
    
    1

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.


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
ashish jadhav
Ranch Hand

Joined: Nov 20, 2008
Posts: 62
Thanks sagar..
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

You're welcome
ashish jadhav
Ranch Hand

Joined: Nov 20, 2008
Posts: 62
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.
 
subject: how we can create database connection dynamically.
 
Similar Threads
How create API for DB application.
Reading fields' information of DataBase
Creating connection pool and data source dynamically
Programatically Creating Contriggerbean
dynamic database connection