-
-
Notifications
You must be signed in to change notification settings - Fork 202
Metadata from SQLServer error - No tables SQL provided #256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Péterson, In order for me to look into this further, please use -loglevel=ALL, and give me the logs. Also, please send me instructions on how to set up a SQL Server user with just grant view definition permissions, and I will try to reproduce.
Sualeh. |
Hello Sualeh, thank you for the answer. I just sent you the logs via email, since I don't want them to be public. I am also not an expert in SQL Server, but here what we did was to create a user and grant it just view definition authorization, since we wanted the user not to be able to query any database, but collect the metadata from them. The command is something like:
To reproduce the error it is important to make sure User1 does not have select permission on database, but has view definition. To complement the thread, I did a little investigation on SQL Server JDBC database, and found this: getTables Method (SQLServerDatabaseMetaData) - SQL Server | Microsoft Docs
And the source code of the JDBC driver:
I guess the information above means that SQL Server JDBC driver uses sp_tables command to get tables information. And here's what sp_tables documentation says: sp_tables (Transact-SQL) - SQL Server | Microsoft Docs
Therefore, I think the cause of the error is that in order for the SQL Server Jdbc Driver to return table information, the user must have permission to query the database. Is this correct? Thank you again, Péterson |
Péterson, USE BOOKS;
CREATE LOGIN schemacrawler1 WITH PASSWORD = 'schemacrawler1';
CREATE USER schemacrawler1 FOR LOGIN schemacrawler1;
GRANT VIEW DEFINITION TO schemacrawler1; Then I ran SchemaCrawler like this: and it worked. Sualeh. |
Hello Sualeh, I will check it out again and get back to you. Also, can you force schemacrawler to use data_dictionary_all strategy? The issue is also related to that, since schemacrawler-sqlserver does not have a tables.sql file which should contain queries to return tables information from the data dictionary. Péterson |
@petersonjr I followed your instructions on how to create a database user, and the new user has permissions to run There is development work needed to support the |
@petersonjr I am closing this issue. Please send me more information when you have it. |
Issue
Hello, I am using SchemaCrawler to get metadata info from a SQL Server DB.
When I run SchemaCrawler against a database via commandline, I get the following error:
schemacrawler.schemacrawler.SchemaCrawlerException: No tables SQL provided
The command is as follows:
schemacrawler.exe -url 'jdbc:sqlserver://server:port' -u 'user' -password 'password' -server 'sqlserver' -fmt 'json' -schemas 'DBINFO\..*' -c schema -loglevel=ALL
The user that I connect to DB with has only permissions to view definition of the database (grant view definition to user).
I tried using the Java API to achieve same goal, and notice a few things:
Therefore, I kindly ask a few questions:
Thank you for the time and effory you put in this useful tool,
Péterson
Environment
INFORMAÃıES: Environment:
SchemaCrawler 15.06.01
Windows 7 6.1
"Oracle Corporation" Java HotSpot(TM) 64-Bit Server VM 10.0.1+10
The text was updated successfully, but these errors were encountered: