Results 1 to 12 of 12
Thread: Loading of JDBC Driver
- 11-06-2010, 05:17 PM #1
Member
- Join Date
- Nov 2010
- Posts
- 8
- Rep Power
- 0
- 11-06-2010, 05:22 PM #2
Senior Member
- Join Date
- Mar 2010
- Location
- Manila, Philippines
- Posts
- 257
- Rep Power
- 4
OracleDriver? What API are you using?
Anyways, the only JDBC I knew for oracle is similar to MySQL.
But instead of loading the MySQL library, you must load/import the oracle driver (*.jar files).
And with the static way. I don't about that.
This is the only way (In my terms, I haven't tried other ways yet).Java Code:Class.forName(driverName).newInstance();
Cyril H.Every project, package, class, method, variable, syntax, algorithm, etc.
are registered in my memory bank. Thanks to this thread.
- 11-06-2010, 05:37 PM #3
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,589
- Blog Entries
- 7
- Rep Power
- 17
It depends on the driver and its version. Old drivers had to be instantiated, e.g. new MyDriver(); and you had to register them at the DriverManager. Later on you just had to mention the class as in ClassForName("foo.bar.MyDriver") and the driver would load and register itself. Again a bit later the DriverManager took a more active role and would read the "jdbc.drivers" property for available drivers and preload them. Nowadays the DataSource is the big hype. Read all about it in its API documentation.
kind regards,
Jos
- 11-06-2010, 05:42 PM #4
Member
- Join Date
- Nov 2010
- Posts
- 8
- Rep Power
- 0
Loading of Driver class
Thnx, i wantto import the oracle driver and load the driver class in a static way. how can i do that
-
OP, please knock off the multiposting. I've locked your other two threads and have moved JosAH's reply here.
- 11-06-2010, 06:29 PM #6
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,589
- Blog Entries
- 7
- Rep Power
- 17
- 11-10-2010, 04:03 PM #7
Member
- Join Date
- Nov 2010
- Posts
- 8
- Rep Power
- 0
way to load JDBC driver
Hi Jos thnx, but what u have suggested is dynamic way of loading the driver and it works fine but still i m not cleared on my question. Can i load a driver like for example Myclass m1= new Myclass();
- 11-10-2010, 04:58 PM #8
Moderator
- Join Date
- Apr 2009
- Posts
- 10,484
- Rep Power
- 16
You can use this to register the driver directly if you want:
That's the other technique, if you don't plan on changing the database behind your code.Java Code:DriverManager.registerDriver (new oracle.jdbc.OracleDriver());
- 11-10-2010, 04:58 PM #9
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,589
- Blog Entries
- 7
- Rep Power
- 17
- 11-10-2010, 05:03 PM #10
Moderator
- Join Date
- Apr 2009
- Posts
- 10,484
- Rep Power
- 16
- 11-10-2010, 07:07 PM #11
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,589
- Blog Entries
- 7
- Rep Power
- 17
- 11-11-2010, 08:53 AM #12
Moderator
- Join Date
- Apr 2009
- Posts
- 10,484
- Rep Power
- 16
Similar Threads
-
com.mysql.jdbc.Driver
By uthpalaw in forum EclipseReplies: 2Last Post: 10-14-2010, 05:09 AM -
JDBC Driver
By Ursula in forum New To JavaReplies: 6Last Post: 08-23-2010, 05:41 PM -
DB2 JDBC Driver upgrade
By sanssan in forum JDBCReplies: 2Last Post: 09-23-2008, 04:52 PM -
JDBC Driver problem
By Swamipsn in forum New To JavaReplies: 3Last Post: 08-09-2007, 03:55 PM -
Help with JDBC driver
By Daniel in forum JDBCReplies: 2Last Post: 07-03-2007, 08:16 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks