Subject | CallableStatement questions |
---|---|
Author | Rick DeBay |
Post date | 2004-08-09T22:35:02Z |
OK, I'm probably doing something wrong. I'm getting the error (with
misspelling)(FB 1.5.1, JB RC4):
org.firebirdsql.jdbc.FBSQLException: You cannot getAutomcommit on an
unassociated closed connection.
Here's my code:
c = getConnection();
cstmt = c.prepareCall("EXECUTE PROCEDURE INVOICE_ALL_CLAIMS(?,?)");
cstmt.setString(1,invoice);
cstmt.setDate(2, sqlDate(closeDate) );
ResultSet rs = cstmt.executeQuery();
if ( rs.next() )
{
invoice_count = rs.getInt(1);
}
and my procedure:
CREATE PROCEDURE INVOICE_ALL_CLAIMS (
INVOICE_NO VARCHAR(10),
INVOICE_DT DATE)
returns (
INV_COUNT Integer)
AS
DECLARE VARIABLE ACCOUNT VARCHAR(15);
DECLARE VARIABLE PHARM DECIMAL(7,0);
BEGIN
FOR SELECT DISTINCT
ACCOUNTID,
SRVPROVID
FROM CLAIMSPAIDREVERSED
WHERE INVOICE IS NULL AND DATESBM <= :INVOICE_DT
INTO
:ACCOUNT,
:PHARM
DO BEGIN
INSERT INTO INVOICE (INVOICE_NO, ACCOUNT, PHARMACY)
VALUES (:INVOICE_NO, :ACCOUNT, :PHARM);
UPDATE CLAIMSPAIDREVERSED
SET INVOICE = :INVOICE_NO
WHERE
ACCOUNTID = :ACCOUNT AND SRVPROVID = :PHARM AND
INVOICE IS NULL AND DATESBM <= :INVOICE_DT;
END
SELECT COUNT(INVOICE) FROM CLAIMSPAIDREVERSED
WHERE INVOICE = :INVOICE_NO
INTO :INV_COUNT;
END
Should I call executeUpdate() instead of executeQuery? If I don't put
the row count into the OUT parameter, will executeUpdate still return
the number of rows affected? Instead of using a ResultSet, should I
call getInt() on the CallableStatement? Why did this error occur?
Thanks.
Rick DeBay
Senior Software Developer
RxStrategies.net
misspelling)(FB 1.5.1, JB RC4):
org.firebirdsql.jdbc.FBSQLException: You cannot getAutomcommit on an
unassociated closed connection.
Here's my code:
c = getConnection();
cstmt = c.prepareCall("EXECUTE PROCEDURE INVOICE_ALL_CLAIMS(?,?)");
cstmt.setString(1,invoice);
cstmt.setDate(2, sqlDate(closeDate) );
ResultSet rs = cstmt.executeQuery();
if ( rs.next() )
{
invoice_count = rs.getInt(1);
}
and my procedure:
CREATE PROCEDURE INVOICE_ALL_CLAIMS (
INVOICE_NO VARCHAR(10),
INVOICE_DT DATE)
returns (
INV_COUNT Integer)
AS
DECLARE VARIABLE ACCOUNT VARCHAR(15);
DECLARE VARIABLE PHARM DECIMAL(7,0);
BEGIN
FOR SELECT DISTINCT
ACCOUNTID,
SRVPROVID
FROM CLAIMSPAIDREVERSED
WHERE INVOICE IS NULL AND DATESBM <= :INVOICE_DT
INTO
:ACCOUNT,
:PHARM
DO BEGIN
INSERT INTO INVOICE (INVOICE_NO, ACCOUNT, PHARMACY)
VALUES (:INVOICE_NO, :ACCOUNT, :PHARM);
UPDATE CLAIMSPAIDREVERSED
SET INVOICE = :INVOICE_NO
WHERE
ACCOUNTID = :ACCOUNT AND SRVPROVID = :PHARM AND
INVOICE IS NULL AND DATESBM <= :INVOICE_DT;
END
SELECT COUNT(INVOICE) FROM CLAIMSPAIDREVERSED
WHERE INVOICE = :INVOICE_NO
INTO :INV_COUNT;
END
Should I call executeUpdate() instead of executeQuery? If I don't put
the row count into the OUT parameter, will executeUpdate still return
the number of rows affected? Instead of using a ResultSet, should I
call getInt() on the CallableStatement? Why did this error occur?
Thanks.
Rick DeBay
Senior Software Developer
RxStrategies.net