SchemaCrawler需要哪些JAR文件? [英] Which JAR files are required for SchemaCrawler?

查看:195
本文介绍了SchemaCrawler需要哪些JAR文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

pre $ $ $ $ $ $ $ $ $ $ $ $ $
$ b SchemaCrawlerOptions options = new SchemaCrawlerOptions();
options.setSchemaInfoLevel(SchemaInfoLevelBuilder.standard());


尝试{
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);


$ b} catch(Exception e){
// TODO自动生成的catch块
e.printStackTrace();


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

我总是收到错误:

  2017年10月12日下午1:31:50 schemacrawler.utility.SchemaCrawlerUtility matchDatabaseSpecificOverrideOptions 
INFO:将数据库插件用于
Oct 12 ,2017 1:31:50 PM schemacrawler.utility.TypeMap< init>
警告:无法从连接
获取数据类型映射java.lang.NullPointerException $ b $ 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 $ 17 3(PlatformImpl.java:295)
在java.security.AccessController.doPrivileged(本地方法)
在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(本地方法)
在com.sun.glass.ui.win.WinApplication.lambda $ null $ 148(WinApplication.java:191)
在java.lang.Thread.run(Thread.java:748)
code>

我从这里。是否需要其他任何罐子?

解决方案

Alyona,您可以忽略日志中的警告张贴在您的问题。 sqlite-jdbc jar不完全符合JDBC标准,所以你必须非常特别地使用该jar版本。请使用版本3.7.8,该版本仅适用于 SchemaCrawler发行版。另外,您需要 schemacrawler -sqlite jar 对应于您正在使用的SchemaCrawler版本。



Sualeh Fatehi, SchemaCrawler


I'm using Eclipse, SQLite database and Hibernate. I want to use SchemaCrawler in my project, already have sqlite-jdbc library. My aim is to compare using SchemaCrawler structure of two databases. But I can't even connect to my first database. I am using this code:

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;
    }
}

I always get error:

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)

I downloaded schemacrawler.jar from here. Could it be that any other jars are needed as well?

解决方案

Alyona, you can ignore the warning in the log that you have posted in your question. The sqlite-jdbc jar is not fully compliant with the JDBC standards, so you have to very particular with the version of that jar. Please use version 3.7.8, which is only available with the SchemaCrawler distribution. In addition, you will need the schemacrawler-sqlite jar corresponding to the version of SchemaCrawler that you are using.

Sualeh Fatehi, SchemaCrawler

这篇关于SchemaCrawler需要哪些JAR文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