pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
JDBC issue
9+ messages / 5 participants
[nested] [flat]

* JDBC issue
@ 2006-05-23 20:31  Joel Alejandro Espinosa Carra <joel.espinosa@cts-design.com>
  0 siblings, 1 reply; 9+ messages in thread

From: Joel Alejandro Espinosa Carra @ 2006-05-23 20:31 UTC (permalink / raw)
  To: pgsql-general

Hi all.

I searched at google and did not find any answer. I have an older JDCB 
driver in my java web application, if I update the driver to the 7.4 
build 216 version some of the querys like the next show no results in 
the ResultSet object:

SELECT a.reg_users_id_user AS id, a.first_name AS fn, a.last_name AS ln, 
a.sur_name AS sn, ar.name AS area, u.email AS email FROM reg_aspirants a 
INNER JOIN areas ar ON a.areas_id_area1 = ar.id_area INNER JOIN 
reg_schools s ON a.reg_schools_id_school = s.id_school INNER JOIN 
reg_users u ON a.reg_users_id_user = u.id_user INNER JOIN 
reg_tests_aspirants ta ON a.reg_users_id_user = ta.reg_id_aspirant INNER 
JOIN reg_tests t ON ta.reg_id_test = t.id_test INNER JOIN reg_calendars 
c ON t.reg_calendars_id_calendar = c.id_calendar AND c.is_active AND 
t.test_type = 'p' AND a.status = 'ap' GROUP BY a.reg_users_id_user, 
a.first_name, a.last_name, a.sur_name, ar.name, s.name, u.email ORDER BY 
a.last_name, a.sur_name, a.first_name ASC

but the same querys are working well if they are runned at pgsql, is 
there something to I must to know in the newer version's API?.
I need to update the driver in order to use iBATIS because the older one 
throw an exception: "java.sql.SQLException: ERROR:  SET AUTOCOMMIT TO 
OFF is no longer supported.".

Thanks in advance.
Best regards.

ps. please tell me if it is the wrong mailing list for this issue.

-- 
Ing. Joel Alejandro Espinosa Carra
CINVESTAV CTS - Centro de Tecnología de Semiconductores
Tel. +52 (33) 3770-3700 ext. 1049
http://www.cts-design.com 


-- 
Este mensaje ha sido analizado por MailScanner
en busca de virus y otros contenidos peligrosos,
y se considera que está limpio.
MailScanner agradece a transtec Computers por su apoyo.




^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: JDBC issue
@ 2006-05-24 06:54  Kris Jurka <books@ejurka.com>
  parent: Joel Alejandro Espinosa Carra <joel.espinosa@cts-design.com>
  0 siblings, 1 reply; 9+ messages in thread

From: Kris Jurka @ 2006-05-24 06:54 UTC (permalink / raw)
  To: Joel Alejandro Espinosa Carra <joel.espinosa@cts-design.com>; +Cc: pgsql-general



On Tue, 23 May 2006, Joel Alejandro Espinosa Carra wrote:

> I searched at google and did not find any answer. I have an older JDCB driver 
> in my java web application, if I update the driver to the 7.4 build 216 
> version some of the querys like the next show no results in the ResultSet 
> object:

I have no idea why the JDBC driver would cause any sort of difference in 
the results of a query.  Are you sure you're connecting to the same server 
and running the exact same query when you get results in psql?

If you can send a self contained reproducible example I'll take a look at 
it, but I've got to guess it's something wrong with your code or your 
connection.  You could also try updating to a newer JDBC driver, the 7.4 
series is not maintained any longer.

> ps. please tell me if it is the wrong mailing list for this issue.
>

You should ask JDBC questions on the pgsql-jdbc list.

Kris Jurka



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: JDBC issue
@ 2006-05-24 21:01  Joel Alejandro Espinosa Carra <joel.espinosa@cts-design.com>
  parent: Kris Jurka <books@ejurka.com>
  0 siblings, 0 replies; 9+ messages in thread

From: Joel Alejandro Espinosa Carra @ 2006-05-24 21:01 UTC (permalink / raw)
  To: Kris Jurka <books@ejurka.com>; +Cc: pgsql-general

Kris Jurka wrote:

>
>
> On Tue, 23 May 2006, Joel Alejandro Espinosa Carra wrote:
>
>> I searched at google and did not find any answer. I have an older 
>> JDCB driver in my java web application, if I update the driver to the 
>> 7.4 build 216 version some of the querys like the next show no 
>> results in the ResultSet object:
>
>
> I have no idea why the JDBC driver would cause any sort of difference 
> in the results of a query.  Are you sure you're connecting to the same 
> server and running the exact same query when you get results in psql?

