File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Problem in getting correct data Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Problem in getting correct data" Watch "Problem in getting correct data" New topic
Author

Problem in getting correct data

duhit Choudhary
Ranch Hand

Joined: Apr 01, 2012
Posts: 64
Hi all,
I wrote a program to insert user details from a website into a database table. all the program is working fine except a thing, which is, the database is not taking the correct value although i am getting the correct value at the console..
here is my code and details:



and the line from where i am inserting the data into database is:



the above code is in separate class and there is another class where i defined setter getter methods:



dto is the object of the class in which i have defined setter getter methods.

now the output i m getting on console is:

Collinsville, IL
United States
Address : Collinsville, IL
United States

but on the database table it is entering oly first line of the output at Address column... like- Collinsville, IL
please help me out to get the correct and full data in the table..

Thanks in advance
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2504
    
    8

Hi,

can you try to use PreparedStatement and parameters, in stead of collating a n sql string together?

How do you check what has been entered in the database? What tool are you using to look at the values?
What does your database table looklike?

Regards, Jan


OCUP UML fundamental and ITIL foundation
youtube channel
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Problem in getting correct data