Created
March 16, 2015 23:30
-
-
Save ramn/cc3f966d2a3bbb88748d to your computer and use it in GitHub Desktop.
Start / connect to Derby example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// scala -cp $HOME/lib/derby-10.11.1.1.jar:$HOME/lib/derbyclient-10.11.1.1.jar:$HOME/lib/derbynet-10.11.1.1.jar | |
import org.apache.derby.drda.NetworkServerControl | |
import java.net.InetAddress | |
import java.sql.DriverManager | |
val server = new NetworkServerControl(InetAddress.getByName("localhost"),1527) | |
server.start(new java.io.PrintWriter(Console.out)) // here we direct logging to stdout | |
// To create and connect to a db in the same jvm: | |
val conn = DriverManager.getConnection("jdbc:derby:memory:test;create=true") | |
// To connect over the network, from another process; | |
val conn = DriverManager.getConnection("jdbc:derby://localhost:1527/memory:test") | |
// To start a standalone database, on port 1527: | |
// java -cp $HOME/lib/derby-10.11.1.1.jar:$HOME/lib/derbynet-10.11.1.1.jar org.apache.derby.drda.NetworkServerControl start -noSecurityManager |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment