Integration Your Way - (800) 235-7250
RSSBus JDBC Driver for MSCRM
Questions / Feedback? Calling Stored Procedures

Calling Stored Procedures

Use the CallableStatement object to call stored procedures. To use a prepared statement establish a connection as described in Querying the Data. then create a CallableStatement, set the parameter(s) , and execute it.

Class.forName("rssbus.jdbc.mscrm.MSCRMDriver");
String connectionString = "user=myuseraccount;password=mypassword;URL=http://myserver/myOrgRoot;Offline=false;";
Connection conn = DriverManager.getConnection(connectionString);
CallableStatement cstmt = conn.prepareCall("Search");
cstmt.setString("Url", "http://mysite.com/MyOrgroot/XRMServices/2011/OrganizationData.svc/LeadSet");
boolean ret = cstmt.execute();   
if (!ret){
  int count=cstmt.getUpdateCount();
  if (count!=-1)
  {
    System.out.println(count+" rows are affected");
  }
}
else{
  ResultSet rs=cstmt.getResultSet();
  while(rs.next()){
    for(int i=1;i<=rs.getMetaData().getColumnCount();i++)
    {
      System.out.println(rs.getMetaData().getColumnName(i) +"="+rs.getString(i));
    }
  }
}


 
Copyright © 2013 RSSBus Inc.
[x] close

Questions / Feedback?


Name:
Email:
Feedback:
Send Feedback