I need to call a stored procedure using dblink and Java, I've got this code calling the stored procedure with jdbc, but now I need to do the same call using dblink
this is the call using JDBC
String sqlQuery = "{ CALL ACCUMULATED.GENERAR_ACUMULATED (?,?,?) }";
DatabaseConnection connection = new DatabaseConnection();
try {
int[] returnSQLTypes = { Types.VARCHAR };
Object[] returnValues = null;
List args = new ArrayList();
args.add(this.getCompanyCodeNgsoft(companyCode));
args.add(codUsuario);
args.add("S");
connection.connect(DatabaseConnection.NGSOFT_DATA_SOURCE_NAME);
returnValues = connection.executeStoreProcedure(sqlQuery, args,
returnSQLTypes);
String swSuccessful = (String) returnValues[0];
if ((swSuccessful != null)
&& swSuccessful.trim().equalsIgnoreCase("S")) {
successful = true;
} else {
successful = false;
}
} catch (SQLException ex) {
throw new GenerateInterfacesException(getMessageFac().getMessage(
ex.getErrorCode()));
} finally {
try {
connection.disconnect();
} catch (SQLException ex1) {
throw new GenerateInterfacesException(getMessageFac()
.getMessage(ex1.getErrorCode()));
}
}
thanks
通过数据库链接调用存储过程应该像在存储过程之后添加@
符号和数据库链接名称一样简单,例如:
String sqlQuery = "{ CALL ACCUMULATED.GENERAR_ACUMULATED@your_db_link_name(?,?,?) }";
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.