[INTERFACES] [Fwd: postgresql JDBC driver question

From: Lim Cheng Peck-A15349 <Lim(dot)Cheng(dot)Peck(at)motorola(dot)com>
To: "'pgsql-interfaces(at)postgresql(dot)org'" <pgsql-interfaces(at)postgresql(dot)org>
Subject: [INTERFACES] [Fwd: postgresql JDBC driver question
Date: 1999-10-06 10:51:33
Message-ID: 79C132328CFCD211A83E00805F150827215366@SZMY07-B
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

Hi Peter T Mount , Murad Nayal and all,
Referring to the subject above on POSTGRESQL JDBC Interface mailing
list, I still
can't find any exact solution on how to solve the problem if we have the "No
suitable driver exception" error on
APPLET from IE5(Microsoft (R) VM for Java (tm), 4.0 Release 4.79.0.2339) and
Netscape 4.61 (Java1.1.5).
I did the Applet compilation (JAVAC) with JDK 1.2. Is this is the
main problem ??

Here is my HTML file for the applet
database.jar is included postgresql classes and VLookup classes.

<HTML>
<BODY>
<APPLET CODE="VLookup.class"
archive="database.jar"
WIDTH=800 HEIGHT=800>
</APPLET>
</BODY>
</HTML>

Thanks and hope to hear from you soon.
Best Regards,
CPLIM

Your QUESTION-ANSWER on Date: Thu, 29 Oct 1998 00:54:31 -0500

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

----------------------------------------------------------------------------
----

From: Murad Nayal <murad(at)godel(dot)bioc(dot)columbia(dot)edu>
To: Peter T Mount <peter(at)retep(dot)org(dot)uk>
Subject: Re: [INTERFACES] [Fwd: postgresql JDBC driver question]
Date: Thu, 29 Oct 1998 00:54:31 -0500

----------------------------------------------------------------------------
----

Peter T Mount wrote:



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.

Thank you for your suggestions. I followed your directions by unzipping the
jar file in the html directory, removed the archive attribute from the
<applet> tag and remove the class extension from the code attribute in the
applet tag. Now netscape produces: user authentication failed exception
while
internet explorer produces No suitable driver exception. Mind you, the
connection works just fine if you do it using the appletviewer locally on
the
machine. I am including next a copy of the html and the java files with just

the user password obsecured (you have to trust me it does work :-)).

thanks indeed for any suggestions and help

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Thomas Lockhart 1999-10-06 13:37:40 Re: [INTERFACES] Questions connecting to PostgreSQL.
Previous Message Dave Page 1999-10-06 08:55:22 RE: [INTERFACES] pgAdmin v6.5.2 Released