Skip site navigation (1) Skip section navigation (2)

JDBC 3 version 8.0 Error from cast conversion

From: GyLes <gihemail-postgresql(at)yahoo(dot)fr>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: JDBC 3 version 8.0 Error from cast conversion
Date: 2005-09-27 08:19:47
Message-ID: 20050927081948.63579.qmail@web25804.mail.ukl.yahoo.com (view raw or flat)
Thread:
Lists: pgsql-jdbc
Hi All,

i'm using postgresql version 8.0 and 8.1 beta1 server.
I developp a little web applicaton in JSTL 1.1, JDK
1.5, tomcat 5.5.9.

Here's the HTML form to input some data :

<!-- Fichier de saisie des paramètres-->
<%@ taglib prefix="c"
uri="http://java.sun.com/jsp/jstl/core" %>
<html>
    <head>
    <title>Simple Example</title>
    </head>
    <body>
    <%@ include file='header.jsp' %>
    <c:set var="ess" value="test"/>
    <c:out value="${ess}"/>

    <form name="test" action="record.jsp"
method="get">
        code: <input type="text" name="code"/>
        text: <input type="text" name="text"/>
        <input type="submit" name="ok"/>
    </form>
    </body>
</html> 

and the jsp page to record data :
<%@ taglib prefix="c"
uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="sql"
uri="http://java.sun.com/jsp/jstl/sql" %>
<%@ taglib prefix="fmt"
uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
    <head>
    <title>Simple Example</title>
    </head>
    <body>
        <fmt:parseNumber var="ncode"
value="${param.code}"/>
        <sql:setDataSource
              driver="org.postgresql.Driver"
              url="jdbc:postgresql://127.0.0.1/gihe"
              user="gihe"
              password="*******"
              var="dataSource" />
        <sql:transaction dataSource="${dataSource}">
            <sql:update>
                INSERT INTO ESS.TEST (ID,NOM) VALUES
(?,?)
                <sql:param value="${ncode*1})"/>
                <sql:param value="${param.text}"/>
            </sql:update>
        </sql:transaction>       
    </body>
</html> 

With JDBC 3 driver version 8.0 or 8.1, i obtain an
error message from Tomcat :

javax.servlet.ServletException:
javax.servlet.jsp.JspException:
                INSERT INTO ESS.TEST (ID,NOM) VALUES
(?,?)
               
               
            : ERROR: column "id" is of type bigint but
expression is of type character varying 


==> If i use JDBC 3 driver version 7.3, no problem
with postgresql version 8.0 or 8.1 beta 1 !

Any help will be welcome.

Thanks in advance.

GyLes




	

	
		
___________________________________________________________________________ 
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger 
Téléchargez cette version sur http://fr.messenger.yahoo.com

pgsql-jdbc by date

Next:From: Dave CramerDate: 2005-09-27 13:48:49
Subject: Re: Exception storing ipaddress with JBoss after upgrade to 8.0-312.jdbc3
Previous:From: Joost KraaijeveldDate: 2005-09-27 07:06:35
Subject: Exception storing ipaddress with JBoss after upgrade to8.0-312.jdbc3

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group