tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Warner Onstine" <war...@warneronstine.com>
Subject Re: jdbc taglib problem
Date Wed, 04 Apr 2001 01:33:49 GMT
To clarify it appears to be dying at this line:

try {
      Connection conn = (Connection)pageContext.getAttribute(_connId);
      _statement = conn.createStatement();
      pageContext.setAttribute(getId(), _statement);
    } catch (SQLException e) {
      throw new JspTagException(e.toString());
    }
 where _statement = conn.createStatement() is called.

-warner

----- Original Message -----
From: "Warner Onstine" <warner@warneronstine.com>
To: "taglibs-user" <taglibs-user@jakarta.apache.org>
Sent: Tuesday, April 03, 2001 5:07 PM
Subject: jdbc taglib problem


> Hi all,
> I am having a problem using the jdbc taglib. After following the
> docuemntation I am still receiving this error:
>
> --------------------------------------------------
> Root Cause:
> java.lang.NullPointerException
>  at
>
org.apache.taglibs.jdbc.statement.StatementImplTag.doStartTag(StatementImplT
> ag.java:137)
>  at org.apache.jsp.genre_jsp._jspService(genre_jsp.java:70)
>  at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
>
> -------------------------------------------------
> When trying to connect with my database using this .jsp
>
> <%-- open a database query -->
> <sql:connection id="conn1">
>     <sql:url>jdbc:mysql://64.165.39.221/reviews</sql:url>
>     <sql:driver>org.gjt.mm.mysql.Driver</sql:driver>
>     <sql:userId>******</sql:userId> (note not actually stars!)
>     <sql:password>******</sql:password> (note not actually stars!)
> </sql:connection>
>
> <%-- open a database query --%>
> <table>
> <sql:statement id="stmt1" conn="conn1">
>     <sql:query>
>     select * from tbl_moviegenre
>     </sql:query>
>     <%-- loop through the rows of the query
>     <sql:resultSet id="rset">
>         <tr>
>             <td>Primary key :: <sql:getColumn position="1"/></td>
>             <td>Genre :: <sql:getColumn position="2"/></td>
>         </tr>
>     </sql:resultSet> --%>
>     <sql:execute ignoreErrors="true"/>
> </sql:statement>
> </table>
>
> <sql:closeConnection conn="conn1"/>
> --------------------------------------
>
> Now this works fine in a servlet with the same url, user, password.  So I
> know it isn't my setup. Any ideas? This has been driving me nuts for the
> past 2 hours.
>
> Thanks in advance!
>
> -warner
>
>


Mime
View raw message