String url = "jdbc:sqlserver://localhost:1433;databaseName=myDatabase";
String username = "myUsername";
String password = "myPassword";
Connection connection = DriverManager.getConnection(url, username, password);
connection.setAutoCommit(false);
Statement statement = connection.createStatement();
String sql = "INSERT INTO myTable (column1, column2) VALUES ('value1', 'value2')";
statement.executeUpdate(sql);
connection.commit();
connection.rollback();
connection.close();