Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

regarding Drivers

 
Krishna Bulusu
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i have one small doubt...
we will use Class.forName("driver"); to load the driver....

my doubt is can we load two drivers??
like

Class.forName("driver1");
Class.forName("driver2");

will the aboue code compiles and runs or any exception??

thanks in advance

regards,
krishna.
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can have as many Class.forName statements in a program as you wish, just as you can use several different JDBC drivers in the same program. Mind you, Class.forName is a generic way to load classes, and not exclusively used for JDBC.
 
Krishna Bulusu
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank u Ulf...

but in such case where i have loaded two drivers in the same programme...which one will be pramoted .....??
 
Martin Simons
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That depends on your connection url. jdbcracle would use the loaded
oracle driver. jdbc:mysql would use the loaded mysql driver. If you
load two drivers for the same db, then I believe it would use the first
one loaded for that connection url type.
[ May 29, 2006: Message edited by: Martin Simons ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic