aspose 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
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: 2510
    
  10

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
 
wood burning stoves
 
subject: Problem in getting correct data