Using JDBC

jdbc
Next snippet shows using JDBC:

import java.sql.*;

public class DBConnect {

	public static void main(String[] args) {
		Connection conn = null;
		Statement stmtSelect = null;
		PreparedStatement stmtInsert = null;
		PreparedStatement stmtUpdate = null;
		PreparedStatement stmtDelete = null;
		Statement stmtBatchInsert = null;
		Statement stmtBatchUpdate = null;
		ResultSet rs = null;

		try {
			Class.forName("com.pointbase.jdbc.jdbcUniversalDriver");
			String connectionString = "jdbc:pointbase:server://localhost:9092/nameOfDB";
			conn = DriverManager.getConnection(connectionString, "PBPUBLIC",
					"PBPUBLIC");

			// add
			stmtInsert = conn
					.prepareStatement("insert into users "
							+ "(NAME, ADDRESS, USERNAME, PASSWORD, ACCESSLEVEL)"
							+ " values (?, ?, ?, ?, ?)");
			stmtInsert.setString(1, "Superman");
			stmtInsert.setString(2, "Earth");
			stmtInsert.setString(3, "spet");
			stmtInsert.setString(4, "123456");
			stmtInsert.setString(5, "0");
			int resInsert = stmtInsert.executeUpdate();
			System.out.println("resInsert: " + resInsert);
			
			// upd
			stmtUpdate =conn.prepareStatement("update users set ADDRESS = ? where name='Superman'", Statement.RETURN_GENERATED_KEYS);
			stmtUpdate.setString(1, "Mars");
			int resUpdate = stmtUpdate.executeUpdate();
			System.out.println("resUpdate: " + resUpdate);

			// del
			conn.setAutoCommit(false);
			stmtDelete = conn
					.prepareStatement("delete from users where name=?");
			stmtDelete.setString(1, "Superman");
			int resDelete = stmtDelete.executeUpdate();
			System.out.println("resDelete: " + resDelete);
			
			// batch insert
			stmtBatchInsert = conn.createStatement();
			stmtBatchInsert.addBatch("insert into users values ('User1', 'Earth', 'p1', '123456', 0)");
			stmtBatchInsert.addBatch("insert into users values ('User2', 'Earth', 'p2', '123456', 0)");
			stmtBatchInsert.addBatch("insert into users values ('User3', 'Earth', 'p3', '123456', 0)");
			conn.setAutoCommit(false);
			int[] resBatchInsert = stmtBatchInsert.executeBatch();
			System.out.println("resBatchInsert: " + resBatchInsert);
			conn.commit();
			
			// batch update
			stmtBatchUpdate = conn.createStatement();
			stmtBatchUpdate.addBatch("update users set ADDRESS = 'no 111' where userid = 129");
			stmtBatchUpdate.addBatch("update users set ADDRESS = 'no 222' where userid = 130");
			stmtBatchUpdate.addBatch("update users set ADDRESS = 'no 333' where userid = 131");
			conn.setAutoCommit(false);
			int[] resBatchUpdate = stmtBatchUpdate.executeBatch();
			System.out.println("resBatchUpdate: " + resBatchUpdate);
			conn.commit();

			// get
			stmtSelect = conn.createStatement();
			stmtSelect.setFetchSize(1);
			rs = stmtSelect.executeQuery("select * from users");
			while (rs.next()) {
				String s = rs.getString("NAME");
				System.out.println(s);
			}
			
			// stored proc
			CallableStatement callableStatement = conn.prepareCall("{call CountAllOrdersSum(?, ?)}");
			callableStatement.setString(1, "In Progress"); 
			callableStatement.registerOutParameter(2, java.sql.Types.DOUBLE);
			callableStatement.execute();
		    double resCall = callableStatement.getDouble(2);
		    System.out.println("resCall: " + resCall);
		    callableStatement.close();
			

		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		} catch (SQLException e) {
			e.printStackTrace();
			System.out.println(e.getSQLState());
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			try {
				rs.close();
			} catch (SQLException e) {
				e.printStackTrace();
			}
			try {
				stmtSelect.close();
			} catch (SQLException e) {
				e.printStackTrace();
			}
			try {
				stmtInsert.close();
			} catch (SQLException e) {
				e.printStackTrace();
			}
			try {
				stmtUpdate.close();
			} catch (SQLException e) {
				e.printStackTrace();
			}
			try {
				stmtDelete.close();
			} catch (SQLException e) {
				e.printStackTrace();
			}
			try {
				conn.rollback();
				conn.close();
			} catch (SQLException e) {
				e.printStackTrace();
			}
		}
	}
}

Don’t forget to add to classpass JDBC-driver for your database.
Also, see JDBC Home