To simple following table.
create table test (member_id int, member_name text);

 In JSP, I accessed as following.
<sql:update var="stmt" dataSource="${kome}">
 insert into test values(?,?)
 <sql:param value="1"/>
 <sql:param value="Miyauchi"/>
</sql:update>

 I've gotten following error.(using Tomcat-9.0.22 and Postgres-11.5)
javax.servlet.jsp.JspException: insert into test values(?,?) : ERROR:
column "member_id" is of type integer but expression is of type
character varying Hint: You will need to rewrite or cast the
expression. Position: 27

 This JSP works under Tomcat-5.5.3 and Postgres-9.0.8.

And, I've gotten the same result using following JSP.

<sql:update var="stmt" dataSource="${kome}">
 insert into test values(?,?)
 <sql:param>1</sql:param>
 <sql:param value="Miyauchi"/>
</sql:update>

 How to cast String to int?

Of course, following JSP works correctly.

<sql:update var="stmt" dataSource="${kome}">
 insert into test values(1,?)
 <sql:param value="Miyauchi"/>
</sql:update>

Regards,                       Kazuaki Miyauchi, Japan

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscr...@tomcat.apache.org
For additional commands, e-mail: taglibs-user-h...@tomcat.apache.org

Reply via email to