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

JDBC driver

 
Vandiyadevan senthan
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear All,

Can we load more than one JDBC driver in my program?If yes, how can it be possible?If any one did, could you pls share any sample code if you have?

Alternatively ,will it throw outofMemory exception?

Thanks in Advance,
Senthan
 
Scott Selikoff
author
Saloon Keeper
Posts: 4033
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Definitely, I don't really see what your worry is. You can load multiple drivers to connect to multiple different databases.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15632
46
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you know how to load one JDBC driver? You use Class.forName("...") and open a connection using (for example) DriverManager.

There's nothing that will stop you loading two different JDBC drivers in the same program. Just do Class.forName("...") for both drivers. If you get a connection using DriverManager, it will choose the appropriate driver based on the JDBC URL that you're passing it.

Why whould you think this would throw an OutOfMemoryError? That doesn't have anything to do with JDBC drivers in general.
 
Vandiyadevan senthan
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Scott/Jesper,

Thanx a lot for our valuable response..

Kind Regards,
Senthan
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Vandiyadevan senthan:
Alternatively ,will it throw outofMemory exception?


Weeelll, I'd say it's possible. Heck, anything is possible.
Depending on the driver type used it may use more or less memory in your application. I the days we had use the Oracle Type-2 driver, our connection pools used a large amount of memory (about 50Mb when machines usually had 128 or 256 physical). It's not so bad now using the type-4 driver.

That's really just an anecdote. My real answer is similar to Jespers: If it's a problem, worry about it, otherwise don't worry about it
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic