can anyone please help me on this? I am trying to execute a SQL query (to Microsoft SQL) using JAVA. But, nothing happens on my table. Also, no exception either. But i am pretty sure that this code directly connecting to my DB. Here's my code.
package Testing;
//import java.sql.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
public class TestingClass {
public static void main(String[] srg)
{
String driverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver"; // Start JDBC
String dbURL = "jdbc:sqlserver://localhost:1433;DatabaseName=OPERATIONS"; // Connect the server and the database
String userName="AppControlTeam";
String userPwd="*****";
//
Connection connection = null;
try{
Class.forName(driverName);
connection = DriverManager.getConnection(dbURL,userName,userPwd);
String sql = "DELETE FROM GFR_GROWTH_RATE";
PreparedStatement statement = connection.prepareStatement(sql);
statement.executeUpdate();
connection.close();
}
catch (Exception e){
e.printStackTrace();
}
}
}
I have been already added the JDBC driver on the package. Also, i'm pretty sure that this is not a classpath issue since the connection to DB thru this code is already success.
Thanks in advance to someone who can help! :D
-Jiro