Skip to Content.
Sympa Menu

freetds - getCatalogs() and getTables()

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Stephanie Lewis <slewis AT thinweb.com>
  • To: TDS Development Group <freetds AT franklin.oit.unc.edu>
  • Subject: getCatalogs() and getTables()
  • Date: Thu, 13 Jul 2000 09:38:44 -0300

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



Archive powered by MHonArc 2.6.24.

Top of Page