ORA-17003: Invalid column index You are trying to access a column that is not in the select list.
Probably you did not select enough values in the SELECT statement.
eg:
String cs; cs = readEntry ("connectionstring (machine:port:sid) : ");
String user; user = readEntry ("user: ");
String pw; pw = readEntry ("Password: ");
// connect to the database final Connection conn = DriverManager.getConnection( "jdbc:oracle:thin:@"+cs, user, pw );
Statement statement = conn.createStatement();
ResultSet resultset = statement.executeQuery( "select to_char(sysdate, 'dd mon yyyy') from dual " ); if ( resultset.next() ) { System.out.println( "Date: "+resultset.getString( 2 )); } resultset.close(); statement.close(); conn.close();
In the previous example we only have 1 column in the select list ( a date), but we try to access column 2 [getString(2)], which obviously fails as it does not exists in the resultset.
Either add the column to the select list or change the call to getInt/String/...
Add your message for ORA-17003
|