使用MyEclipse Database Explorer建立Derby connection時遇見的問題

日前想要透過MyEclipse Database Explorer,使用EmbeddedDriver建立Derby的connection遇見一個問題。

透過MyEclipse Database Explorer,使用EmbeddedDriver建立Derby的connection時,Derby的屬性:derby.system.home={ECLIPSE_HOME}, 因此db就被建立在{ECLIPSE_HOME}之中,例如我的設定是在"C:\_Workspace\eclipse"。

若想要改變建立
db的位置,就必須設定derby.system.home, 而這個屬性有兩種方法可以設定:

1. 啟動Derby時,用JVM的command line指定:java org.apache.derby.tools.ij -Dderby.system.home={DB LOCATION}。
備註:這個指令當然是需要derbytools.jar在classpath才能執行。

2. 在程式中DriverManager.getConnection()之前,先用System.setProperty("derby.system.home",
{DB LOCATION})。

而這兩種方法都無法在MyEclipse Database Explorer建立connection時使用,因此目前若要使用MyEclipse Database Explorer建立Derby的connection,只能用Network Server configuration。

若有先進知道「MyEclipse Database Explorer用EmbeddedDriver建立Derby的connection時,如何指定derby.system.home」,請不吝賜教。

0 意見: