• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

regarding Drivers

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 .....??
 
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That depends on your connection url. jdbc:oracle 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 ]
 
What's brown and sticky? ... a stick. Or a tiny ad.
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic