Обсуждение: RE: [INTERFACES] JDBC driver question

Поиск
Список
Период
Сортировка

RE: [INTERFACES] JDBC driver question

От
Peter Mount
Дата:
Applets are weird beasts - which is why I don't write them any more ;-)

Anyhow, you need to put the classpath in the <applet> tag. I'm not 100%
certain, but it should go under the archive= parameter?

Peter

-- 
Peter Mount
Enterprise Support
Maidstone Borough Council
Any views stated are my own, and not those of Maidstone Borough Council.



-----Original Message-----
From: Twinsun [mailto:id212@cam.ac.uk]
Sent: 15 July 1999 20:54
To: pgsql-interfaces@postgreSQL.org
Subject: [INTERFACES] JDBC driver question


Hello,

Sorry if this question has been covered before...

I wrote an applet which connects to my db and displays some statistics.
I've got it on my account on Linux (RedHat 5.2) box. I've set up
classpath for the driver:
=========================================
PATH=/usr/local/pgsql/bin:$PATH:/usr/local/jdk1.2/bin
MANPATH=$MANPATH:/usr/local/pgsql/man
PGLIB=/usr/local/pgsql/lib
PGDATA=/usr/local/pgsql/data
CLASSPATH=/usr/local/pgsql/lib/postgresql.jar:.

export PATH MANPATH PGLIB PGDATA CLASSPATH
=========================================

No errors when I compile my applet.
When I connect to my pages on the Net from my local machine (under Win)
it doesn't work...
It throws: Can't find Database driver class .... postgresql.Driver
exception.
Interesting that if I have postgresql.jar in classpath on my local
machine then the applet works just fine.

Any ideas would be very much appreciated as this is a part of my project
I have to finish by 31 July.

You can see it for yourself on:
http://simon.trinhall.cam.ac.uk/~id212/

There is a form linked to a cgi scipt which basically just prints an
html page with applet code in it with a query as a parameter to the
applet.


Thank you,

Igor





Re: [INTERFACES] JDBC driver/applet question

От
Twinsun
Дата:
Hello,

Thank you for your reply-- it helped! :-)

I added in applet ARCHIVE and CLASSPATH parameters as follows:
<APPLET CODE='Statistics.class' ARCHIVE='postgresql.jar' ...>
<PARAM NAME='classpath' value='.'>

There are two problems now.

Firstly, it works in Netscape but still doesn't in IE 4.x --  it downloads
posgresql.jar on the local machine and then throws: "No siutable driver"
exception(which differs from the exception which was thrown before).

Secondly, it's a very inappropriate solution -- to force a user to wait
while 130K of postgresql.jar is downloading to a local machine to display a
few charts...

Is there any way I can use the driver without having it on the machine where
the applet is running?

> Applets are weird beasts - which is why I don't write them any more ;-)

So no JDBC-based connections could be provided on the Web or there is some
other methods I'm missing? I can do my charts with fetching all values using
and then pass it as parameters to an applet, but then it wouldn't be
JDBC-based soltion...

Thank you,

Igor

> Anyhow, you need to put the classpath in the <applet> tag. I'm not 100%
> certain, but it should go under the archive= parameter?
>
> Peter
>
> --
> Peter Mount
> Enterprise Support
> Maidstone Borough Council
> Any views stated are my own, and not those of Maidstone Borough Council.
>
> -----Original Message-----
> From: Twinsun [mailto:id212@cam.ac.uk]
> Sent: 15 July 1999 20:54
> To: pgsql-interfaces@postgreSQL.org
> Subject: [INTERFACES] JDBC driver question
>
> Hello,
>
> Sorry if this question has been covered before...
>
> I wrote an applet which connects to my db and displays some statistics.
> I've got it on my account on Linux (RedHat 5.2) box. I've set up
> classpath for the driver:
> =========================================
> PATH=/usr/local/pgsql/bin:$PATH:/usr/local/jdk1.2/bin
> MANPATH=$MANPATH:/usr/local/pgsql/man
> PGLIB=/usr/local/pgsql/lib
> PGDATA=/usr/local/pgsql/data
> CLASSPATH=/usr/local/pgsql/lib/postgresql.jar:.
>
> export PATH MANPATH PGLIB PGDATA CLASSPATH
> =========================================
>
> No errors when I compile my applet.
> When I connect to my pages on the Net from my local machine (under Win)
> it doesn't work...
> It throws: Can't find Database driver class .... postgresql.Driver
> exception.
> Interesting that if I have postgresql.jar in classpath on my local
> machine then the applet works just fine.
>
> Any ideas would be very much appreciated as this is a part of my project
> I have to finish by 31 July.
>
> You can see it for yourself on:
> http://simon.trinhall.cam.ac.uk/~id212/
>
> There is a form linked to a cgi scipt which basically just prints an
> html page with applet code in it with a query as a parameter to the
> applet.
>
> Thank you,
>
> Igor



