Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rhildred/derbytest
derby openshift maven starting point
https://github.com/rhildred/derbytest
Last synced: 14 days ago
JSON representation
derby openshift maven starting point
- Host: GitHub
- URL: https://github.com/rhildred/derbytest
- Owner: rhildred
- Created: 2014-01-14T19:57:53.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2014-05-29T13:58:39.000Z (over 10 years ago)
- Last Synced: 2024-04-14T14:03:06.704Z (9 months ago)
- Language: Java
- Size: 445 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
derbytest
=========derbytest is an embedded derby database that can be hosted on openshift
features include:
- connects in the data directory so that database maintains state across commits
- migration script (using flyway) is raked on every push to openshiftAn example is ca.on.conestogac.Lab4.
package ca.on.conestogac;
import java.sql.*;
public class Lab4 {
public static void main(String[] args) {
//set these to be null so that we can finally close them
Connection connection = null;
Statement oStmt = null;
try{
//make a stmt from my SQL
connection = OpenShiftDerbySource.getConnection();
oStmt = connection.createStatement();
String sSQL = "SELECT * FROM PERSON";
ResultSet oRs = oStmt.executeQuery(sSQL);
System.out.println(ResultSetValue.toJsonString(oRs));
oRs.close();
}catch(Exception e){
e.printStackTrace();
}finally{
try{
if(oStmt != null) oStmt.close();
if(connection != null) connection.close();
}catch(Exception e){
e.printStackTrace();
}
}
}
}This is a simple select example that also makes use of a helper `ResultSetValue.toJsonString(oRs)`.