Correlation does not prove causality.
Martin Vajsar wrote:My guess is that the string is being inadvertently converted to a number either on the way into the database, or possibly even on the way from the database.
You need to inspect every step on these paths. If you want some help, you'll need to TellTheDetails - show all relevant parts of your code.
Correlation does not prove causality.
Correlation does not prove causality.
Correlation does not prove causality.
Martin Vajsar wrote:Here is the culprit:
The phone is a String, but you haven't enclosed it in the quotes. It is therefore converted to number for execution of the statement, and then to VARCHAR for storage. This is why you should avoid implicit conversions. Using PreparedStatement would help you to pass the parameters to the database using the desired type (because you need to use proper setXxx method, in this case setString instead of setInt).
Also, it is a good practice to name the columns you're inserting into.
Edit: if the phone number contained non-numeric characters, you'd get an error while executing the statement. That would make the problem obvious, of course.
Correlation does not prove causality.
Correlation does not prove causality.
Warning! Way too comfortable! Do not sit! Try reading this tiny ad instead:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|