I don't know if this is a zxJDBC issue of jython issue but im posting it anyways. Apologise if it offends anyone
Im trying to use the cursor.tables() function to get meta info about
the tables in my sql server database but i can't seem to get any
I managed to connect to my SQL server database and was able to retrieve data using fetchone() and fetchmany()
I used the following syntax to get information about the tables
cur.tables(None, None, "%", ["TABLE"])
but i get the following error:
>>> cur.tables(None, None, "%", ["TABLE"])
Traceback (innermost last):
File "<console>", line 1, in ?
Error: error getting index , type [-9] [SQLCode: 0]
To further investigate the matter i used the profiler and managed to
capture the actual underlying sql resulting from that call above:
exec sp_tables @table_name = N'%', @table_type = ' ' 'TABLE' ' '
I read about this call in sql server help files and found out that @table_type is being wrongly assigned
The 'TABLE' should be encapsulated in double quotes
Hence @table_type should be assigned " ' TABLE ' "
Now this modification works if you run it in sql query analyser.
I have tried various options like passing a jarray into the function,
trying out various combinations of single quotes and double quotes,
passing just the string but i can't get it to work
I also tried to pass None for the 4th parameter to the tables()
function to get info on all objects but it still does not get me
anything even though sql statement captured by the profiler is correct.
I don't know what im doing wrong
Any help would be appreciated.