DBPylon is a Java-based gateway between a private database and a remote application.

- You have a project that the
DBneeds to be in thecloud. - You check on some
PaaS providers, and saw someFree instances. - You registered and found out that the Free instances were
really slow. - So, you decided to just use instances for your DB and
deploythe Applocally. - But then, you realized that the only way you can get data from your PaaS was through
port-forwarding. - So, you ask yourself "What if there was like a
gatewaythat could pass data fromApp to DBand vice-versa?".
- Apache Tomcat 6.0
- JBoss 6.0
- RedHat OpenShift
- Download the
sourcefrom themasterbranch here. Importthe Project toEclipse.- Configure the
Build Path. - Add needed
External JARsand libraries from theWebContent/WEB-INFfolder. - Configure
MySQLDB.javawith the correct details of your private MySQL Database. - Right-click on the Project Folder and
Export as WAR File.
DB Type ID refers to the ID passed to the client as a parameter. Currently, the only supported database is MySQL.
- MySQL = 1
PylonClient(String SERVER_URL,
int DB_TYPE_ID,
String DB_NAME,
String USERNAME,
String PASSWORD
)
// Example:
PylonClient client = new PylonClient(
"http://localhost:8080/tmp/PylonController?",
DatabaseMapping.DB_MYSQL,
"sqlgateway",
"Test1",
"Test1"
);INSERT INTO branches (Name, BranchID, Details) VALUES ('Magallanes', 44, 'None');public static void mySQLInsert() {
PylonClient client = new PylonClient(
"http://localhost:8080/tmp/PylonController?",
DatabaseMapping.DB_MYSQL,
"sqlgateway",
"Test1",
"Test1"
);
String[] columnsAndValues = {
"Name='Magallanes'",
"BranchID=44",
"Details='None'"
};
boolean success = client.executeMySQLInsert("branches", columnsAndValues);
System.out.println(success);
}SELECT * FROM items;public static void mySQLSelect() {
PylonClient client = new PylonClient(
"http://localhost:8080/tmp/PylonController?",
DatabaseMapping.DB_MYSQL,
"sqlgateway",
"Test1",
"Test1"
);
List<Map<String, SimpleEntry<String, String>>> items = client
.executeMySQLSelect(
"items",
"SELECT * FROM items"
);
System.out.println(items.toString());
}UPDATE items SET Name='Keyboard', Price = 100 WHERE Price < 150 AND Deleted = false;public static void mySQLUpdate() {
PylonClient client = new PylonClient(
"http://localhost:8080/tmp/PylonController?",
DatabaseMapping.DB_MYSQL,
"sqlgateway",
"Test1",
"Test1"
);
String[] columnsAndValues = {
"Name='Keyboard'",
"Price = 100"
};
String[] conditions = {
"Price < 150",
"Deleted = false"
};
boolean success = client.executeMySQLUpdate(
"items",
columnsAndValues,
conditions
);
System.out.println(success);
}DELETE FROM sales WHERE SaleID = 1417419495515 AND Name = 'Pencil';public static void mySQLDelete() {
PylonClient client = new PylonClient(
"http://localhost:8080/tmp/PylonController?",
DatabaseMapping.DB_MYSQL,
"sqlgateway",
"Test1",
"Test1"
);
String[] conditions = {
"SaleID = 1417419495515",
"Name = 'Pencil'"
};
boolean success = client.executeMySQLDelete(
"sales",
conditions
);
System.out.println(success);
}public static void mySQLGetColumnList() {
PylonClient client = new PylonClient(
"http://localhost:8080/tmp/PylonController?",
DatabaseMapping.DB_MYSQL,
"sqlgateway",
"Test1",
"Test1"
);
List<String> columnList = client.executeMySQLGetColumns("branches");
System.out.println(columnList.toString());
}