0
我試圖遵循的方向來設置處女座的樣本項目greenpages(http://www.eclipse.org/virgo/documentation/greenpages-documentation-2.4.0.RELEASE/docs/html/ch02s03.html)「另一個進程鎖定」。當我執行數據腳本時,我得到一個異常。org.h2.jdbc.JdbcSQLException:數據庫可能已被使用:
數據庫啓動,像這樣:
start java -cp ";C:\Users\flowersj\.m2\repository\com\h2database\h2\1.3.161\h2-1.3.161.jar"
org.h2.tools.Server
插入,在這個線路出現故障時數據的腳本:
java -cp ";C:\Users\flowersj\.m2\repository\com\h2database\h2\1.3.161\h2-1.3.161.jar"
org.h2.tools.RunScript
-url jdbc:h2:tcp://localhost/~/greenpages-db/greenpages
-user greenpages -password pass -script db.sql
唯一的例外是:
Exception in thread "main" org.h2.jdbc.JdbcSQLException: Database may be already in use: "Locked by another process". Possible solutions: close all other connection(s); use the server mode [90020-161]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
at org.h2.message.DbException.get(DbException.java:169)
at org.h2.message.DbException.get(DbException.java:146)
at org.h2.store.FileLock.getExceptionAlreadyInUse(FileLock.java:435)
at org.h2.store.FileLock.lockFile(FileLock.java:332)
at org.h2.store.FileLock.lock(FileLock.java:128)
at org.h2.engine.Database.open(Database.java:539)
at org.h2.engine.Database.openDatabase(Database.java:219)
at org.h2.engine.Database.<init>(Database.java:214)
at org.h2.engine.Engine.openSession(Engine.java:56)
at org.h2.engine.Engine.openSession(Engine.java:159)
at org.h2.engine.Engine.createSessionAndValidate(Engine.java:138)
at org.h2.engine.Engine.createSession(Engine.java:121)
at org.h2.server.TcpServerThread.run(TcpServerThread.java:124)
at java.lang.Thread.run(Unknown Source)
at org.h2.engine.SessionRemote.done(SessionRemote.java:538)
at org.h2.engine.SessionRemote.initTransfer(SessionRemote.java:109)
at org.h2.engine.SessionRemote.connectServer(SessionRemote.java:373)
at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:267)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:110)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:94)
at org.h2.Driver.connect(Driver.java:72)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at org.h2.tools.RunScript.process(RunScript.java:312)
at org.h2.tools.RunScript.runTool(RunScript.java:140)
at org.h2.tools.RunScript.main(RunScript.java:68)
那麼,在這種情況下,數據庫很可能已經在使用,就像錯誤消息說... –