Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

connecting to two database simulteneously

843854Jul 12 2004 — edited Jul 14 2004
I am writing code to get data out of an existing customer database and put this data into a new database as part of a product update. I am told I can start one database server, and use it to get connections to both databases. My problem is that the database are in essence the same - they are just in different directories. My directory structure looks like this:

c:\myapplication\my.db
c:\old_myapplication\my.db



To access the first database I do the following:
 // initialize the database driver
String dbDriver = properties.getProperty("database_driver","com.sybase.jdbc2.jdbc.SybConnectionPoolDataSource");

String URL = "jdbc:sybase:Tds:127.0.0.1:2638";

try {
  Class.forName(dbDriver);
 } catch(Exception e) {}


originalDBConnection = DriverManager.getConnection(URL, "username","password");
.....

This works fine and I connect to the first database. My problem is that I can't figure out how to connect to
the second database! I don't see where the path to the database is ever specified, and since both
databases use the same driver it seems I need to use the same URL.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 11 2004
Added on Jul 12 2004
4 comments
79 views