[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freetds
Subject:    Re: [freetds] Squirrel JDBC-ODBC Bridge and freeTDS ODBC
From:       "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio () vodafone ! com>
Date:       2005-11-04 13:47:00
Message-ID: F7F148C986A2A84F930FEB8C3B169EA002FBC326 () OPDMEXO01 ! omnitel ! it
[Download RAW message or body]

> 
> 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
_______________________________________________
FreeTDS mailing list
FreeTDS@lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic