Closed kvallish closed 8 years ago
What command-line are you using?
Below is the comand I used:
schemacrawler.cmd -c=schema -url=jdbc:sybase:Tds:
Interestingly, when I used the below commandline (jtds instead of sybase), i get the exception stating connection object is closed:
schemacrawler.cmd -c=schema -url=jdbc:jtds:sybase://
May 04, 2016 1:42:55 PM us.fatehi.commandlineparser.CommandLineUtility logFullStackTrace SEVERE: Exception retrieving schema information: Invalid state, the Connection object is closed. schemacrawler.schemacrawler.SchemaCrawlerException: Exception retrieving schema information: Invalid state, the Connection object is closed. at schemacrawler.crawl.SchemaCrawler.crawlSchemas(SchemaCrawler.java:398 ) at schemacrawler.crawl.SchemaCrawler.crawl(SchemaCrawler.java:763) at schemacrawler.tools.executable.BaseStagedExecutable.execute(BaseStage dExecutable.java:92) at schemacrawler.tools.commandline.SchemaCrawlerCommandLine.execute(Sche maCrawlerCommandLine.java:133) at schemacrawler.Main.main(Main.java:88) Caused by: java.sql.SQLException: Invalid state, the Connection object is closed . at net.sourceforge.jtds.jdbc.JtdsConnection.checkOpen(JtdsConnection.jav a:1744) at net.sourceforge.jtds.jdbc.JtdsConnection.createStatement(JtdsConnecti on.java:2362) at net.sourceforge.jtds.jdbc.JtdsDatabaseMetaData.getSchemas(JtdsDatabas eMetaData.java:1595) at schemacrawler.crawl.SchemaRetriever.retrieveAllSchemas(SchemaRetrieve r.java:173) at schemacrawler.crawl.SchemaRetriever.retrieveSchemas(SchemaRetriever.j ava:97) at schemacrawler.crawl.SchemaCrawler.lambda$crawlSchemas$20(SchemaCrawle r.java:375) at sf.util.StopWatch.time(StopWatch.java:156) at schemacrawler.crawl.SchemaCrawler.crawlSchemas(SchemaCrawler.java:374 )
Using squirrel client to connect to database, I had to use the jconn3-6.0.jar and its com.sybase.jdbc3.jdbc.SybDriver to connect to the same database. How can make schemacrawler to use this driver instead of the jtds driver packaged with it?
Very simple: delete (remove) the jTDS driver jar file from the SchemaCrawler lib/
folder, and put in the Sybase JDBC driver jar file (jconn3-6.0.jar) in that folder. Run SchemaCrawler with the same JDBC URL that you use for SQuirreL SQL Client.
I still get the same "Could not find a suitable JDBC driver" error. Here is the full exception and logs. Interestingly, jconn driver does not look like loaded from the logs:
D:\Downloads\schemacrawler-14.07.08-main\schemacrawler-14.07.08-main_schemacrawler>schemacrawler.cmd -c=schema -url=jdbc:sybase:Tds:myserver.com:2638/dbname -u=zenadmin -password=password -outputformat=text -outputfile=a.txt -loglevel=CONFIG -infolevel=standard
May 04, 2016 9:31:27 PM us.fatehi.commandlineparser.CommandLineUtility logSafeArguments
INFO: SchemaCrawler, v14.07.08
May 04, 2016 9:31:27 PM us.fatehi.commandlineparser.CommandLineUtility logSafeArguments
INFO: Command line:
-c=schema
-url=jdbc:sybase:Tds:myserver.com:2638/dbname
-u=zenadmin
-password=
-outputformat=text
-outputfile=a.txt
-loglevel=CONFIG
-infolevel=standard
May 04, 2016 9:31:27 PM us.fatehi.commandlineparser.CommandLineUtility logSystemProperties
CONFIG: System properties:
java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment
java.awt.printerjob=sun.awt.windows.WPrinterJob
java.class.version=52.0
java.endorsed.dirs=C:\Program Files\Java\jre1.8.0_91\lib\endorsed
java.ext.dirs=C:\Program Files\Java\jre1.8.0_91\lib\ext;C:\Windows\Sun\Java\lib\ext
java.home=C:\Program Files\Java\jre1.8.0_91
java.io.tmpdir=C:\Users\KVALLI~1.COR\AppData\Local\Temp\
java.runtime.name=Java(TM) SE Runtime Environment
java.runtime.version=1.8.0_91-b14
java.specification.name=Java Platform API Specification
java.specification.vendor=Oracle Corporation
java.specification.version=1.8
java.vendor=Oracle Corporation
java.vendor.url=http://java.oracle.com/
java.vendor.url.bug=http://bugreport.sun.com/bugreport/
java.version=1.8.0_91
java.vm.info=mixed mode
java.vm.name=Java HotSpot(TM) 64-Bit Server VM
java.vm.specification.name=Java Virtual Machine Specification
java.vm.specification.vendor=Oracle Corporation
java.vm.specification.version=1.8
java.vm.vendor=Oracle Corporation
java.vm.version=25.91-b14
os.arch=amd64
os.name=Windows 7
os.version=6.1
May 04, 2016 9:31:27 PM us.fatehi.commandlineparser.CommandLineUtility logSystemProperties
CONFIG: Classpath:
lib/h2-1.4.191.jar
lib/hsqldb-2.3.3.jar
lib/jconn3-6.0.jar
lib/jython-standalone-2.5.3-jar.jar
lib/jython-standalone-2.5.3-source.jar
lib/mariadb-java-client-1.4.2.jar
lib/mysql-connector-java-6.0.2.jar
lib/postgresql-9.4.1208.jar
lib/schemacrawler-14.07.08.jar
lib/schemacrawler-api-14.07.08-tests.jar
lib/schemacrawler-db2-14.07.08.jar
lib/schemacrawler-h2-14.07.08.jar
lib/schemacrawler-hsqldb-14.07.08.jar
lib/schemacrawler-lint-14.07.08.jar
lib/schemacrawler-mariadb-14.07.08.jar
lib/schemacrawler-mysql-14.07.08.jar
lib/schemacrawler-offline-14.07.08.jar
lib/schemacrawler-oracle-14.07.08.jar
lib/schemacrawler-postgresql-14.07.08.jar
lib/schemacrawler-sqlite-14.07.08.jar
lib/schemacrawler-sqlserver-14.07.08.jar
lib/schemacrawler-sybaseiq-14.07.08.jar
lib/sqlite-jdbc-3.7.8.jar
lib/xmlpull-1.1.3.1.jar
lib/xpp3_min-1.1.4c.jar
lib/xstream-1.4.9.jar
.
May 04, 2016 9:31:27 PM schemacrawler.tools.databaseconnector.DatabaseConnectorRegistry loadDatabaseConnectorRegistry
CONFIG: Loading database connector, db2=schemacrawler.server.db2.DB2DatabaseConnector
May 04, 2016 9:31:27 PM schemacrawler.tools.databaseconnector.DatabaseConnectorRegistry loadDatabaseConnectorRegistry
CONFIG: Loading database connector, h2=schemacrawler.server.h2.H2DatabaseConnector
May 04, 2016 9:31:27 PM schemacrawler.tools.databaseconnector.DatabaseConnectorRegistry loadDatabaseConnectorRegistry
CONFIG: Loading database connector, hsqldb=schemacrawler.server.hsqldb.HyperSQLDatabaseConnector
May 04, 2016 9:31:27 PM schemacrawler.tools.databaseconnector.DatabaseConnectorRegistry loadDatabaseConnectorRegistry
CONFIG: Loading database connector, mariadb=schemacrawler.server.mariadb.MariaDBDatabaseConnector
May 04, 2016 9:31:27 PM schemacrawler.tools.databaseconnector.DatabaseConnectorRegistry loadDatabaseConnectorRegistry
CONFIG: Loading database connector, mysql=schemacrawler.server.mysql.MySQLDatabaseConnector
May 04, 2016 9:31:27 PM schemacrawler.tools.databaseconnector.DatabaseConnectorRegistry loadDatabaseConnectorRegistry
CONFIG: Loading database connector, offline=schemacrawler.tools.offline.OfflineDatabaseConnector
May 04, 2016 9:31:27 PM schemacrawler.tools.databaseconnector.DatabaseConnectorRegistry loadDatabaseConnectorRegistry
CONFIG: Loading database connector, oracle=schemacrawler.server.oracle.OracleDatabaseConnector
May 04, 2016 9:31:27 PM schemacrawler.tools.databaseconnector.DatabaseConnectorRegistry loadDatabaseConnectorRegistry
CONFIG: Loading database connector, postgresql=schemacrawler.server.postgresql.PostgreSQLDatabaseConnector
May 04, 2016 9:31:27 PM schemacrawler.tools.databaseconnector.DatabaseConnectorRegistry loadDatabaseConnectorRegistry
CONFIG: Loading database connector, sqlite=schemacrawler.tools.sqlite.SQLiteDatabaseConnector
May 04, 2016 9:31:27 PM schemacrawler.tools.databaseconnector.DatabaseConnectorRegistry loadDatabaseConnectorRegistry
CONFIG: Loading database connector, sqlserver=schemacrawler.server.sqlserver.SqlServerDatabaseConnector
May 04, 2016 9:31:27 PM schemacrawler.tools.databaseconnector.DatabaseConnectorRegistry loadDatabaseConnectorRegistry
CONFIG: Loading database connector, sybaseiq=schemacrawler.server.sybaseiq.SybaseIQDatabaseConnector
May 04, 2016 9:31:27 PM schemacrawler.tools.databaseconnector.DatabaseConnectorRegistry logRegisteredJdbcDrivers
CONFIG: Registered JDBC drivers, [com.mysql.cj.jdbc.Driver 6.0, org.h2.Driver 1.4, org.hsqldb.jdbc.JDBCDriver 2.3, org.mariadb.jdbc.Driver 1.4, org.postgresql.Driver 9.4, org.
sqlite.JDBC 3.7, schemacrawler.tools.offline.jdbc.OfflineDriver 0.0]
May 04, 2016 9:31:27 PM schemacrawler.tools.commandline.SchemaCrawlerCommandLine
Well, I can see the classpath contains the jar,
May 04, 2016 9:31:27 PM us.fatehi.commandlineparser.CommandLineUtility logSystemProperties
CONFIG: Classpath:
lib/h2-1.4.191.jar
lib/hsqldb-2.3.3.jar
lib/jconn3-6.0.jar
...
but the Java DriverManager does not load the driver,
CONFIG: Registered JDBC drivers, [com.mysql.cj.jdbc.Driver 6.0, org.h2.Driver 1.4, org.hsqldb.jdbc.JDBCDriver 2.3, org.mariadb.jdbc.Driver 1.4, org.postgresql.Driver 9.4, org. sqlite.JDBC 3.7, schemacrawler.tools.offline.jdbc.OfflineDriver 0.0]
It seems like this is a badly implemented JDBC driver. This is really not a SchemaCrawler issue. The last thing to try would be to modify schemacrawler.cmd
, and add -Djdbc.drivers=com.sybase.jdbc3.jdbc.SybDriver
just after java
.
That worked. Thanks !!!
:+1:
I get an error whenever I try to connect and retrieve tables from Sybase 17 database:
SEVERE: Could not find a suitable JDBC driver for database connection URL, jdbc: sybase:Tds::2638?ServiceName=
schemacrawler.schemacrawler.SchemaCrawlerSQLException: Could not find a suitable
JDBC driver for database connection URL.
Unable to find a way to use sajdbc17 driver to make this connection