mysql__jdbcストレージ・プロシージャ
興味があれば、QQ:2453058557を追加してください.
mysql
“delimiter //” “//”, mysql “;”
Connection conn = null;
Statement s =null;
ResultSet rs = null;
try {
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/mysql" ,"root","123");
String call="{call proid(?)}"; //
CallableStatement proc=conn.prepareCall(call); //
// proc.setString(1,"12345678"); //
proc.registerOutParameter(1,Types.VARCHAR ); //
proc.execute(); //
String address=proc.getString(1); //
p(address);
} catch (SQLException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}finally{
try {
rs.close();
s.close();
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
public static void p(String s){
System.out.print(s);
}
public static void p(int s){
System.out.print(s);
}