Skip to Content.
Sympa Menu

freetds - Re: [freetds] Squirrel JDBC-ODBC Bridge and freeTDS ODBC

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio AT vodafone.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Squirrel JDBC-ODBC Bridge and freeTDS ODBC
  • Date: Fri, 4 Nov 2005 14:47:00 +0100

>
> Thanks for clarification, Frediano.
> if we wish to achieve 100% mimic for
> DatabaseMetaData.getSchemas() and
> DatabaseMetaData.getCatalogs() in jdbc-odbc bridging we
> should'n use sp_tableswc. I understand this method looks more
> systematic, but actually JdbcOdbc bridge call:
> 1) for getCatalogs()
> - original SQLSRV32.DLL::SQLTablesW call "sp_tables N'',
> N'', N'%', NULL",
> IAW "sp_tables @table_name = N'', @table_owner = N'',
> @table_qualifier = N'%' , @table_type = null",
> but sp_tableswc does not return thees rows.
>
> we could see it in jdbcdebug.log by Squirrel
> ....
> *DatabaseMetaData.getCatalogs
> *DatabaseMetaData.getTables (%,,,null)
> Allocating Statement Handle (SQLAllocStmt), hDbc=57676616
> hStmt=57681616
> Tables (SQLTables), hStmt=57681616,catalog=%, schema=,
> table=, types=null
> Number of result columns (SQLNumResultCols), hStmt=57681616
> value=5
> *ResultSet.getMetaData
> Fetching (SQLFetch), hStmt=57681616
> *ResultSetMetaData.getColumnType (1)
> Column attributes (SQLColAttributes), hStmt=57681616,
> icol=1, type=2
> value (int)=-9
> Column attributes (SQLColAttributes), hStmt=57681616,
> icol=1, type=3
> value (int)=256
> Get string data (SQLGetData), hStmt=57681616, column=1,
> maxLen=257
> admin
> Fetching (SQLFetch), hStmt=57681616
> *ResultSetMetaData.getColumnType (1)
> Get string data (SQLGetData), hStmt=57681616, column=1,
> maxLen=257
> Aida32
> ....
> So, getTables (%,,,null) was transformed into sp_tables '',
> '', '%', NULL
>
> 2) for getSchemas()
> original SQLSRV32.DLL::SQLTablesW call "sp_tables N'', N'%',
> N'', NULL".
> "sp_tableswc N'', N'%', N'', NULL" does not return rows like sp_tables
>
> *DatabaseMetaData.getSchemas
> *DatabaseMetaData.getTables (,%,,null)
> Allocating Statement Handle (SQLAllocStmt), hDbc=57676616
> hStmt=57681616
> Tables (SQLTables), hStmt=57681616,catalog=, schema=%,
> table=, types=null
> Number of result columns (SQLNumResultCols), hStmt=57681616
> value=5
> *ResultSet.getMetaData
> Fetching (SQLFetch), hStmt=57681616
> *ResultSetMetaData.getColumnType (1)
> Column attributes (SQLColAttributes), hStmt=57681616,
> icol=1, type=2
> value (int)=-9
> Column attributes (SQLColAttributes), hStmt=57681616,
> icol=2, type=2
> value (int)=-9
> Column attributes (SQLColAttributes), hStmt=57681616,
> icol=2, type=3
> value (int)=256
> Get string data (SQLGetData), hStmt=57681616, column=2,
> maxLen=257
> dbo
> Fetching (SQLFetch), hStmt=57681616
>
> sp_tableswc could mimic *structure* of sp_tables resultset,
> but power of the set will be different.
> In accordance with it we have many identical records on the
> Squirrel's tab 'Schemas'
>
> Another problem - we should mimic 'Connection is busy with
> results for another hstmt'
> .....
> Tables (SQLTables), hStmt=57681616,catalog=%, schema=,
> table=, types=null
> RETCODE = -1
> ERROR - Generating SQLException...
> SQLException: SQLState(S1000) vendor code(0)
> java.sql.SQLException: [Microsoft][ODBC SQL Server
> Driver]Connection is busy with results for another hstmt
> .....
> And next (may be it is Squirrel's bug) odbc.c:change_database
> called by JdbcOdbc bridge with quoted identifiers ("master"
> instead of master) and as result - USE ["master"] call failed.
>
> I'm a bit busy now, may be take a look at this later
>
> Sincerely yours.
> -------------------------------------------------------
> Vitaly Zverev, OCP DBA 8&8i
> Oracle E-Business Suite &
> Infiniband Linux Cluster Administrator
> Genesis Ltd., St.Petersburg, Russia
>

I think I fixed your problem in CVS HEAD. There are some strange values
that cause strange behavior calling SQLTables. I also improve test to
catch what you require.

freddy77




Archive powered by MHonArc 2.6.24.

Top of Page