我需要使用dblink和Java调用存储过程,我已经使用jdbc调用存储过程,但现在我需要使用dblink执行相同的调用
这是使用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()));
}
}
感谢
答案 0 :(得分:1)
通过数据库链接调用存储过程应该像在存储过程之后添加@
符号和数据库链接名一样简单,例如:
String sqlQuery = "{ CALL ACCUMULATED.GENERAR_ACUMULATED@your_db_link_name(?,?,?) }";