*
The moose likes JDBC and the fly likes Exception thrown is Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Exception thrown is "Column xxxx unknown in field list"...even though the code is running..!!!" Watch "Exception thrown is "Column xxxx unknown in field list"...even though the code is running..!!!" New topic
Author

Exception thrown is "Column xxxx unknown in field list"...even though the code is running..!!!

Kshitiz Agarwal
Ranch Hand

Joined: Dec 15, 2011
Posts: 36
Hi,

I am executing query:


I am executing the above query using jdbc. The code is running, data is being saved bt SQLexception I am getting is :

Column No_Reading is not found in the field list.

What can be the cause of above exception??
Fatih Keles
Ranch Hand

Joined: Sep 01, 2005
Posts: 182
I suppose this is mysql database, anyways, can you put 97 in single quotes to see if it works. But you should use PreparedStatement and proper setXXX methods.
Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1107

I edited your post, to wrap the very long lines.
This type of message generally means you forgot to put quotes around one of the "no reading" strings in your SQL
It would be nice if you could produce a test program, thst just does the insert, so we can see the full stack trace and the actual line it refers to.
Kshitiz Agarwal
Ranch Hand

Joined: Dec 15, 2011
Posts: 36
Wendy Gibbons wrote:I edited your post, to wrap the very long lines.
This type of message generally means you forgot to put quotes around one of the "no reading" strings in your SQL
It would be nice if you could produce a test program, thst just does the insert, so we can see the full stack trace and the actual line it refers to.


Thanks for the reply...but as I am creating a query dynamically, quotes are not missed out around any "No Reading" value. I am trying to use prepared statement anyway...!!!
Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1107

ksh agarwal wrote:
Wendy Gibbons wrote:I edited your post, to wrap the very long lines.
This type of message generally means you forgot to put quotes around one of the "no reading" strings in your SQL
It would be nice if you could produce a test program, thst just does the insert, so we can see the full stack trace and the actual line it refers to.


Thanks for the reply...but as I am creating a query dynamically, quotes are not missed out around any "No Reading" value. I am trying to use prepared statement anyway...!!!


well it is very difficult for us to help if we aren't even given the code you are running
Kshitiz Agarwal
Ranch Hand

Joined: Dec 15, 2011
Posts: 36
Wendy Gibbons wrote:
ksh agarwal wrote:
Wendy Gibbons wrote:I edited your post, to wrap the very long lines.
This type of message generally means you forgot to put quotes around one of the "no reading" strings in your SQL
It would be nice if you could produce a test program, thst just does the insert, so we can see the full stack trace and the actual line it refers to.


Thanks for the reply...but as I am creating a query dynamically, quotes are not missed out around any "No Reading" value. I am trying to use prepared statement anyway...!!!


well it is very difficult for us to help if we aren't even given the code you are running


Ohh..sorry...this is my code basically:



And even prepared statament is not solving the issu..though i will be using it for safer purpose..

The error is Unknown column 'No_Reading' in 'field list' >
Ireneusz Kordal
Ranch Hand

Joined: Jun 21, 2008
Posts: 423
ksh agarwal wrote:
Ohh..sorry...this is my code basically:


OK,
And now please insert into this code in line #22 the below command:

then run the code and show us the output of this command (the query created by your code).
Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1107

Ireneusz Kordal wrote:
ksh agarwal wrote:
Ohh..sorry...this is my code basically:


OK,
And now please insert into this code in line #22 the below command:

then run the code and show us the output of this command (the query created by your code).


and the stack trace, as if the insert is working, i think another line may be throwing the error, but you are missing that.
Kshitiz Agarwal
Ranch Hand

Joined: Dec 15, 2011
Posts: 36
Wendy Gibbons wrote:
Ireneusz Kordal wrote:
ksh agarwal wrote:
Ohh..sorry...this is my code basically:


OK,
And now please insert into this code in line #22 the below command:

then run the code and show us the output of this command (the query created by your code).


and the stack trace, as if the insert is working, i think another line may be throwing the error, but you are missing that.


May be you are right...actually I am getting an exception:

Operation not allowed after ResultSet closed

In code :

The above function is called aftre every 10 secs and connection to jdbc is made once only. The error comes in //ERROR part of the code. Because of which nullpointerexception also comes in the next line. Why it is coming if I have used If condition before going to while loop???
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Exception thrown is "Column xxxx unknown in field list"...even though the code is running..!!!
 
Similar Threads
JPA native query problem
Maven - ClassNotFoundException
SqlMap problem in Spring-ibatis integration app
Hibernated Pojo Generator using config.xml for Oracle database
Jboss Messaging- Machine with Two LAN cards not able to receive meessage