Thread: Loading JDBC - driver

Loading JDBC - driver

From
"Sergei Chernev"
Date:
Hello,

I wonder, if there is a way to load JDBC- driver from network.
I know the method to connect using  jdbc6.4.jar on local disk
and editing CLASSPATH, but it seems to me inconvenient to
ask user to download driver and edit environment.

Does it possible to use construction like that:
Class.forName("http://somewhere.com/postgresql.Driver/jdbc6.4.jar/postgresql
.Driver").newInstance(); ?
Excuse me if it is FAQ, but I didn't find anything of the kind in mailing
list.

Thank you,
---------------------------
Sergei Chernev
Internet: ser@nsu.ru
Phone: +7-3832-397354


Re: [INTERFACES] Loading JDBC - driver

From
Peter T Mount
Date:
On Mon, 15 Feb 1999, Sergei Chernev wrote:

> Hello,
>
> I wonder, if there is a way to load JDBC- driver from network.
> I know the method to connect using  jdbc6.4.jar on local disk
> and editing CLASSPATH, but it seems to me inconvenient to
> ask user to download driver and edit environment.
>
> Does it possible to use construction like that:
> Class.forName("http://somewhere.com/postgresql.Driver/jdbc6.4.jar/postgresql
> .Driver").newInstance(); ?
> Excuse me if it is FAQ, but I didn't find anything of the kind in mailing
> list.

That's ok. What you need is a custom class loader, that fetches the jar
file from a url, then extracts the classes from it.

This is how browsers do it, but as to how you would write a class loader
is another question (one of those things I havent got round to trying yet)
;-)

Peter

--
Peter Mount, IT Section
petermount@it.maidstone.gov.uk
Anything I write here are my own views, and cannot be taken as being the
official words of Maidstone Borough Council