aspose file tools*
The moose likes JDBC and the fly likes java.sql.SQLException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "java.sql.SQLException" Watch "java.sql.SQLException" New topic
Author

java.sql.SQLException

shivangi mathur
Greenhorn

Joined: Jul 07, 2001
Posts: 10
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

Joined: Jun 23, 2001
Posts: 73

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

Joined: Jul 07, 2001
Posts: 10
Thank You Yusuf for your prompt and useful reply.
shivangi
Mohamed Yousuff
Ranch Hand

Joined: Jun 23, 2001
Posts: 73

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


------------------
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.sql.SQLException