This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JDBC and the fly likes JDBC INSERT error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "JDBC INSERT error" Watch "JDBC INSERT error" New topic
Author

JDBC INSERT error

J chan
Greenhorn

Joined: Jul 16, 2006
Posts: 2
please help

the following code block is giving an sql exception. I have checked through it several times will no success.


PreparedStatement stat = con.prepareStatement("Insert into STUDENT_T values(?,?)");
stat.setInt(1,Integer.parseInt(txtId.getText()));
stat.setString(2,txtName.getText());

thanks in advance

JCHAN
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3704
    
    5

What is the SQL Exception exactly?


My Blog: Down Home Country Coding with Scott Selikoff
J chan
Greenhorn

Joined: Jul 16, 2006
Posts: 2
Hi Thanks, i got that matter verrified. i belive there was an sql error
i am not very sure what really was the error but i just wrote back again
the same sql query using capital letters as the fields of the tables were created in capital.

is that sql query case sensitive.

thanks for ur time
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3704
    
    5

Shouldn't be, but really we need to see the message following the SQL error in order to help.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JDBC INSERT error