Re: [INTERFACES] [Fwd: postgresql JDBC driver question]

From: Peter T Mount <peter(at)retep(dot)org(dot)uk>
To: Murad Nayal <murad(at)godel(dot)bioc(dot)columbia(dot)edu>
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: [INTERFACES] [Fwd: postgresql JDBC driver question]
Date: 1998-10-28 22:05:35
Message-ID: Pine.LNX.3.96.981028215045.814c-100000@maidast.retep.org.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

On Wed, 28 Oct 1998, Murad Nayal wrote:

> > I am baffled:
> >
> > I wrote a small java program to test postgresql jdbc driver. the applet
> > runs fine locally using applet viewer. indicating that the driver is
> > recognizing the url and responding to it correctly. however I get the
> > message "NO suitable Driver" when the applet is run from a remote
> > browser. the Class.forName("postgresql.Driver"); does not produce an
> > exception leading me to believe that the Driver is found but it is not
> > accepting the url (same one that worked locally)?

Ok, applets can be horrible little things, and sometimes it's not their
fault. Nine times out of ten it's the sandbox (applet security), or a
browser not handling java 1.1 or jdbc (some don't know about jdbc :-( )

Your code looks ok. I placed your URL into an application here, and all I
got was:

Connection failed: java.net.UnknownHostException: godel.bioc.columbia.edu

which is ok, as I wasn't connected at the time ;-)

> > <Applet code="JDBCtest.class" archive=postgresql.jar width=300
> > height=300> </Applet>

As far as I can see, your problem is here.

First, don't put .class in the code argument. It can break some browsers.
Technically it's the class name that goes here, not the file name.

The main problem is the archive argument. The browser is loading the
postgresql.jar file, looking for the JDBCtest class. It fails, so it then
looks at the directory that the html file is in. It find's JDBCtest, but
as it's not in the jar file, some browsers implementations of the
"Sandbox" prevents the driver to be found.

There are two solutions:

extract the files from postgresql.jar into your html directory

or

create a new jar file containing the contents of postgresql.jar
and your applet.

Remember: it's important to keep the directory structure.

> > Thanks for the help

Hope that helps.

Peter

--
Peter T Mount peter(at)retep(dot)org(dot)uk
Main Homepage: http://www.retep.org.uk
PostgreSQL JDBC Faq: http://www.retep.org.uk/postgres
Java PDF Generator: http://www.retep.org.uk/pdf

In response to

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Thomas G. Lockhart 1998-10-29 03:32:15 Re: [INTERFACES] Does "constraint" and "check" work in 6.3.2 ?
Previous Message Gus Nwosu 1998-10-28 20:02:47 Re: [INTERFACES] PgAccess Problem