Re: [INTERFACES] JDBC driver/applet question

От
Herouth Maoz
Дата:
At 15:07 +0300 on 16/07/1999, Twinsun wrote:


> Firstly, it works in Netscape but still doesn't in IE 4.x --  it downloads
> posgresql.jar on the local machine and then throws: "No siutable driver"
> exception(which differs from the exception which was thrown before).
>
> Secondly, it's a very inappropriate solution -- to force a user to wait
> while 130K of postgresql.jar is downloading to a local machine to display a
> few charts...
>
> Is there any way I can use the driver without having it on the machine where
> the applet is running?

Ahem... Repeat that question to yourself in a simplified fashion: "Can I
run a program on my computer without the code actually being on the
computer?".

Not really... Even if the code sits elsewhere, in order for the CPU to run
it it has to get the instructions somehow... That is, the download is quite
essential. At best, you could see which parts of the package are not used
by your particular applet, and remove these from the jar.

> > Applets are weird beasts - which is why I don't write them any more ;-)
>
> So no JDBC-based connections could be provided on the Web or there is some
> other methods I'm missing? I can do my charts with fetching all values using
> and then pass it as parameters to an applet, but then it wouldn't be
> JDBC-based soltion...

JDBC from an applet is a bad idea. It's possible under severe limitations
(you have to connect to the same host as where your applet is, you have to
pass the entire driver, you have to write it in such a way as to work in
all possible Browsers, and so on).

The reason you use an applet is probably for its drawing abilities. Using
JDBC just for the sake of JDBC "because it's cool" is not always indicated.
You can pass the data as parameters, or have them output from something on
the server side. We use, for charting, a set of applets called KavaChart.
  http://www.ve.com/kavachart/

These applets can get, as one of their parameters, a URL that supplies the
data to draw. This URL can be of a CGI or servlet that connects to the
database and returns the data. It's a much preferred way.

By the way, the KavaChart thing also exists in Servlet format. They create
their charts as GIFs and return the GIF image. This ensures that they can
be used in *any* browser, Java enabled or not. If you want to use JDBC,
servlets are the ideal place to do so.


Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma




Re[2]: [INTERFACES] JDBC driver/applet question

От
Piotr Stelmaszyk
Дата:
Monday, July 19, 1999, 1:09:28 PM, you wrote:

HM> Not really... Even if the code sits elsewhere, in order for the CPU to run
HM> it it has to get the instructions somehow... That is, the download is quite
HM> essential. At best, you could see which parts of the package are not used
HM> by your particular applet, and remove these from the jar.
What is the copyright status of postgresql.jar. Is it legal to modify
it? I'm participant of internet GIS project written in java using
postgres JDBC driver. It's three-tier application, so serwer
communicates with database using JDBC and applet communicates with
serwer via RMI. My problem is that applet uses geometric types from
driver and as for copyrights I had to include whole jar into applet
archive tag.

So my question is:
Can I remove unrequired files from postgresql.jar?
or
Can i copy required files (package postgresql.geometric.*) into my
igis.jar?

best regards
/piotr


/--------------------------------------------------------/
/- Piotr Stelmaszyk |- Student of Software Engineering --/
/------------------ | at Poznan University of Technology /
/----- mailto:kelman@fanthom.math.put.poznan.pl ---------/
/----- mailto:kelman@alpha.net.pl -----------------------/
/--------------------------------------------------------/