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

error invalid column name

 
Megha Singhal
Ranch Hand
Posts: 225
IBM DB2 Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in the following code



following error is coming

Connection Pooling Example.
An Error Had occurred while accessing the database
--------------------------------------------------------------------------------
Invalid column name


if i'm running this on oracle then it is giving output , i don't know why this is giving error while i'm running on server.

(I edited the code so that it wasn't far too wide -- Paul C)
 
Nam Ha Minh
Ranch Hand
Posts: 502
Eclipse IDE Firefox Browser Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
that means one or some column names in the SELECT clause do not exist in the table. So check for typo in the column names.
 
Megha Singhal
Ranch Hand
Posts: 225
IBM DB2 Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nam Ha Minh wrote:that means one or some column names in the SELECT clause do not exist in the table. So check for typo in the column names.


but the exact query running in the oracle so i don't think there is any prob like that that's why i mentioned that this query is running on oracle
 
Nam Ha Minh
Ranch Hand
Posts: 502
Eclipse IDE Firefox Browser Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You cannot use the dot operator in the following statements:

 
Megha Singhal
Ranch Hand
Posts: 225
IBM DB2 Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nam Ha Minh wrote:You cannot use the dot operator in the following statements:



then what should i use to get value in the variable.
 
Paul Clapham
Sheriff
Pie
Posts: 20955
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nam Ha Minh wrote:You cannot use the dot operator in the following statements:



I don't know if that's right (I'm not an Oracle expert) but at any rate "DIV.R_DESG_NAME" isn't one of the fields selected. It's easy to miss the fact that "DES.R_DESG_NAME" is actually in the query instead.
 
Nam Ha Minh
Ranch Hand
Posts: 502
Eclipse IDE Firefox Browser Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Megha Singhal wrote:

then what should i use to get value in the variable.


One solution I would suggest you is to remove the table alias + dot + column name (if there is no conflict) in the SELECT clause, then update the code like this:



Or you can modify the SELECT clause using AS keyword to set alias for column names, i.e:



then in Java code:

 
Megha Singhal
Ranch Hand
Posts: 225
IBM DB2 Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nam Ha Minh wrote:
Megha Singhal wrote:

then what should i use to get value in the variable.


One solution I would suggest you is to remove the table alias + dot + column name (if there is no conflict) in the SELECT clause, then update the code like this:



Or you can modify the SELECT clause using AS keyword to set alias for column names, i.e:



then in Java code:



thanks it is working now.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic