public class ClientStandalone {

	private static final String DRIVER = "org.mariadb.jdbc.Driver";   
	private static final String URL = "jdbc:mariadb://127.0.0.1:3306";
	private static final String USER = "root";
	private static final String PASSWORD = "*******";

	private static Connection getConnection(final String driver, final String url, final String user,
			final String password) throws SQLException {
		try {
			Class.forName(driver);
		} catch (final ClassNotFoundException e) {
			throw new SQLException(e.getMessage());
		}
		return DriverManager.getConnection(url, user, password);
	}

	private static void executeQuery(final Connection connection, final String sql, final List<Object> params)
			throws SQLException {

		System.out.println("Executing query: " + sql);
		PreparedStatement pstmt = null;
		ResultSet rs = null;

		try {
			int paramIndex = 1;
			pstmt = connection.prepareStatement(sql);
			final ParameterMetaData pmd = pstmt.getParameterMetaData();
			//
			final int count = pmd.getParameterCount();
			for (final Object param : params) {
				pstmt.setObject(paramIndex++, param);
			}
			rs = pstmt.executeQuery();
			final int columnCount = rs.getMetaData().getColumnCount();
			while (rs.next()) {
				for (int i = 1; i <= columnCount; i++) {
					System.out.print("\t" + rs.getObject(i));
				}
				System.out.println();
			}
		} catch (final SQLException e) {
			throw e;
		} finally {
			if (rs != null) {
				try {
					rs.close();
				} catch (final SQLException e) {
					e.printStackTrace();
				}
			}

			if (pstmt != null) {
				try {
					pstmt.close();
				} catch (final SQLException e) {
					e.printStackTrace();
				}
			}
		}
	}

	public static void main(final String[] args) throws Exception {
		Connection connection = null;
		try {
			connection = getConnection(DRIVER, URL, USER, PASSWORD);
			try {
				final String sql = "S1ELECT * from duala WHERE a = ?";
				executeQuery(connection, sql, Arrays.asList(new Object[] { 1 }));
			} catch (final SQLException e) {
				e.printStackTrace();
			}
		} finally {
			if (connection != null) {
				try {
					connection.close();
				} catch (final SQLException e) {
					e.printStackTrace();
				}
			}
		}

	}
}