Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JDBC INSERT error

 
J chan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
author
Bartender
Posts: 4033
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the SQL Exception exactly?
 
J chan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
author
Bartender
Posts: 4033
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shouldn't be, but really we need to see the message following the SQL error in order to help.
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!