gpt4 book ai didi

java - SchemaCrawler 需要哪些 JAR 文件?

转载 作者:行者123 更新时间:2023-12-02 12:08:35 34 4
gpt4 key购买 nike

我正在使用 Eclipse、SQLite 数据库和 Hibernate。我想在我的项目中使用SchemaCrawler,已经有sqlite-jdbc库。我的目的是使用 SchemaCrawler 比较两个数据库的结构。但我什至无法连接到我的第一个数据库。我正在使用这段代码:

public class SchemaConroller {

public SchemaConroller() {

SchemaCrawlerOptions options = new SchemaCrawlerOptions();
options.setSchemaInfoLevel(SchemaInfoLevelBuilder.standard());


try {
Connection conn = getConnection();
Catalog catalog = SchemaCrawlerUtility.getCatalog(conn, options);
for (Schema schema : catalog.getSchemas()) {
System.out.println(schema);
for (Table table : catalog.getTables(schema)) {
System.out.print("o--> " + table);
for (Column column : table.getColumns()) {
System.out.println(" o--> " + column);
}
}
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

private static Connection getConnection() throws SchemaCrawlerException, SQLException, ClassNotFoundException {
String dbPath = "src/home/accounting/DB/myDatabase.sqlite";
Class.forName("org.sqlite.JDBC");
Connection c = DriverManager.getConnection("jdbc:sqlite:" + dbPath);
return c;
}
}

我总是收到错误:

Oct 12, 2017 1:31:50 PM schemacrawler.utility.SchemaCrawlerUtility matchDatabaseSpecificOverrideOptions
INFO: Using database plugin for
Oct 12, 2017 1:31:50 PM schemacrawler.utility.TypeMap <init>
WARNING: Could not obtain data type map from connection
java.lang.NullPointerException
at org.sqlite.jdbc3.JDBC3Connection.getTypeMap(JDBC3Connection.java:90)
at schemacrawler.utility.TypeMap.<init>(TypeMap.java:116)
at schemacrawler.crawl.RetrieverConnection.<init>(RetrieverConnection.java:194)
at schemacrawler.crawl.SchemaCrawler.crawl(SchemaCrawler.java:870)
at schemacrawler.utility.SchemaCrawlerUtility.getCatalog(SchemaCrawlerUtility.java:75)
at home.accounting.controller.SchemaConroller.<init>(SchemaConroller.java:35)
at home.accounting.DA.DBCheck.start(DBCheck.java:44)
at home.accounting.MainApp.start(MainApp.java:83)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
at java.lang.Thread.run(Thread.java:748)

我从 here 下载了 schemacrawler.jar 。是否还需要其他 jar ?

最佳答案

Alyona,您可以忽略您在问题中发布的日志中的警告。 sqlite-jdbc jar 不完全符合 JDBC 标准,因此您必须非常注意该 jar 的版本。请使用版本 3.7.8,该版本仅适用于 SchemaCrawler distribution 。此外,您将需要 schemacrawler-sqlite jar与您正在使用的 SchemaCrawler 版本相对应。

Sualeh Fatehi,SchemaCrawler

关于java - SchemaCrawler 需要哪些 JAR 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46709777/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com