我必須將數據庫連接到java程序。我在OS X 10.7.4上使用了帶有Eclipse Helios和SQLExplorer插件的HSQLDB。使用hsqldb創建連接
這是runServer.sh文件的內容:
#!/bin/bash
cd ../data
java -classpath ../lib/hsqldb.jar org.hsqldb.server.Server -database.0 file:mantenimiento -dbname.0 mantenimiento
你可以找到它:
http://i45.tinypic.com/jfw6tw.png
當我執行腳本,這是我得到什麼:
MacBook-Pro-de-Luis:bin luis$ ./runServer.sh
: No such file or directory ../data
[[email protected]]: [Thread[main,5,main]]: checkRunning(false) entered
[[email protected]]: [Thread[main,5,main]]: checkRunning(false) exited
[[email protected]]: Startup sequence initiated from main() method
[[email protected]]: Could not load properties from file
[[email protected]]: Using cli/default properties only
[[email protected]]: Initiating startup sequence...
[[email protected]]: Server socket opened successfully in 7 ms.
] opened sucessfully in 505 ms.dex=0, id=0, db=file:mantenimiento, alias=mantenimiento
[[email protected]]: Startup sequence completed in 513 ms.
[[email protected]]: 2012-05-18 10:54:51.396 HSQLDB server 2.2.8 is online on port 9001
[[email protected]]: To close normally, connect and execute SHUTDOWN SQL
[[email protected]]: From command line, use [Ctrl]+[C] to abort abruptly
我有cd ../data問題,然後它創建數據庫並說它的工作,但它創建在/ bin而不是在/數據。
當我嘗試reate的conexion在Eclipse中使用SQLExplorer視窗我得到這個:
http://i45.tinypic.com/21d3cl2.png
和端子說:
[[email protected]]: [Thread[HSQLDB Connection @60f47bf5,5,HSQLDB Connections @6016a786]]: database alias=mantenimiento does not exist
任何人都知道我在做什麼錯?
謝謝。
但我不明白這個問題。當我這樣做的時候: MacBook-Pro-de-Luis:bin luis $ cd ../data MacBook-Pro-de-Luis:data luis $ 它的工作原理。 – Cebado