Sounds to me like the database field is a CHAR and not a VARCHAR. You must
pad your strings if the column data type is CHAR. Change your column
definition to VARCHAR in the database and your problems should disappear.
Grant
-----Original Message-----
From: John Larson [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 29, 1999 2:35 PM
To: [EMAIL PROTECTED]
Subject: JDBC/Servlet PreparedStatement and setString Question
Hi,
I have a problem where Oracle does not find a string that is set using
setString in a servlet. I am using the thin driver for Oracle 8.
This code returns "not found" from Oracle when the query is executed:
pstmt.setString(1,"key");
However, this statement correctly returns the result set:
pstmt.setString(1,"key "); //assumes that the field is 8 characters
Has anyone encountered this? Did you "fix" it? Do I really need to pad
my strings to their full length?
I read in a JDBC book that setString sets the parameter to a JDBC
VARCHAR or LONGVARCHAR. Is this what is causing the problem with
Oracle?
The first code worked fine during testing with MS Access
Thanks,
John
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html