Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

My jdbc Program is not workin

 
Ganesh Bhaware
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator







 
Akhilesh Trivedi
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not working means?
 
Campbell Ritchie
Sheriff
Pie
Posts: 50245
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch
I have added code tags which you should always use, and you can see how much better your code looks. On this forum (JDBC), please click the “Disable smilies in this message” box, so :o comes out as :o, not I have done that, too.
As Akhilesh Trivedi said, we can’t help unless we know the details.
 
Ganesh Bhaware
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Akhilesh Trivedi wrote:Not working means?

Sir its compile fine when be execute this code that time


D:\basics\jdbc>set classpath=C:\Users\Ganesh\Desktop\ojdbc14.jar;

D:\basics\jdbc>javac SelectQueryDemo2.java

D:\basics\jdbc>java SelectQueryDemo2
Enter table name
account
COnnected to oracle
java.sql.SQLException: Invalid column index: getValidColumnIndex
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
:146)
at oracle.jdbc.driver.OracleResultSetMetaData.getValidColumnIndex(Oracle
ResultSetMetaData.java:143)
at oracle.jdbc.driver.OracleResultSetMetaData.getColumnName(OracleResult
SetMetaData.java:254)
at SelectQueryDemo2.main(SelectQueryDemo2.java:27)
 
Akhilesh Trivedi
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ganesh Bhaware wrote:
Akhilesh Trivedi wrote:Not working means?

Sir its compile fine when be execute this code that time


D:\basics\jdbc>set classpath=C:\Users\Ganesh\Desktop\ojdbc14.jar;

D:\basics\jdbc>javac SelectQueryDemo2.java

D:\basics\jdbc>java SelectQueryDemo2
Enter table name
account
COnnected to oracle
java.sql.SQLException: Invalid column index: getValidColumnIndex
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
:146)
at oracle.jdbc.driver.OracleResultSetMetaData.getValidColumnIndex(Oracle
ResultSetMetaData.java:143)
at oracle.jdbc.driver.OracleResultSetMetaData.getColumnName(OracleResult
SetMetaData.java:254)
at SelectQueryDemo2.main(SelectQueryDemo2.java:27)


Check your line number 27 it is within loop. Is your for loop exceeding the values...?
 
Nam Ha Minh
Ranch Hand
Posts: 504
Eclipse IDE Firefox Browser Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at this line of code:


As I remember, the index in JDBC is 1-based, not 0-based. So you may get exception when trying to access the 0th element.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic