use of org.apache.derby.drda.NetworkServerControl in project midpoint by Evolveum.
the class DerbyController method start.
public void start() throws Exception {
LOGGER.info("Starting Derby embedded network server " + listenHostname + ":" + listentPort + ", database " + dbName);
listenAddress = InetAddress.getByName(listenHostname);
jdbcUrl = "jdbc:derby:" + dbName + ";create=true;user=" + username + ";password=" + password;
server = new NetworkServerControl(listenAddress, listentPort);
System.setProperty("derby.stream.error.file", "target/derby.log");
server.start(null);
}
use of org.apache.derby.drda.NetworkServerControl in project beam by apache.
the class JdbcIOTest method startDatabase.
@BeforeClass
public static void startDatabase() throws Exception {
ServerSocket socket = new ServerSocket(0);
port = socket.getLocalPort();
socket.close();
LOG.info("Starting Derby database on {}", port);
System.setProperty("derby.stream.error.file", "target/derby.log");
derbyServer = new NetworkServerControl(InetAddress.getByName("localhost"), port);
StringWriter out = new StringWriter();
derbyServer.start(new PrintWriter(out));
boolean started = false;
int count = 0;
// networks where the DNS lookups are slow, this may take a little time
while (!started && count < 30) {
if (out.toString().contains("started")) {
started = true;
} else {
count++;
Thread.sleep(500);
try {
derbyServer.ping();
started = true;
} catch (Throwable t) {
//ignore, still trying to start
}
}
}
dataSource = new ClientDataSource();
dataSource.setCreateDatabase("create");
dataSource.setDatabaseName("target/beam");
dataSource.setServerName("localhost");
dataSource.setPortNumber(port);
JdbcTestDataSet.createReadDataTable(dataSource);
}
use of org.apache.derby.drda.NetworkServerControl in project tomee by apache.
the class DerbyNetworkService method start.
@Override
public void start() throws ServiceException {
if (this.disabled) {
return;
}
try {
this.serverControl = new NetworkServerControl(host, port);
this.serverControl.start(new LoggingPrintWriter("Derby"));
if (verbose) {
LOGGER.info("Starting openejb-derbynet with derby " + serverControl.getRuntimeInfo() + " " + serverControl.getSysinfo());
}
} catch (Exception e) {
throw new ServiceException(e);
}
}
use of org.apache.derby.drda.NetworkServerControl in project ocvn by devgateway.
the class DatabaseConfiguration method derbyServer.
/**
* Graciously starts a Derby Database Server when the application starts up
*
* @return
* @throws Exception
*/
@Bean(destroyMethod = "shutdown")
public NetworkServerControl derbyServer() throws Exception {
Properties p = System.getProperties();
p.put("derby.storage.pageCacheSize", "30000");
p.put("derby.language.maxMemoryPerTable", "20000");
NetworkServerControl nsc = new NetworkServerControl(InetAddress.getByName("localhost"), derbyPort);
nsc.start(new PrintWriter(java.lang.System.out, true));
return nsc;
}
Aggregations