|
try{
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
Connection con=DriverMessage.getConnection("jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=DATABASENAME","USERNAME","PASSWORD");
PreparedStatement pstmt=con.prepareStatement(String sql);
pstmt.setString(1,firstValue);
pstmt.setString(2,secondValue);
..................
pstmt.setString(N,NthValue);
pstmt.execute();
}catch(Exception e){
out.println(e.getMessage());
} |
|