This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JDBC and the fly likes jdbc: invalid column number Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "jdbc: invalid column number" Watch "jdbc: invalid column number" New topic

jdbc: invalid column number

purnima das

Joined: Sep 15, 2000
Posts: 14
i am using win 98/ jdk1.2.2/and oracle odbc driver.
the database is oracle8i.
i have no idea as to what kind of driver it is.
here is my problem.
i have the same tables in MSaccess and oracle.
the program works fine with access. but, with oracle i have a strange problem.
java.sql.exception:Invalid colum number<1>
please help..
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
At first glance it sound as thou you might have a typo...
Check you connection reference variables.
If it is not a type....
Please post code along with table layouts.
I have access to a NT box JDK1.3 JDBC 2.0 MS-ACCESS 2.0 and ORACLe 7.3.4
ttyl, Monty
Phil Owens

Joined: Sep 15, 2000
Posts: 4
When does the problem occur? DUring what operation? Have you isolated that? Is the column reference refering to a ResultSet or ResultSetMetaData? Or is it a Statment, Prepared Statement, or Callable Statement? Where in your code does the error happen?
purnima das

Joined: Sep 15, 2000
Posts: 14
sorry for not giving details.
i was trying to fetch data from the database using Statement interface.
i've made a mistake in the order of retrival of columns.
i changed the order and got the result.
James Carman
Ranch Hand

Joined: Feb 20, 2001
Posts: 580
From the java.sql.ResultSet javadoc...
"For maximum portability, result set columns within each row should be read in left-to-right order, and each column should be read only once."

James Carman, President<br />Carman Consulting, Inc.
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
That is only required when needing portability to JDBC 1.0 drivers (though it may give some performance benefit depending on how the individual drivers are coded).

It is sorta covered in the JavaRanch Style Guide.
subject: jdbc: invalid column number