Yes I'm pretty sure, the same server, the same code, the same version of 
postgres server (7.4), the only thing i did was replacing the jdbc jar 
in the /common/lib/ tomcat directory.

>
> If you can send a self contained reproducible example I'll take a look 
> at it, but I've got to guess it's something wrong with your code or 
> your connection.  You could also try updating to a newer JDBC driver, 
> the 7.4 series is not maintained any longer.
>
The java code is pretty ugly, (i did not wrote it, BTW), in order to 
reproduce the error I had had send you the entire web application :-(

>> ps. please tell me if it is the wrong mailing list for this issue.
>>
>
> You should ask JDBC questions on the pgsql-jdbc list.

I will try it.

>
> Kris Jurka
>
Thank you very much.
Best regards.

-- 
Ing. Joel Alejandro Espinosa Carra
CINVESTAV CTS - Centro de Tecnología de Semiconductores
Tel. +52 (33) 3770-3700 ext. 1049
http://www.cts-design.com 


-- 
Este mensaje ha sido analizado por MailScanner
en busca de virus y otros contenidos peligrosos,
y se considera que está limpio.
MailScanner agradece a transtec Computers por su apoyo.




^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* JDBC issue
@ 2026-07-12 07:01  Stephen Davies <sdavies@sdc.com.au>
  0 siblings, 1 reply; 9+ messages in thread

From: Stephen Davies @ 2026-07-12 07:01 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

I have several JDBC-based programs on my Rocky Linux 9.8 box.
Postgresql 17.10 and JDBC 42.7.2.
As of today, these programs all fail because the JDBC connections do not 
work and the following code example produces no output except:

"org.apache.jasper.JasperException: An exception occurred processing 
[/jsp/browsewineries.jsp] at line [48] st1 is null".

There have been several system updates recently but not Postgresql so I 
have no idea what might have changed to cause these errors.

<%@ page
import="java.sql.*,
jakarta.servlet.http.HttpServlet,
jakarta.servlet.http.HttpServletResponse"
%>
<% int res = 0;
    String url = "jdbc:postgresql:cellar";
    String s2="select id,name from winery order by name";
    Connection conn1 = null;
    Statement st1 = null;

    try {
           Class.forName("org.postgresql.Driver");
           conn1 = DriverManager.getConnection(url, "scldad", "");
	  if (conn1 == null)
             System.out.println("Conn1 Failed!");
    } catch(Exception e) {
           System.out.println("Conn Failed!");
             e.printStackTrace();
    }
    try {
           st1 = conn1.createStatement();
	  if (st1 == null)
             System.out.println("State1 Failed!");
    } catch(Exception e) {
	  System.out.println("State Failed!");
             e.printStackTrace();
    }
    ResultSet rs = st1.executeQuery(s2);





^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: JDBC issue
@ 2026-07-12 07:13  Christophe Pettus <xof@thebuild.com>
  parent: Stephen Davies <sdavies@sdc.com.au>
  0 siblings, 1 reply; 9+ messages in thread

From: Christophe Pettus @ 2026-07-12 07:13 UTC (permalink / raw)
  To: Stephen Davies <sdavies@sdc.com.au>; +Cc: pgsql-general@lists.postgresql.org



> On Jul 12, 2026, at 00:01, Stephen Davies <sdavies@sdc.com.au> wrote:
> 
> I have several JDBC-based programs on my Rocky Linux 9.8 box.
> Postgresql 17.10 and JDBC 42.7.2.
> As of today, these programs all fail because the JDBC connections do not work and the following code example produces no output except:
> 
> "org.apache.jasper.JasperException: An exception occurred processing [/jsp/browsewineries.jsp] at line [48] st1 is null".


Look at catalina.out (or journalctl -u tomcat) for the e.printStackTrace() output; that should get you the real exception.  You can also check the PostgreSQL logs to see if it even made it to opening the connection.




^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: JDBC issue
@ 2026-07-12 07:40  Stephen Davies <sdavies@sdc.com.au>
  parent: Christophe Pettus <xof@thebuild.com>
  0 siblings, 2 replies; 9+ messages in thread

From: Stephen Davies @ 2026-07-12 07:40 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

On 12/7/26 16:43, Christophe Pettus wrote:
> 
> 
>> On Jul 12, 2026, at 00:01, Stephen Davies <sdavies@sdc.com.au> wrote:
>>
>> I have several JDBC-based programs on my Rocky Linux 9.8 box.
>> Postgresql 17.10 and JDBC 42.7.2.
>> As of today, these programs all fail because the JDBC connections do not work and the following code example produces no output except:
>>
>> "org.apache.jasper.JasperException: An exception occurred processing [/jsp/browsewineries.jsp] at line [48] st1 is null".
> 
> 
> Look at catalina.out (or journalctl -u tomcat) for the e.printStackTrace() output; that should get you the real exception.  You can also check the PostgreSQL logs to see if it even made it to opening the connection.
> 
> 
Stacktrace:
	org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:570)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:456)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:350)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:301)
	jakarta.servlet.http.HttpServlet.service(HttpServlet.java:658)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)

