aspose file tools*
The moose likes Servlets and the fly likes insert statement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Reply locked New topic
Author

insert statement

meena latha
Ranch Hand

Joined: Jan 24, 2005
Posts: 219
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

Joined: Aug 13, 2004
Posts: 1081

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


Gravitation cannot be held responsible for people falling in love ~ Albert Einstein
meena latha
Ranch Hand

Joined: Jan 24, 2005
Posts: 219
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

Joined: Feb 10, 2005
Posts: 85
Correct syntax is as below:

INSERT INTO table_name (col1_name, col2_name) VALUES (value1, value2)
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
Correct syntax is as below:

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

let me (partly) disagree with you; see this


java amateur
Carol Enderlin
drifter
Ranch Hand

Joined: Oct 10, 2000
Posts: 1364
miguel,

not sure what your point is.

miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
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

Joined: Jan 10, 2002
Posts: 61766
    
  67

Please do not cross-post the same question in multiple forums. It wastes people's time when multiple redundant conversations take place.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
meena latha
Ranch Hand

Joined: Jan 24, 2005
Posts: 219
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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: insert statement