Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Macos 尝试使用OSX使用schemacrawler连接到sqlite db-为什么需要用户?_Macos_Sqlite_Jdbc_Schemacrawler - Fatal编程技术网

Macos 尝试使用OSX使用schemacrawler连接到sqlite db-为什么需要用户?

Macos 尝试使用OSX使用schemacrawler连接到sqlite db-为什么需要用户?,macos,sqlite,jdbc,schemacrawler,Macos,Sqlite,Jdbc,Schemacrawler,结论见下表: 我正在尝试使用schemacrawler来绘制sqlite数据库的图表。我的设置: OSX 10.8 SchemaCrawler 10.5下载自 Java版本1.7.0_45从Oracle下载 sqlite版本:3.7.12 2012-04-03 19:43:07 86B8481BE7E76CC92D14CE762D21BFB69504AF 我在安装schemacrawler的目录中,并使用以下命令行: stebro$ java -classpath lib/*:. schem

结论见下表:

我正在尝试使用schemacrawler来绘制sqlite数据库的图表。我的设置:

  • OSX 10.8
  • SchemaCrawler 10.5下载自
  • Java版本1.7.0_45从Oracle下载
  • sqlite版本:3.7.12 2012-04-03 19:43:07 86B8481BE7E76CC92D14CE762D21BFB69504AF
我在安装schemacrawler的目录中,并使用以下命令行:

stebro$ java -classpath lib/*:. schemacrawler.tools.sqlite.Main /Library/Application\ Support/MyApp/Data/MyApp.db -command="select count(*) from myTable" -infolevel=maximum
SchemaCrawler 10.5
Copyright (c) 2000-2013, Sualeh Fatehi.

SchemaCrawler is a database schema discovery and comprehension tool. 
You can search for database schema objects using regular expressions, 
and output the schema and data in a readable text format. You can find 
potential schema design issues with lint. The output serves for 
database documentation is designed to be diff-ed against other database 
schemas. SchemaCrawler also generates schema diagrams.
password: 
java.sql.SQLException: Could not connect to database, for user null
    at schemacrawler.schemacrawler.BaseDatabaseConnectionOptions.getConnection(BaseDatabaseConnectionOptions.java:93)
    at schemacrawler.schemacrawler.BaseDatabaseConnectionOptions.getConnection(BaseDatabaseConnectionOptions.java:70)
    at schemacrawler.tools.commandline.SchemaCrawlerCommandLine.execute(SchemaCrawlerCommandLine.java:173)
    at schemacrawler.tools.commandline.SchemaCrawlerMain.main(SchemaCrawlerMain.java:93)
    at schemacrawler.tools.commandline.SchemaCrawlerMain.main(SchemaCrawlerMain.java:52)
    at schemacrawler.tools.sqlite.Main.main(Main.java:43)
Caused by: java.lang.IllegalArgumentException: Insufficient parameters for database connection URL: missing [database]
    at schemacrawler.schemacrawler.DatabaseConfigConnectionOptions.getConnectionUrl(DatabaseConfigConnectionOptions.java:73)
    at schemacrawler.schemacrawler.BaseDatabaseConnectionOptions.getConnection(BaseDatabaseConnectionOptions.java:89)
    ... 5 more
如果指定-password,则会出现相同的错误,并且为-user指定不同的值也会出现相同的错误。Sqlite不需要用户/密码-为什么jdbc或schemacrawler要我输入一个

增编:

下面是一系列特定的命令,这些命令创建一个简单的数据库,然后尝试使用schemacrawler对其进行图解:

bash-3.2$ sqlite3 MyApp.db
sqlite3 MyApp.db
SQLite version 3.7.12 2012-04-03 19:43:07
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> create table smbtest(col1 integer, col2 integer);
create table smbtest(col1 integer, col2 integer);
sqlite> ^D 
bash-3.2$ ~/bin/sunjava -classpath lib/*:. schemacrawler.tools.sqlite.Main -database=MyApp.db -infolevel=maximum -command=graph -outputformat=pdf -outputfile=myapp.pdf
SchemaCrawler 10.5
Copyright (c) 2000-2013, Sualeh Fatehi.

SchemaCrawler is a database schema discovery and comprehension tool. 
You can search for database schema objects using regular expressions, 
and output the schema and data in a readable text format. You can find 
potential schema design issues with lint. The output serves for 
database documentation is designed to be diff-ed against other database 
schemas. SchemaCrawler also generates schema diagrams.
password: 

Graphviz was not available to create the requested graph. Please reinstall 
Graphviz, and make it available on the system PATH. Meanwhile, a .dot text file 
has been created instead. This .dot file can be opened in any Graphviz file 
viewer.
java.io.IOException: Cannot run program "dot": error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1041)
at schemacrawler.tools.integration.graph.ProcessExecutor.execute(ProcessExecutor.java:124)
at schemacrawler.tools.integration.graph.GraphGenerator.generateDiagram(GraphGenerator.java:87)
at schemacrawler.tools.integration.graph.GraphExecutable.executeOn(GraphExecutable.java:123)
at schemacrawler.tools.executable.SchemaCrawlerExecutable.executeOn(SchemaCrawlerExecutable.java:87)
at schemacrawler.tools.executable.BaseExecutable.execute(BaseExecutable.java:77)
at schemacrawler.tools.commandline.SchemaCrawlerCommandLine.execute(SchemaCrawlerCommandLine.java:176)
at schemacrawler.tools.commandline.SchemaCrawlerMain.main(SchemaCrawlerMain.java:93)
at schemacrawler.tools.commandline.SchemaCrawlerMain.main(SchemaCrawlerMain.java:52)
at schemacrawler.tools.sqlite.Main.main(Main.java:43)
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:135)
at java.lang.ProcessImpl.start(ProcessImpl.java:130)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1022)
... 9 more
bash-3.2$sqlite3 MyApp.db
sqlite3 MyApp.db
SQLite版本3.7.12 2012-04-03 19:43:07
输入“.help”以获取说明
输入以“;”结尾的SQL语句
sqlite>创建表smbtest(col1整数,col2整数);
创建表smbtest(col1整数、col2整数);
sqlite>^D
bash-3.2$~/bin/sunjava-classpath lib/*:。schemacrawler.tools.sqlite.Main-database=MyApp.db-infolevel=maximum-command=graph-outputformat=pdf-outputfile=MyApp.pdf
SchemaCrawler 10.5
版权所有(c)2000-2013,Sualeh Fatehi。
SchemaCrawler是一种数据库模式发现和理解工具。
可以使用正则表达式搜索数据库架构对象,
并以可读文本格式输出模式和数据。你可以找到
lint潜在的模式设计问题。输出用于
数据库文档旨在与其他数据库文档进行区分
模式。SchemaCrawler还生成模式图。
密码:
Graphviz无法创建请求的图形。请重新安装
Graphviz,并使其在系统路径上可用。同时,一个.dot文本文件
而是创建了。此.dot文件可以在任何Graphviz文件中打开
观众
java.io.IOException:无法运行程序“点”:错误=2,没有这样的文件或目录
位于java.lang.ProcessBuilder.start(ProcessBuilder.java:1041)
位于schemacrawler.tools.integration.graph.ProcessExecutor.execute(ProcessExecutor.java:124)
位于schemacrawler.tools.integration.graph.GraphGenerator.generateDiagram(GraphGenerator.java:87)
位于schemacrawler.tools.integration.graph.GrapherExecutable.executeOn(grapherExecutable.java:123)
位于schemacrawler.tools.executable.schemacrawlerexecuteon(SchemaCrawlerExecutable.java:87)
在schemacrawler.tools.executable.BaseExecutable.execute(BaseExecutable.java:77)
在schemacrawler.tools.commandline.SchemaCrawlerCommandLine.execute(SchemaCrawlerCommandLine.java:176)
位于schemacrawler.tools.commandline.SchemaCrawlerMain.main(SchemaCrawlerMain.java:93)
位于schemacrawler.tools.commandline.SchemaCrawlerMain.main(SchemaCrawlerMain.java:52)
位于schemacrawler.tools.sqlite.Main.Main(Main.java:43)
原因:java.io.IOException:error=2,没有这样的文件或目录
位于java.lang.UNIXProcess.forkAndExec(本机方法)
位于java.lang.UNIXProcess(UNIXProcess.java:135)
在java.lang.ProcessImpl.start(ProcessImpl.java:130)
位于java.lang.ProcessBuilder.start(ProcessBuilder.java:1022)
... 9更多
最后结论: 问题在于,我的数据库的路径中有一个空间;反斜杠、双引号或单引号或两者都不能解决问题。从与我的db文件相同的目录中运行该命令就做到了这一点。空间问题可能是因为我不理解在bash中使用的正确转义序列-如果schemacrawler在命令行中使用我的名字生成其他进程,我可能必须加倍转义空间


但是,该应用程序确实继续请求输入我的密码,但只需按enter键即可成功继续。

我认为您没有正确指定
-classpath
。我认为您需要一个围绕该命令的包装shell脚本来扩展
lib
中的每个
.jar
,以便用
字符分隔:

#!/bin/sh

classpath="."

for j in lib/*.jar
do
    classpath=$classpath:$j
done

java -classpath $classpath schemacrawler.tools.sqlite.Main /Library/Application\ Support/MyApp/Data/MyApp.db -command="select count(*) from myTable" -infolevel=maximum
只是在黑暗中摸索,但我一直都是这样做的。显然,如果还必须包括非jar类路径,那么这会更加复杂…

Steve

您需要按如下方式指定数据库:

"-database=/Library/Application Support/MyApp/Data/MyApp.db"
请注意,双引号用于在数据库文件的路径中留出空间,以及-database命令行开关。我还删除了反斜杠,因为整个开关用双引号括起来

有关命令行的帮助,只需运行:

java -classpath lib/*:. schemacrawler.tools.sqlite.Main

Sualeh Fatehi,

使用SchemaCrawler生成DB模式ER图我们可以使用SchemaCrawler可视化我们的DB模式从这里下载最新的包:

复制_schemacrawler文件夹并将其重命名为schemacrawler到另一个位置,并将相同路径的目录路径添加到使用GraphViz创建架构图的路径中

将Cd放入schemacrawler目录,并使用下面提到的选项运行./schemacrawler.sh(在mac和UbuntuEnv上)

您可以运行sample命令以获取postgre db的png图像形式的架构图:

./schemacrawler.sh -command graph -outputformat png -outputfile=dh_er.png -loglevel=CONFIG -server=postgresql -host=localhost -port=5432 -database=testdb -user=testuser -password=testpass -infolevel=standard 
要包含/排除某些表,需要定义配置 以schemacrawler.config.properties为例:

schemacrawler.table.pattern.include=.*askbot_activityauditstatus |.*askbot_anonymousanswer|.*askbot_anonymousquestion |.*askbot_askwidget|.*askbot_badgedata|.*askbot_bulktagsubscription |.*askbot_bulktagsubscription_groups|.*askbot_bulktagsubscription_tags 
schemacrawler.table.pattern.exclude是键。相同的值是JAVA正则表达式模式

注意:如果您面临“服务:无法运行程序“点”:错误=2,没有这样的文件或目录”问题


我试过你的解决办法;不幸的是,它不起作用;我仍然得到它提示我输入密码,并最终得到关于空用户或无效用户的错误(如果我指定一个);不幸的是,它也不起作用。下面是我使用的命令:~/bin/sunjava-classpath lib/*:。schemacrawler.tools.sqlite.Main-database=“/Library/Application Support/MyApp/Data/MyApp.db”-infolevel=max-command=graph-outputformat=pdf-outputfile=carb.pdf(sunjava点
 Please install below(for mac only):
 Install the app : brew install graphviz