Request for information about DatabaseMetaData.getTables

Paul Wehlage paul.wehlage at gd-is.com
Thu Jun 7 11:35:53 EDT 2001


I running on Windows 2000, SQL Server 7.0 SP2, JDK1.3 and the latest
snapshot of freetds_jdbc.  I have been calling the getTables routine
of DatabaseMetaData and getting no results returned when I clearly
have tables in the database.  I am asking for the following

catalog=Archive
schemaPattern=dba
tableNamePattern=null (which converts to '%')
types[] = {"TABLE"}

I have looked at the problem quite a bit and determined that
I do not get the same results from the stored procedure that
gets executed as I get by just building the equivalent SQL string
without using prepared statement parameters.  My hand built string
returns the results I expected, the stored procedure always returns
zero records.  I am not a stored procedure expert but I would have
expected the same results from either query.

This works
select TABLE_CAT=cat, TABLE_SCHEM=schem, TABLE_NAME=name, TABLE_TYPE=type,
REMARKS=rem from ##t#1 where  cat = 'Archive'  and schem like 'dba' and
name like '%' and ( type = 'TABLE' )

This does not
create proc #jdbc#3(@P1 nvarchar(4000), @P2 nvarchar(4000), @P3
nvarchar(4000), @P4 nvarchar(4000)) as select TABLE_CAT=cat,
TABLE_SCHEM=schem,  TABLE_NAME=name, TABLE_TYPE=type, REMARKS=rem from
##t#1 where cat=@P1  and schem like @P2 and name like @P3 and ( type = @P4
 )

executed with N'Archive", N'dba', N'%', N'TABLE'

I have monitored this with the SQL Profiler and do not see any errors.

Could someone please enlighten me on this?



More information about the FreeTDS mailing list