Обсуждение: Prblm: Using PostgreSQL JDBC driver from Windows.

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

Prblm: Using PostgreSQL JDBC driver from Windows.

От
"Ola Theander"
Дата:
Dear subscribers.

I've recently tried to use the PostgreSQL JDBC driver from a Windows
workstation, connecting over the network to a PostgreSQL db running on
Linux, and there seems to be a minor problem, see the attached Java
stack trace.

The Windows computer runs a development environment with Sun's Forte for
Java 4 CE and is used to develop JSP/servlet solutions. The db server is
running PostgreSQL 7.2.1. on a SuSE Linux 8.0. My guess is that it might
have something to do with threads since the code crashes if it's in a
servlet processed by Tomcat 4.x. If I move the same code to a Java
application, i.e. an ordinary main class, the same code works.

My next step is to check whether the same problem occurs with one of our
development computers running Linux, i.e. to find out if it's a Windows
problem or not.

The computers are using JDK 1.4.0.

Any help on this matter would be greatly appreciated.

Kind regards, Ola Theander

Вложения

Re: Prblm: Using PostgreSQL JDBC driver from Windows.

От
Dave Cramer
Дата:
Ola,

likely a permissions problem, does the windows box have permissions to
open a connection to the db? check pg_hba.conf on the server box to make
sure.

Also to make things simpler why don't you write a 5 line program to
connect and run it from the command line, then all of the exception will
be shown.

Dave
On Thu, 2002-07-18 at 11:48, Ola Theander wrote:
> Dear subscribers.
>
> I've recently tried to use the PostgreSQL JDBC driver from a Windows
> workstation, connecting over the network to a PostgreSQL db running on
> Linux, and there seems to be a minor problem, see the attached Java
> stack trace.
>
> The Windows computer runs a development environment with Sun's Forte for
> Java 4 CE and is used to develop JSP/servlet solutions. The db server is
> running PostgreSQL 7.2.1. on a SuSE Linux 8.0. My guess is that it might
> have something to do with threads since the code crashes if it's in a
> servlet processed by Tomcat 4.x. If I move the same code to a Java
> application, i.e. an ordinary main class, the same code works.
>
> My next step is to check whether the same problem occurs with one of our
> development computers running Linux, i.e. to find out if it's a Windows
> problem or not.
>
> The computers are using JDK 1.4.0.
>
> Any help on this matter would be greatly appreciated.
>
> Kind regards, Ola Theander
> ----
>

> "Something unusual has occured to cause the driver to fail. Please report this exception: Exception:
java.lang.NullPointerException
> Stack Trace:
> java.lang.NullPointerException
>     at org.postgresql.Connection.openConnection(Connection.java:155)
>     at org.postgresql.Driver.connect(Driver.java:149)
>     at java.sql.DriverManager.getConnection(DriverManager.java:512)
>     at java.sql.DriverManager.getConnection(DriverManager.java:171)
>     at add.processRequest(add.java:51)
>     at add.doPost(add.java:98)
>     at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
>     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
>     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
>     at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:223)
>     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
>     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
>     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
>     at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
>     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
>     at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
>     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:201)
>     at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
>     at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
>     at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
>     at org.netbeans.modules.web.monitor.catalina.MonitorValve.invoke(MonitorValve.java:142)
>     at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
>     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
>     at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
>     at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2344)
>     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
>     at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
>     at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
>     at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
>     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
>     at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
>     at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462)
>     at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
>     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
>     at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
>     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:163)
>     at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
>     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
>     at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
>     at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1011)
>     at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1106)
>     at java.lang.Thread.run(Thread.java:536)
> End of Stack Trace
> "
> ----
>

>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org




Re: Prblm: Using PostgreSQL JDBC driver from Windows.

От
tony
Дата:
On Thu, 2002-07-18 at 17:48, Ola Theander wrote:

> The Windows computer runs a development environment with Sun's Forte for
> Java 4 CE and is used to develop JSP/servlet solutions. The db server is
> running PostgreSQL 7.2.1. on a SuSE Linux 8.0. My guess is that it might
> have something to do with threads since the code crashes if it's in a
> servlet processed by Tomcat 4.x. If I move the same code to a Java
> application, i.e. an ordinary main class, the same code works.

What machine is Tomcat running on? The JDBC driver needs to be in
Tomcats path /common/lib

Cheers

Tony Grant

--
RedHat Linux on Sony Vaio C1XD/S
http://www.animaproductions.com/linux2.html
Macromedia UltraDev with PostgreSQL
http://www.animaproductions.com/ultra.html


