2010-07-14 49 views
0

我想从我的xyz.java文件将光标作为IN参数传递给存储过程。 我正在使用spring和hibernate。 你能帮我解决这个问题吗? 急需。很快回复。如何将光标作为IN参数传递给存储过程

如果不能通过,那么你可以帮助一些方案。

谢谢。

+4

您正在使用什么数据库,为什么在世界上你想光标传递到存储过程,你有什么去做? – 2010-07-14 12:06:23

回答

0

使用Spring工具和调用存储过程..

enter code here : public class MyStoredProcedure extends StoredProcedure { 

public MyStoredProcedure(){ 
} 
public MyStoredProcedure(DataSource ds) { 
    this.setDataSource(ds); 
    this.setSql("procedure name"); 
    this.declareParameter(new SqlParameter("param", Types.VARCHAR)); 
    this.compile(); 
} 

public void callProcedure() { 
    Map<String, String> inParams = new HashMap<String, String>(); 
    inParams.put("param", "Good"); 
    try { 
     execute(inParams); 
    } catch (Exception e) { 
     System.out.println("Error Man : " + e); 
    } 
} 


public static void main(String[] args) { 
    DriverManagerDataSource dataSource new DriverManagerDataSource("Driver", "url", "uname", "upass"); 
    try{ 
    MyStoredProcedure procedure = new MyStoredProcedure(dataSource); 
    procedure.callProcedure(); 
    }catch(Exception exception){ 
     System.out.println("Eroooorrror : "+exception); 
    } 
} 

}

相关问题