JDBC Driver implmentation??
Posted on 2006-04-11
I have asked a similar question in another thread but I didn't get an answer I need.
Let me try this again if I can get kick start my brain.
I need to create a JDBC driver which will connect to Mysql and oracle.
I have to implement the Driver, Connection, Statement classes etc.
What I am trying to do is I want to hide I am using two different JDBC drivers to mysql and oracle.
What I am doing is I am making a fake driver in turn it will connect to mysql and oracle driver which are availble from vendors.
When I load myDirver my calling
String URL ="MYFakeURL"
Connection con = DriverManger.getConnection(URL, info)
Statement stm = con.createStatement
These will be called from my application.
When this is called I would like to make connections to two drivers(mysql & oracle ) and keep open.
I want to use either mysql or oracle connection depends on the sql qeury which I will parse to get the table names and use the correct connection to connect to the database.
I guess I need to load these two drivers in Connection Class like these
Connection mySqlcon = DriverManger.getConnection("jdbc:mysql://126.96.36.199/MyId", info)
Connection Oraclecon = DriverManger.getConnection("jdbc:oracle:thin:@MyAddress:1521:Somthing", info)
I created those in My Connection Class constructor.
I noticed when I create connection. It is using myDriver class and instead of their driver classes.
How do I create these two connection and should I do this in MyConnection Class.
I am not really sure what I need to do.