aspose file tools*
The moose likes JDBC and the fly likes My jdbc Program is not workin Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "My jdbc Program is not workin" Watch "My jdbc Program is not workin" New topic
Author

My jdbc Program is not workin

Ganesh Bhaware
Greenhorn

Joined: Mar 06, 2013
Posts: 2







Akhilesh Trivedi
Ranch Hand

Joined: Jun 22, 2005
Posts: 1535
Not working means?


Keep Smiling Always — My life is smoother when running silent. -paul
[FAQs] [Certification Guides] [The Linux Documentation Project]
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39869
    
  28
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

Joined: Mar 06, 2013
Posts: 2
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

Joined: Jun 22, 2005
Posts: 1535
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

Joined: Oct 31, 2011
Posts: 498

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.


PM Me If You Want to get Urgent Help on Java Programming
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: My jdbc Program is not workin