public static void main(String[] args) {
Connection conn = null;
PreparedStatement pstmt = null;
String bitValue = "000";
try {
Class.forName("com.highgo.database.mysql.MySQLMigration");
String url = "jdbc:mysql://" + host + ":" + port + "/" + server;
conn = DriverManager.getConnection(url, userName,passwd);
pstmt = conn.prepareStatement("insert into test.test_bit values (?,?)");
pstmt.setObject(1, 1);
pstmt.setObject(2, Integer.valueOf(bitValue,2));
int count = pstmt.executeUpdate();
} catch (Exception e) {
e.printStackTrace();
}finally {
try {
if (pstmt != null) {
pstmt.close();
}
} catch (SQLException e) {
e.printStackTrace(System.out);
}
try {
if (conn != null) {
conn.close();
}
} catch (SQLException e) {
e.printStackTrace(System.out);
}
}
}