java derby 网络模式,如何在网络服务器模式下启动derby并仍然获得嵌入式连接?...

I just want to know how I can start derby in network server mode and still be able to get an embedded connection?

Thank you.

解决方案

You need to launch Derby in "embedded server mode". If you are already using Derby in embedded mode, this can be enabled by providing the necessary files in your classpath, then specifying a handful of command line arguments when launching the application.

First make sure the following jars are in your application's runtime classpath.

derby.jar derbynet.jar

Then add the following command line options to the Java command used to launch your application. If the class files are missing, these options will have no effect.

-Dderby.drda.startNetworkServer=true

-Dderby.drda.portNumber=8011

I'm running Derby from within a servlet hosted by Tomcat, so I added these options to the catalina.bat file.

Start up your application and check the list of open network sockets.

netstat -an | find "8011"

You should now see Derby listening for connections on 8011. Its now possible to connect to the database using Derby's client driver (derbyclient.jar). The instructions at http://docs.oracle.com/javadb/10.3.3.0/adminguide/radminembeddedserverex.html cover this part pretty well.

It was hinted that running Derby in this mode may be discouraged. I don't believe that to be the case. Your application will continue to access the database using the embedded driver, while other software is now permitted access using the client driver.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值