Root Cause

java.lang.NullPointerException: Cannot invoke 
"java.sql.Statement.executeQuery(String)" because "st1" is null
	org.apache.jsp.jsp.browsewineries_jsp._jspService(browsewineries_jsp.java:171)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:62)
	jakarta.servlet.http.HttpServlet.service(HttpServlet.java:658)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:428)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:350)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:301)
	jakarta.servlet.http.HttpServlet.service(HttpServlet.java:658)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)

Tells me nothing more.
The code has to go past the connection and statement lines to get to the 
query line.
This code has been working for several years before today.
psql access to the same databases still works.





^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: JDBC issue
@ 2026-07-12 07:48  Stephen Davies <sdavies@sdc.com.au>
  parent: Stephen Davies <sdavies@sdc.com.au>
  1 sibling, 1 reply; 9+ messages in thread

From: Stephen Davies @ 2026-07-12 07:48 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

I restarted postgresql with logging and now get:

Connection failed.
Caused by: java.net.SocketTimeoutException: Connect timed out

This explains the long delay between hitting Search and seeing the error 
screen but does not explain why the connection is timing out.







^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: JDBC issue
@ 2026-07-12 08:02  Stephen Davies <sdavies@sdc.com.au>
  parent: Stephen Davies <sdavies@sdc.com.au>
  0 siblings, 0 replies; 9+ messages in thread

From: Stephen Davies @ 2026-07-12 08:02 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

Sorry. Problem solved.
It was the firewall on the postgresql server box.
It gets updated daily and must somehow have led to this issue.

Apologies again for wasting space.





^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: JDBC issue
@ 2026-07-12 08:02  shammat@gmx.net
  parent: Stephen Davies <sdavies@sdc.com.au>
  1 sibling, 0 replies; 9+ messages in thread

From: shammat@gmx.net @ 2026-07-12 08:02 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

Am 12.07.26 um 09:40 schrieb Stephen Davies:
> Root Cause
> 
> java.lang.NullPointerException: Cannot invoke "java.sql.Statement.executeQuery(String)" because "st1" is null
>      org.apache.jsp.jsp.browsewineries_jsp._jspService(browsewineries_jsp.java:171)
>      org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:62)
> 
> Tells me nothing more.
> The code has to go past the connection and statement lines to get to the query line.
> This code has been working for several years before today.
There is a variable named "st1" in the servlet code which is NULL.

This is not a Postgres error, but an error in your code.

You need to check how st1 is populated in the Java code.

If I had to guess: the code retrieves data from the database and receives a NULL
value that it does not expect and thus not check.








^ permalink  raw  reply  [nested|flat] 9+ messages in thread


end of thread, other threads:[~2026-07-12 08:02 UTC | newest]

Thread overview: 9+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-05-23 20:31 JDBC issue Joel Alejandro Espinosa Carra <joel.espinosa@cts-design.com>
2006-05-24 06:54 ` Kris Jurka <books@ejurka.com>
2006-05-24 21:01   ` Joel Alejandro Espinosa Carra <joel.espinosa@cts-design.com>
2026-07-12 07:01 JDBC issue Stephen Davies <sdavies@sdc.com.au>
2026-07-12 07:13 ` Christophe Pettus <xof@thebuild.com>
2026-07-12 07:40   ` Stephen Davies <sdavies@sdc.com.au>
2026-07-12 07:48     ` Stephen Davies <sdavies@sdc.com.au>
2026-07-12 08:02       ` Stephen Davies <sdavies@sdc.com.au>
2026-07-12 08:02     ` shammat@gmx.net

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