Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.sql.SQLException

 
shivangi mathur
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello
I am facing one problem while connecting to OARCLE database through SERVLETS using JDBC:ODBC Bridge.
When I try to insert somthing to the database from the HTML forms. the statement for insertion is:
"INSERT INTO M_COMPLAINTS VALUES (complaintno, name, Rollno, email, machineno, pdate, pdescription)";
where all the values are of string type retrieved from a HTML Form.
the ERROR is :
java.sql.SQLException: [Microsoft][ODBC driver for Oracle][Oracle]ORA-00984: column not allowed here at java.lang.

please help me.
Shivangi
 
Mohamed Yousuff
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I suggest that you change your insert statement to something like this

"Insert into M_COMPLAINTS ( colname1, colname2 ) values ( colvalue1, colvalue2 )"

The problem with yours is that you have not mentioned the column name and the corresponding values. Also remember that the values for string should be in single quotes. Sample is shown below
String value = "somevalue" ;
"Insert into test ( colname ) values ( '" + value + "') "
If you are not able to understand this, just go in for prepared statement. That is very simple and cool to use.
Good Luck.

 
shivangi mathur
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank You Yusuf for your prompt and useful reply.
shivangi
 
Mohamed Yousuff
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I will be glad if you could let me know if you have solved the problem.

Originally posted by shivangi mathur:
Thank You Yusuf for your prompt and useful reply.
shivangi


------------------
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic