getCatalogs() and getTables()

Stephanie Lewis slewis at thinweb.com
Thu Jul 13 08:38:44 EDT 2000


Hi there,
       I have the July 6/00 download of the JDBC source compiled.. I'm
connecting to an SQL Server 7.0 and all standard queries work fine.
However, I can't get the DatabaseMetaData getTables() to work. It calls
getCatalogs() which throws an exception here:

public java.sql.ResultSet getCatalogs()
   throws SQLException
   {
   // XXX We should really clean up all these temporary tables.
   String tmpName = "#t#" + UniqueId.getUniqueId();
   final String sql =
   " create table " + tmpName + "                                   " +
   " (                                                              " +
   "    q  char(30) not null,                                       " +
   "    o  char(30) null,                                           " +
   "    n  char(30) null,                                           " +
   "    t  char(30) null,                                           " +
   "    r  varchar(255) null                                        " +
   " )                                                              " +
   "                                                                " +
   " insert into " + tmpName + " EXEC sp_tables ' ', ' ', '%', null " +
   "                                                                " +
   " select q from " + tmpName + "                                  " +
   "";
   java.sql.Statement   stmt = connection.createStatement();
   java.sql.ResultSet   rs;


   if (stmt.execute(sql))
   {
   throw new SQLException("Internal error.  Confused");
   }


   // Eat the data returned by the 'create table'
   if (null != (rs = stmt.getResultSet()))
   {
   throw new SQLException("Internal error.  Confused");
   }

   // Eat the data returned by the 'insert'
   if (null != (rs =
stmt.getResultSet()))
<<<<<<<<<<--------------------------------EXCEPTION THROWN HERE!
   {
   throw new SQLException("Internal error.  Confused.  Was expecting a
result set.");
   }

   // now get the result set
   if (null == (rs = stmt.getResultSet()))
   {
   throw new SQLException("Internal error.  Confused");
   }
   return rs;
   }

Are these implementations of these methods supposed to work or are they
a work in progress? Any thoughts.

Hope you can provide some insight,
                                                        Stephanie
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ibiblio.org/pipermail/freetds/attachments/20000713/c418b32c/attachment.html 


More information about the FreeTDS mailing list