Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

SQL Insert Statement Data Type Mismatch Error

843838Jul 30 2006 — edited Jul 30 2006
I am doing a very simple web application that has a Microsoft Access database as the data source. I have been able to sucessfully create update and query statements using parameters but am having issues with an insert statement. I am using JSTL 1.1.2

The following code creates the data type mismatch error.
<sql:update 
	sql="insert into tblTtoF(TFToolID,TFFeatID) values(?,?)">
        <sql:param value='$(ID}'/>
	<sql:param value='${feature}'/>
        </sql:update>
The table has NUMBER as the data type for both of these fields and the variables I am feeding into it are both numbers. If I hard code the first number into the sql statement then it works. I have tried swapping the variables around and as long as the first one is hard coded the parameter for the second one works no matter which is first or second.

However I can get the following code to work, which of course leaves me vulnerable to sql injection attacks which is not really a good thing.
<sql:update>
	insert into tblTtoF(TFToolID,TFFeatID) values('<c:out value="${ID}"/>','<c:out value="${feature}"/>')
        </sql:update>
So I am just looking for any suggestions as to why my first piece of code doesn't work seeing as it is the simplest of SQL statements and the most standard syntax.

Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 27 2006
Added on Jul 30 2006
6 comments
1,275 views