Stack Trace:-
java.sql.SQLException: No data found
at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.SQLGetDataString(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcResultSet.getDataString(Unknown
Source)
at sun.jdbc.odbc.JdbcOdbcResultSet.getString(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcResultSet.getString(Unknown Source)
I connect to the db like this
if(databaseType()=="Oracle")
{
Class.forName("oracle.jdbc.driver.OracleDriver");
dbUrl = "jdbc:oracle:oci8:@"+getDatabase();
}
else if(databaseType()=="DB2")
{
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver").newInstance();
dbUrl = "jdbc:db2:"+getDatabase();
}
else if(databaseType()=="ODBC")
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
dbUrl = "jdbc:odbc:"+getDatabase();
}
con = DriverManager.getConnection(dbUrl,getUserName(),getPassword());
DatabaseMetaData testMetaData = con.getMetaData();
String[] types = {"TABLE","VIEW"};
testDbMetaData = testMetaData.getTables(null,schemaName,null,types);
//the following line is the code which is giving the exception
println("****** results = "+testDbMetaData.getString("TABLE_NAME"));
Hope someone can help me out.
Cheers
P.
The JDBC/ODBC driver requires you to retrieve columns in order, starting at 1 (check
the docs.) The "TABLE_NAME" column is the 3rd column in the resultset. Retrieve columns
1 and 2 first.
--
Lee Fesperman, FFE Software, Inc. (http://www.firstsql.com)
===================================================================
* Check out Database Debunkings (http://www.firstsql.com/dbdebunk/)
* "Where Persistent Prevailing Database Fallacies Are Dispelled"
Thanks that worked,
problem solved.
P