File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and the fly likes java.sql.SQLException: No such column name [Informix DB] 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: No such column name [Informix DB]" Watch "java.sql.SQLException: No such column name [Informix DB]" New topic

java.sql.SQLException: No such column name [Informix DB]

Adeel ch

Joined: Oct 25, 2012
Posts: 2
I am getting SQLException with Error Message of this Exception is "No such column name" and Error Code is -79738. I am connected to Informix DB. My requirement is that I want to print column name too in the error message.
Here is my code snippet


exception is thrown at first statement because actual column is input_record not input_recordss and Error Message is "No such column name". I want following Error Message
"column input_recordss not found".
nir sharma
Ranch Hand

Joined: Sep 11, 2012
Posts: 72

you can catch the SQLExecption and throw new SQLException with your message.
Adeel ch

Joined: Oct 25, 2012
Posts: 2
Actually I do not want to print my message by throwing new SQL Exception because for this I have to store all the column names in Variables. These variables will then be used in Error Message. If i donot store them in variable then I donot have access to column name. Is there anyother way?

nir sharma
Ranch Hand

Joined: Sep 11, 2012
Posts: 72

well I am unable to find a way to get the 'wrong column name' through exception. lets see what others have to say about this.
as of now what I can think of is that you can use column index rather than column name to avoid this thing.
if you have to do this, then there is a long way, get the column name using meta data and then compare them.(I dont think its a good way to go about it though)
Wendy Gibbons

Joined: Oct 21, 2008
Posts: 1106

Welcome to the ranch Adeel.

Where are the column names coming from you are using to get the results? as in the example you have provided you have them hard coded, so throwing a new exception would be easy simply hard code it again.

if the column names are coming from variables you can simply use the variable to build your new exception
throw new SqlException("column "+variable+" not found").

if this is not enough help we will need to see your code as we are just guessing at what you can do.

I agree. Here's the link:
subject: java.sql.SQLException: No such column name [Informix DB]
Similar Threads
Checking table locks in java
Aliases on Oracle
Database replication
JDBC returning values using Scientific Notation