Re: Prblm: Using PostgreSQL JDBC driver from Windows.

От
"Ola Theander"
Дата:
Hi Tony.

Thanks for your answer. The jar-file is properly located I think. The
code Class.forName("org.postgresql.Driver") is the line above the
connection call and this line wouldn't work if the jar isn't found,
right?

Kind regards, Ola

> -----Original Message-----
> From: tony [mailto:tony@animaproductions.com]
> Sent: den 18 juli 2002 18:00
> To: Ola Theander
> Cc: pgsql-jdbc@postgresql.org
> Subject: Re: [JDBC] Prblm: Using PostgreSQL JDBC driver from Windows.
>
>
> On Thu, 2002-07-18 at 17:48, Ola Theander wrote:
>
> > The Windows computer runs a development environment with
> Sun's Forte
> > for Java 4 CE and is used to develop JSP/servlet solutions. The db
> > server is running PostgreSQL 7.2.1. on a SuSE Linux 8.0. My
> guess is
> > that it might have something to do with threads since the
> code crashes
> > if it's in a servlet processed by Tomcat 4.x. If I move the
> same code
> > to a Java application, i.e. an ordinary main class, the same code
> > works.
>
> What machine is Tomcat running on? The JDBC driver needs to
> be in Tomcats path /common/lib
>
> Cheers
>
> Tony Grant
>
> --
> RedHat Linux on Sony Vaio C1XD/S
> http://www.animaproductions.com/linux2.html
> Macromedia
> UltraDev with PostgreSQL http://www.animaproductions.com/ultra.html
>
>


Re: Prblm: Using PostgreSQL JDBC driver from Windows.

От
"Ola Theander"
Дата:
Hi Dave.

Thanks for your answer. Actually I've created a 5 line program but the
strange thing is that when I run that it works as expected. Since that's
the case it rules out the permission problem too.

Kind regards, Ola

> Ola,
>
> likely a permissions problem, does the windows box have
> permissions to open a connection to the db? check pg_hba.conf
> on the server box to make sure.
>
> Also to make things simpler why don't you write a 5 line
> program to connect and run it from the command line, then all
> of the exception will be shown.
>
> Dave


Re: Prblm: Using PostgreSQL JDBC driver from Windows.

От
tony
Дата:
On Thu, 2002-07-18 at 18:13, Ola Theander wrote:

> Thanks for your answer. The jar-file is properly located I think. The
> code Class.forName("org.postgresql.Driver") is the line above the
> connection call and this line wouldn't work if the jar isn't found,
> right?

It is kind of messy if you are using the application server within
Forte. I haven't had much luck with that. So I run the application
server on the db machine (in development environment). Tomcat seems to
have less problems talking to the database that way.

Connecting from Forte to Postgresql has always worked well for me. If
you can list the database tables in Forte then you have a Tomcat
problem.

Cheers

Tony

--
RedHat Linux on Sony Vaio C1XD/S
http://www.animaproductions.com/linux2.html
Macromedia UltraDev with PostgreSQL
http://www.animaproductions.com/ultra.html


Re: Prblm: Using PostgreSQL JDBC driver from Windows.

От
"Ola Theander"
Дата:
Hi again.

Yes, it's probably a Tomcat problem since I can connect to PostgreSQL
from inside the Forte ide and a simple 5-line application also works,
but inside Forte's built in Tomcat it fails.

/ola

> -----Original Message-----
> From: tony [mailto:tony@animaproductions.com]
> Sent: den 18 juli 2002 18:18
> To: Ola Theander
> Cc: pgsql-jdbc@postgresql.org
> Subject: RE: [JDBC] Prblm: Using PostgreSQL JDBC driver from Windows.
>
>
> On Thu, 2002-07-18 at 18:13, Ola Theander wrote:
>
> > Thanks for your answer. The jar-file is properly located I
> think. The
> > code Class.forName("org.postgresql.Driver") is the line above the
> > connection call and this line wouldn't work if the jar isn't found,
> > right?
>
> It is kind of messy if you are using the application server
> within Forte. I haven't had much luck with that. So I run the
> application server on the db machine (in development
> environment). Tomcat seems to have less problems talking to
> the database that way.
>
> Connecting from Forte to Postgresql has always worked well
> for me. If you can list the database tables in Forte then you
> have a Tomcat problem.
>
> Cheers
>
> Tony
>
> --
> RedHat Linux on Sony Vaio C1XD/S
> http://www.animaproductions.com/linux2.html
> Macromedia
> UltraDev with PostgreSQL http://www.animaproductions.com/ultra.html
>
>