How to make a loaded driver reside in memory


I have a 3rd party driver which I need to load every time I make a connection to a database. I would like to optimize it by loading the driver when a specific packade is loaded instead (only load the driver once).

My question is: How can a make the driver “stay loaded”? If I load if from a normal java service (Class.forName(driver)), it automatically unloads when the service is finsished.

Any ideas?


If you place the driver in the \lib folder…the driver will get loaded when the server starts up and will stay loaded until the server goes down…i am not sure if this is what you are looking for…

Hope this helps


Thanks for the reply!

It´s exactly what I´m looking for, however, the it does not seem to work.

Another solution: I tried creating a new package and set a startup service that loaded the driver ( Class.forName(driver) ), and this seem to work. But I don´t know if it will stay loaded or if the garbage collector simply cleans it up after a while… ?