从postgresql数据库生成ER图[SchemaSpy]

时间:2013-05-06 12:46:49

标签: postgresql er-diagrams schemaspy

有人使用这个工具吗?我想从我的数据库中生成一个ER图。我像这样运行SchemaSpy:

java -jar schemaSpy_5.0.0.jar -t pgsql -db mydb -host localhost -dp /home/katie/downloads/postgresql-8.0-312.jdbc3.jar -noschema -u postgres -o .

然后,我收到了错误:

Using database properties:
  [schemaSpy_5.0.0.

    jar]/net/sourceforge/schemaspy/dbTypes/pgsql.properties
    Gathering schema details..........................................................java.sql.SQLException: ERROR: function information_schema._pg_keypositions() does not exist
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1471)
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1256)
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:175)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:389)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:314)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:221)
        at org.postgresql.jdbc2.AbstractJdbc2DatabaseMetaData.getImportedExportedKeys(AbstractJdbc2DatabaseMetaData.java:3237)
        at org.postgresql.jdbc2.AbstractJdbc2DatabaseMetaData.getImportedKeys(AbstractJdbc2DatabaseMetaData.java:3533)
        at net.sourceforge.schemaspy.model.Table.connectForeignKeys(Table.java:106)
        at net.sourceforge.schemaspy.model.Database.connectTables(Database.java:984)
        at net.sourceforge.schemaspy.model.Database.<init>(Database.java:83)
        at net.sourceforge.schemaspy.SchemaAnalyzer.analyze(SchemaAnalyzer.java:211)
        at net.sourceforge.schemaspy.Main.main(Main.java:42)

我在Xubuntu 12.04上使用PostgreSQL 9.1。

2 个答案:

答案 0 :(得分:3)

问题已通过以下方式解决:

  • 使用PgJDBC当代的PostgreSQL 9.1数据库安装,而不是尝试使用PgJDBC 8.0;和
  • 使用JDBC3驱动程序,因为SchemaSpy似乎不喜欢JDBC4驱动程序。

答案 1 :(得分:0)

java -jar F:/schema/schemaSpy_5.0.0.jar -t postgresql -db dhis2ccem1 -host localhost -port 5432 -s public -u postgres -p root -dp F:/schema/postgresql-9.0-801。 jdbc4.jar -o output