org.bsc.bean.DataBaseUtils Maven / Gradle / Ivy
package org.bsc.bean;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Types;
import org.bsc.util.Log;
/**
*
* Title: Bartolomeo Sorrentino Classi
*
* Class utility for db
*
* Copyright: Copyright (c) 2001
* Company: ITD
* @author Bartolomeo Sorrentino
* @version 1.0
*/
public class DataBaseUtils {
static final String CALLCMDWITHRESULT = "'{' ? = {0} ( {1} ) '}'";
static final String CALLCMD = "'{' CALL {0} ( {1} ) '}'";
/**
* call a stored procedure that return a Resultset
*
* the stored procedure must be designed for return a resultset
* and the input parameter must be only of IN type , the OUT and INOUT parameters
* are not currently supported.
*
*
*@param conn database connection
*@param name store procedure name
*@param params stored procedure parameter ( only IN parameter accepted )
*@return ResultSet
*/
public static ResultSet callStoredQuery( Connection conn, String name, Object[] params ) throws SQLException
{
try {
StringBuilder sb = new StringBuilder();
// BUILD THE STORED PROCEDURE PARAMETER LIST ( ?,?,...)
if( null!=params && params.length > 0 ) {
for( int i=0; i 0 ) {
int ordinal = 1;
for( int i=0; i 0 ) {
for( int i=0; i 0 ) {
for( int i=0; i
© 2015 - 2025 Weber Informatics LLC | Privacy Policy