Re: NullPointer exception in ResultSet.getString()

From: Aaron Mulder <ammulder(at)alumni(dot)princeton(dot)edu>
To: PostgreSQL JDBC <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: NullPointer exception in ResultSet.getString()
Date: 2002-10-13 04:13:56
Message-ID: Pine.LNX.4.44.0210130011490.5142-100000@www.princetongames.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

You appear to be using an older version of the driver. If you get
the development version from jdbc.postgresql.org, do you have the same
problem?

Aaron

On Sun, 13 Oct 2002, gaganis wrote:
> Hello
>
> I am a new user of postrgresql and am accessing it through java(jsp).
>
> Trying to get a string from a result set I get a really weird
> NullPointer exception from the method
> org.postgresql.jdbc2.ResultSet.getString inside the jdbc driver.
>
> I am using postgresql 7.2.1 on linux 2.4.18
> allong with tomcat 4.0.4
> and sun's j2sdk1.4.0
> the driver is jdbc2
>
>
> here is my code that produces the prob
>
> String dsn =
> "jdbc:postgresql://localhost:5432/illigos?user=illigos&password=qwerty";
> Connection conn = DriverManager.getConnection(dsn);
> .
> .
> .
> Statement st = conn.createStatement();
>
> ResultSet rs = st.executeQuery("select * from FOITITIS where
> account='"+account+"';");
> .
> .
> .
> out.println("<tr><td><i>Onoma:</i></td><td>"+rs.getString("onoma")+"</td></tr>");
>
> this is my table description:
>
> illigos=> \d foititis
> Table "foititis"
> Column | Type | Modifiers
> ------------+-----------------------+-----------
> account | character varying(20) | not null
> onoma | character varying(40) |
> epitheto | character varying(40) |
> ar_mitroou | character varying(10) |
> examino | character varying(20) |
> Primary key: foititis_pkey
> Triggers: RI_ConstraintTrigger_16590,
> RI_ConstraintTrigger_16592
>
> follows the exception report:
>
> java.lang.NullPointerException
> at org.postgresql.jdbc2.ResultSet.getString(ResultSet.java:168)
> at org.postgresql.jdbc2.ResultSet.getString(ResultSet.java:553)
> at org.apache.jsp.use$jsp._jspService(use$jsp.java:116)
> at
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
> org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:201)
> at
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
> at
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
> 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.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:190)
> 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.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:2347)
> at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
> 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:468)
> 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:174)
> 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:1027)
> at
> org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
> at java.lang.Thread.run(Thread.java:536)
>
>
>
>
> Thanks in advance
> Gaganis Giorgos
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
>

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Barry Lind 2002-10-13 04:19:52 Difference between 7.2 and 7.3, possible bug?
Previous Message gaganis 2002-10-13 03:59:56 NullPointer exception in ResultSet.getString()