pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nick Fankhauser <nickf@ontko.com>
To: Guido <lampo.14@iol.it>
To: pgsql-jdbc@postgresql.org
Subject: Re: JDBC Connection
Date: Sat, 10 Nov 2001 07:48:55 -0500
Message-ID: <NEBBLAAHGLEEPCGOBHDGOEHNDOAA.nickf@ontko.com> (raw)
In-Reply-To: <20011109174159.A1159@localhost>

Guido-

I probably didn't say this clearly enough, or perhaps "environment" is the
wrong word, so I'll try to explain what I meant with an example:

In the project I'm working on, we're using Tomcat, so I develop using my
user account, but run as Tomcat's user.

When I'm actually writing & compiling the code, I'm working from my own user
account (nickf), so in the .profile for nickf I add the path to the jdbc jar
like so: "export CLASSPATH=$CLASSPATH:/usr/share/java/jdbc7.1-1.2.jar". This
works great for compiling and running any "main" test classes at the command
line, but my purpose is to produce code that Tomcat will run, and therein
lies the twist...

The Tomcat processes are started as detached processes by the "www-data"
user account on our system, so the change that I made to the CLASSPATH
environment variable for "nickf" doesn't help. In order to make the classes
work under this user, I have to do one of three things:

1)Add the classpath line that I used for "nickf" to the .profile for
"www-data"

2)Add the jar file to the classpath in the shell script that starts up
Tomcat

3)As Dave suggested, put it in the standard java extensions directory for
the system, so it is available to any user account by default.

I may be totally off base here, but it sounds very much like this is the
problem that is plaguing you with Forte- If a different user account is
running the code after you get it out of Forte, then you may lose the
CLASSPATH that you set.

The other thing that may be happening is that the CLASSPATH variable may not
be used by your JRE. It might help to look under the hood at the shell
script that invokes the JRE to see what is happening- the command to invoke
the JRE has a switch to set the classpath on it, and by convention, most
systems just equate this to CLASSPATH, but they don't have to. See if you
can locate the shell file (or .bat file) that invokes your JRE- it should
have a line that looks something like this:

java -cp $CLASSPATH <class file>

The problem of course, would be if the "CLASSPATH" variable either isn't
being used, or is being changed before this line is run. The only way I can
thin of to check this would be to find the shell script in question. Maybe
if you tell us what platform you're running on, someone who is familiar with
it can help.

Sorry- this response got rather long-winded- Hope it helps.

-Nick



> -----Original Message-----
> From: pgsql-jdbc-owner@postgresql.org
> [mailto:pgsql-jdbc-owner@postgresql.org]On Behalf Of Guido
> Sent: Friday, November 09, 2001 11:42 AM
> To: pgsql-jdbc@postgresql.org
> Subject: Re: [JDBC] JDBC Connection
>
>
> First of all I'd like to thank everybody for the "pronto" help.
> But the problem is that
> 1. My shell doesn't have an enviroment variable called CLASSPATH;
> 2. I, then, tried to edit my .profile file, by adding the variable to it,
> i.e.
> 	CLASSPATH=/usr/java/jdk1.3.1_01/lib/jdbc7.1-1.2.jar
> 	export PATH CLASSPATH
>    but, still doesn't work.
> 3. When I run the application in the Forte 3 enviroment, it works
> perfectly, but that becuase the IDE requires to copy the driver to the
> IDE's directory.
> 4. I use the same enviroment for developing and running the application.
> Thanks again.
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>




view thread (19+ messages)  latest in thread

Message-ID: <NEBBLAAHGLEEPCGOBHDGOEHNDOAA.nickf@ontko.com>
Permalink:  ../NEBBLAAHGLEEPCGOBHDGOEHNDOAA.nickf@ontko.com/
Also on:    postgresql.org/message-id/NEBBLAAHGLEEPCGOBHDGOEHNDOAA.nickf@ontko.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: nickf@ontko.com, lampo.14@iol.it
  Subject: Re: JDBC Connection
  In-Reply-To: <NEBBLAAHGLEEPCGOBHDGOEHNDOAA.nickf@ontko.com>
  References: <20011109174159.A1159@localhost> <NEBBLAAHGLEEPCGOBHDGOEHNDOAA.nickf@ontko.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox