Created
December 7, 2010 12:38
-
-
Save edeustace/731752 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.sql.*; | |
public class Runner | |
{ | |
public static void main( String[] args ) | |
{ | |
System.out.println("hello"); | |
runProcedure(); | |
} | |
private static void runProcedure() | |
{ | |
Connection con = null; | |
CallableStatement proc_stmt = null; | |
ResultSet rs = null; | |
try { | |
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); | |
con = DriverManager.getConnection("jdbc:sqlserver://XXXXX", "XXX", "XXXX"); | |
proc_stmt = con.prepareCall("{ call CopyDB(?,?) }"); | |
//proc_stmt.setInt(1, 1); | |
//proc_stmt.setInt(2, 2); | |
proc_stmt.setString(1, "EMR"); | |
proc_stmt.setString(2, "EMR_test"); | |
proc_stmt.executeQuery(); | |
} catch (ClassNotFoundException ex) { | |
ex.printStackTrace(); | |
} catch ( SQLException ex) { | |
ex.printStackTrace(); | |
} finally { | |
try { | |
//rs.close(); | |
proc_stmt.close(); | |
con.close(); | |
} catch (SQLException ex) { | |
ex.printStackTrace(); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment