Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
    Bookmark Topic Watch Topic
  • New Topic

insert statement

 
meena latha
Ranch Hand
Posts: 219
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi all..i am not able to insert the data into my data base.
Below is my code

To find the error line is use System.out.println().
When i used that i was able to get output just before line 1.
After line 1 i am not able to get any output.

But i am able to do my select statement properly.
I am not able to find error in my insert statement.
Please give me some suggestion.

Thanks in advance
Ramya
 
Shailesh Chandra
Ranch Hand
Posts: 1082
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Report post to moderator
Originally posted by ramya jp:



i was able to get output just before line 1.
After line 1 i am not able to get any output.



You should have posted this in JDBC forum.

1. are you committing your transaction ?
2. If you can see System.out.println before line 1, Then might be there is an exception during insert.

Did you check what does StatckTrace say ?

you can do this simply



Shailesh
 
meena latha
Ranch Hand
Posts: 219
  • Mark post as helpful
  • send pies
  • Report post to moderator
Thanks Shailesh.....
As you said i inserted printStackTrace().
So in my console i got the following error message

So from the message it is obvious that there is error in insert statement,but i am not able to knock off the error.
Can u please check my insert statement and tell me whether there is any syntax error.

Thanks
 
Heonkoo Lee
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Report post to moderator
Correct syntax is as below:

INSERT INTO table_name (col1_name, col2_name) VALUES (value1, value2)
 
miguel lisboa
Ranch Hand
Posts: 1281
  • Mark post as helpful
  • send pies
  • Report post to moderator
Correct syntax is as below:

INSERT INTO table_name (col1_name, col2_name) VALUES (value1, value2)

let me (partly) disagree with you; see this
 
Carol Enderlin
drifter
Ranch Hand
Posts: 1364
  • Mark post as helpful
  • send pies
  • Report post to moderator
miguel,

not sure what your point is.

 
miguel lisboa
Ranch Hand
Posts: 1281
  • Mark post as helpful
  • send pies
  • Report post to moderator
i mean that saying that there's only one correct aproach doesnt seem right to me: if you wanna make an insert with all fields you can simply say
INSERT INTO table_name VALUES (value1, value2) , as that site's tutorial refers:
The INSERT INTO Statement
The INSERT INTO statement is used to insert new rows into a table.

Syntax
INSERT INTO table_name
VALUES (value1, value2,....)

You can also specify the columns for which you want to insert data:

INSERT INTO table_name (column1, column2,...)
VALUES (value1, value2,....)
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64843
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please do not cross-post the same question in multiple forums. It wastes people's time when multiple redundant conversations take place.
 
meena latha
Ranch Hand
Posts: 219
  • Mark post as helpful
  • send pies
  • Report post to moderator
Thanks to all for your response....but still my problem persists.
I am not able to insert the data.
There is my complete code.

The code inside my ConnectionDB class

Will be great if somebody is able to tell me some solution .
Thanks
Ramya
[ May 15, 2005: Message edited by: ramya jp ]
 
    Bookmark Topic Watch Topic
  • New Topic