Java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]COUNT field incor
hello
i am trying to call stored procedure from javabeans to SQL server database.
my stored procedure is.....
=========================================
CREATE PROCEDURE sp_ins_client1_defect
/* INSERTS defect AFTER GENERATING A NEW defectid
RETRUN VALUES -
1) -101 inser failed
2) 0 Successfull
@status tinyint,
@priority tinyint,
@complexity tinyint,
@type tinyint,
@desc varchar(50),
@sourcefile varchar(25),
@sourceloc varchar(100),
@testcasefile varchar(25),
@testcaseno char(5),
@step2reproduce text,
@comments text,
@prodver char(8),
@projid int,
@keyid int OUTPUT
AS
BEGIN TRAN
select @keyid=max(defectid) from defects where projectid=@projid
if @keyid is null
set @keyid =1
else
set @keyid=@keyid + 1
insert into defects (PROJECTID,DEFECTID,STATUSID,PRIORITYID,COMPLEXITYID,DEFECTTYPEID,DESCRIPTION,SOURCEFILENAME,SOURCELOCATION,TESTCASEFILENAME,TESTCASENUMBER,STEPS2REPRODUCE,COMMENTS,PRODUCTVERSION,VERSIONID)
values (@projid,@keyid,@status,@priority ,@complexity ,@type ,@desc ,@sourcefile,@sourceloc,@testcasefile,@testcaseno,@step2reproduce,@comments ,@prodver ,1)
IF @@error <> 0
BEGIN
ROLLBACK
return -101
END
ELSE
BEGIN
COMMIT
return 0
END
=========================================
my javabeans code snippets is as follows.
Connection con;
CallableStatement cstmt;
private static String theaddcall = "{ ? = call sp_ins_client1_defect ( ?,?,?,?,?,?,?,?,?,?,?,?,?,?,? )}";
con = DbUtil.getConnection("dts");
cstmt = con.prepareCall(theaddcall);
session.setAttribute("attack","akraman2");
cstmt.registerOutParameter( 1, java.sql.Types.VARCHAR ); //ret code
cstmt.setInt ( 2, getDefectstatus());
session.setAttribute("attack","2");
cstmt.setInt ( 3, priority );
cstmt.setInt ( 4, complexity);
cstmt.setInt ( 5, defecttype);
cstmt.setString( 6 ,desc);
cstmt.setString( 7, sourcefile);
session.setAttribute("attack","3");
cstmt.setString( 8, sourcefileloc );
cstmt.setString( 9, testcasefile );
session.setAttribute("attack","4");
cstmt.setString( 10, testcaseno );
cstmt.setString( 11, steps2rep );
cstmt.setString( 12, comments );
session.setAttribute("attack","5");
cstmt.setString( 13, prodver );
cstmt.setInt ( 14, projids );
cstmt.registerOutParameter(15, java.sql.Types.VARCHAR );
session.setAttribute("addd","1");
boolean result=cstmt.execute();
session.setAttribute("addd","2");
while (result=cstmt.getMoreResults()) {};
/* rest of the code is here */
if possible please solve there query.
From ShivNarayan
"{ ? = call sp_ins_client1_defect ( ?,?,?,?,?,?,?,?,?,?,?,?,?,?,? )}";When I count the about I get 16 '?' (one return and 15 args)
The stored proc only has 14 args and you only populate 14.
Similar Messages
-
Hi All,
I am getting the following error when i am running swing program. I have a large volume of data. My resultset is running upto 2 hours. after 2 hours process is stoped and i got the following error on console.I am using Swing and MS SQL Server 2000.
Exception :java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Unspecified error occurred on SQL Server. Connection may have been terminated by the server.
Exception :java.sql.SQLException: General error
GenerateAuditBatches.java sql 4 : select count(*) from tblTransaction where AuditID = 10001720 and ExcludedFromAudit = 'F' and SystemPricedFare = 'F'
Exception :java.sql.SQLException: Invalid handle
Exception :java.lang.Exception: Invalid handle [null] Database error code:0
GenerateAuditBatches.java sql 5 transactions : select tblTransaction.BatchID, tblTransaction.TransactionNumber, tblTransaction.PrimeDocumentNumber, tblTransaction.AgentIATACode, tblTransaction.NetRemitInd, tblTransaction.ITBTFare, tblTransaction.TourCode, tblTransaction.FareBasis, tblTransaction.TransactionCode, tblTransaction.TransactionCategory, tblTransaction.InternationalOrDomestic, tblTransaction.NumberOfSectors, tblTransaction.TransactionStatus, tblTransaction.TransactionStatusUserID, tblTransactionCRSCheck.FareCorrect, tblTransactionCRSCheck.TaxCorrect, tblTransactionCRSCheck.CommissionCorrect, tblTransactionCRSCheck.ContractRulesCorrect, tblTransactionCRSCheck.ContractID from tblTransaction left join tblTransactionCRSCheck on tblTransactionCRSCheck.AuditID = tblTransaction.AuditID and tblTransactionCRSCheck.TransactionNumber = tblTransaction.TransactionNumber where tblTransaction.AuditID = 10001720 and tblTransaction.ExcludedFromAudit = 'F' and tblTransaction.SystemPricedFare = 'F' order by tblTransaction.FareBasis
Exception :java.sql.SQLException: Invalid handle
java.lang.Exception: Invalid handle [null] Database error code:0
at com.select.auditlink.GenerateAuditBatches.batchTransactions(GenerateAuditBatches.java:966)
at com.select.auditlink.GenerateAuditBatches.batchAudit(GenerateAuditBatches.java:464)
at com.select.auditlink.GenerateAuditBatches.run(GenerateAuditBatches.java:169)
Exception :java.sql.SQLException: General error
java.lang.Exception: Invalid handle [null] Database error code:0
at com.select.auditlink.GenerateAuditBatches.batchTransactions(GenerateAuditBatches.java:966)
at com.select.auditlink.GenerateAuditBatches.batchAudit(GenerateAuditBatches.java:469)
at com.select.auditlink.GenerateAuditBatches.run(GenerateAuditBatches.java:169)
GenerateAuditBatches.java sql 4 : select count(*) from tblTransaction where AuditID = 10001720 and ExcludedFromAudit = 'F' and SystemPricedFare = 'F'
Exception :java.sql.SQLException: Invalid handle
Exception :java.lang.Exception: Invalid handle [null] Database error code:0
GenerateAuditBatches.java sql 5 transactions : select tblTransaction.BatchID, tblTransaction.TransactionNumber, tblTransaction.PrimeDocumentNumber, tblTransaction.AgentIATACode, tblTransaction.NetRemitInd, tblTransaction.ITBTFare, tblTransaction.TourCode, tblTransaction.FareBasis, tblTransaction.TransactionCode, tblTransaction.TransactionCategory, tblTransaction.InternationalOrDomestic, tblTransaction.NumberOfSectors, tblTransaction.TransactionStatus, tblTransaction.TransactionStatusUserID, tblTransactionCRSCheck.FareCorrect, tblTransactionCRSCheck.TaxCorrect, tblTransactionCRSCheck.CommissionCorrect, tblTransactionCRSCheck.ContractRulesCorrect, tblTransactionCRSCheck.ContractID from tblTransaction left join tblTransactionCRSCheck on tblTransactionCRSCheck.AuditID = tblTransaction.AuditID and tblTransactionCRSCheck.TransactionNumber = tblTransaction.TransactionNumber where tblTransaction.AuditID = 10001720 and tblTransaction.ExcludedFromAudit = 'F' and tblTransaction.SystemPricedFare = 'F' order by tblTransaction.FareBasis
Exception :java.sql.SQLException: Invalid handle
Exception :java.sql.SQLException: Connection is closed
GenerateAuditBatches.java sql 4 : select count(*) from tblTransaction where AuditID = 10001720 and ExcludedFromAudit = 'F' and SystemPricedFare = 'F'
java.lang.Exception: Invalid handle [null] Database error code:0
at com.select.auditlink.GenerateAuditBatches.batchTransactions(GenerateAuditBatches.java:966)
at com.select.auditlink.GenerateAuditBatches.batchAudit(GenerateAuditBatches.java:474)
at com.select.auditlink.GenerateAuditBatches.run(GenerateAuditBatches.java:169)
Exception :java.sql.SQLException: Invalid handle
Exception :java.lang.Exception: Invalid handle [null] Database error code:0
GenerateAuditBatches.java sql 5 transactions : select tblTransaction.BatchID, tblTransaction.TransactionNumber, tblTransaction.PrimeDocumentNumber, tblTransaction.AgentIATACode, tblTransaction.NetRemitInd, tblTransaction.ITBTFare, tblTransaction.TourCode, tblTransaction.FareBasis, tblTransaction.TransactionCode, tblTransaction.TransactionCategory, tblTransaction.InternationalOrDomestic, tblTransaction.NumberOfSectors, tblTransaction.TransactionStatus, tblTransaction.TransactionStatusUserID, tblTransactionCRSCheck.FareCorrect, tblTransactionCRSCheck.TaxCorrect, tblTransactionCRSCheck.CommissionCorrect, tblTransactionCRSCheck.ContractRulesCorrect, tblTransactionCRSCheck.ContractID from tblTransaction left join tblTransactionCRSCheck on tblTransactionCRSCheck.AuditID = tblTransaction.AuditID and tblTransactionCRSCheck.TransactionNumber = tblTransaction.TransactionNumber where tblTransaction.AuditID = 10001720 and tblTransaction.ExcludedFromAudit = 'F' and tblTransaction.SystemPricedFare = 'F' order by tblTransaction.FareBasis
Exception :java.sql.SQLException: Invalid handle
Exception :java.sql.SQLException: Connection is closed
GenerateAuditBatches.java sql 4 : select count(*) from tblTransaction where AuditID = 10001720 and ExcludedFromAudit = 'F' and SystemPricedFare = 'T'
Exception :java.sql.SQLException: Invalid handle
Exception :java.lang.Exception: Invalid handle [null] Database error code:0
GenerateAuditBatches.java sql 5 transactions : select tblTransaction.BatchID, tblTransaction.TransactionNumber, tblTransaction.PrimeDocumentNumber, tblTransaction.AgentIATACode, tblTransaction.NetRemitInd, tblTransaction.ITBTFare, tblTransaction.TourCode, tblTransaction.FareBasis, tblTransaction.TransactionCode, tblTransaction.TransactionCategory, tblTransaction.InternationalOrDomestic, tblTransaction.NumberOfSectors, tblTransaction.TransactionStatus, tblTransaction.TransactionStatusUserID, tblTransactionCRSCheck.FareCorrect, tblTransactionCRSCheck.TaxCorrect, tblTransactionCRSCheck.CommissionCorrect, tblTransactionCRSCheck.ContractRulesCorrect, tblTransactionCRSCheck.ContractID from tblTransaction left join tblTransactionCRSCheck on tblTransactionCRSCheck.AuditID = tblTransaction.AuditID and tblTransactionCRSCheck.TransactionNumber = tblTransaction.TransactionNumber where tblTransaction.AuditID = 10001720 and tblTransaction.ExcludedFromAudit = 'F' and tblTransaction.SystemPricedFare = 'T' order by tblTransaction.FareBasis
java.lang.Exception: Invalid handle [null] Database error code:0
at com.select.auditlink.GenerateAuditBatches.batchTransactions(GenerateAuditBatches.java:966)
at com.select.auditlink.GenerateAuditBatches.batchAudit(GenerateAuditBatches.java:419)
at com.select.auditlink.GenerateAuditBatches.run(GenerateAuditBatches.java:172)
java.lang.Exception: Invalid handle [null] Database error code:0
at com.select.auditlink.GenerateAuditBatches.batchTransactions(GenerateAuditBatches.java:966)
at com.select.auditlink.GenerateAuditBatches.batchAudit(GenerateAuditBatches.java:424)
at com.select.auditlink.GenerateAuditBatches.run(GenerateAuditBatches.java:172)
Exception :java.sql.SQLException: Invalid handle
Exception :java.sql.SQLException: Connection is closed
GenerateAuditBatches.java sql 4 : select count(*) from tblTransaction where AuditID = 10001720 and ExcludedFromAudit = 'F' and SystemPricedFare = 'T'
Exception :java.sql.SQLException: Invalid handle
Exception :java.lang.Exception: Invalid handle [null] Database error code:0
GenerateAuditBatches.java sql 5 transactions : select tblTransaction.BatchID, tblTransaction.TransactionNumber, tblTransaction.PrimeDocumentNumber, tblTransaction.AgentIATACode, tblTransaction.NetRemitInd, tblTransaction.ITBTFare, tblTransaction.TourCode, tblTransaction.FareBasis, tblTransaction.TransactionCode, tblTransaction.TransactionCategory, tblTransaction.InternationalOrDomestic, tblTransaction.NumberOfSectors, tblTransaction.TransactionStatus, tblTransaction.TransactionStatusUserID, tblTransactionCRSCheck.FareCorrect, tblTransactionCRSCheck.TaxCorrect, tblTransactionCRSCheck.CommissionCorrect, tblTransactionCRSCheck.ContractRulesCorrect, tblTransactionCRSCheck.ContractID from tblTransaction left join tblTransactionCRSCheck on tblTransactionCRSCheck.AuditID = tblTransaction.AuditID and tblTransactionCRSCheck.TransactionNumber = tblTransaction.TransactionNumber where tblTransaction.AuditID = 10001720 and tblTransaction.ExcludedFromAudit = 'F' and tblTransaction.SystemPricedFare = 'T' order by tblTransaction.FareBasis
Exception :java.sql.SQLException: Invalid handle
java.lang.Exception: Invalid handle [null] Database error code:0
Exception :java.sql.SQLException: Connection is closed
GenerateAuditBatches.java sql 4 : select count(*) from tblTransaction where AuditID = 10001720 and ExcludedFromAudit = 'F' and SystemPricedFare = 'T'
Exception :java.sql.SQLException: Invalid handle
Exception :java.lang.Exception: Invalid handle [null] Database error code:0
at com.select.auditlink.GenerateAuditBatches.batchTransactions(GenerateAuditBatches.java:966)
at com.select.auditlink.GenerateAuditBatches.batchAudit(GenerateAuditBatches.java:429)
at com.select.auditlink.GenerateAuditBatches.run(GenerateAuditBatches.java:172)
java.lang.Exception: Invalid handle [null] Database error code:0
at com.select.auditlink.GenerateAuditBatches.batchTransactions(GenerateAuditBatches.java:966)
at com.select.auditlink.GenerateAuditBatches.batchAudit(GenerateAuditBatches.java:434)
at com.select.auditlink.GenerateAuditBatches.run(GenerateAuditBatches.java:172)
GenerateAuditBatches.java sql 5 transactions : select tblTransaction.BatchID, tblTransaction.TransactionNumber, tblTransaction.PrimeDocumentNumber, tblTransaction.AgentIATACode, tblTransaction.NetRemitInd, tblTransaction.ITBTFare, tblTransaction.TourCode, tblTransaction.FareBasis, tblTransaction.TransactionCode, tblTransaction.TransactionCategory, tblTransaction.InternationalOrDomestic, tblTransaction.NumberOfSectors, tblTransaction.TransactionStatus, tblTransaction.TransactionStatusUserID, tblTransactionCRSCheck.FareCorrect, tblTransactionCRSCheck.TaxCorrect, tblTransactionCRSCheck.CommissionCorrect, tblTransactionCRSCheck.ContractRulesCorrect, tblTransactionCRSCheck.ContractID from tblTransaction left join tblTransactionCRSCheck on tblTransactionCRSCheck.AuditID = tblTransaction.AuditID and tblTransactionCRSCheck.TransactionNumber = tblTransaction.TransactionNumber where tblTransaction.AuditID = 10001720 and tblTransaction.ExcludedFromAudit = 'F' and tblTransaction.SystemPricedFare = 'T' order by tblTransaction.FareBasis
Exception :java.sql.SQLException: Invalid handle
Exception :java.sql.SQLException: Connection is closed
GenerateAuditBatches.java sql 4 : select count(*) from tblTransaction where AuditID = 10001720 and ExcludedFromAudit = 'F' and SystemPricedFare = 'F'
Exception :java.sql.SQLException: Invalid handle
Exception :java.lang.Exception: Invalid handle [null] Database error code:0
GenerateAuditBatches.java sql 5 transactions : select tblTransaction.BatchID, tblTransaction.TransactionNumber, tblTransaction.PrimeDocumentNumber, tblTransaction.AgentIATACode, tblTransaction.NetRemitInd, tblTransaction.ITBTFare, tblTransaction.TourCode, tblTransaction.FareBasis, tblTransaction.TransactionCode, tblTransaction.TransactionCategory, tblTransaction.InternationalOrDomestic, tblTransaction.NumberOfSectors, tblTransaction.TransactionStatus, tblTransaction.TransactionStatusUserID, tblTransactionCRSCheck.FareCorrect, tblTransactionCRSCheck.TaxCorrect, tblTransactionCRSCheck.CommissionCorrect, tblTransactionCRSCheck.ContractRulesCorrect, tblTransactionCRSCheck.ContractID from tblTransaction left join tblTransactionCRSCheck on tblTransactionCRSCheck.AuditID = tblTransaction.AuditID and tblTransactionCRSCheck.TransactionNumber = tblTransaction.TransactionNumber where tblTransaction.AuditID = 10001720 and tblTransaction.ExcludedFromAudit = 'F' and tblTransaction.SystemPricedFare = 'F' order by tblTransaction.FareBasis
Exception :java.sql.SQLException: Invalid handle
Exception :java.sql.SQLException: Connection is closedjava.lang.Exception: Invalid handle [null] Database error code:0
at com.select.auditlink.GenerateAuditBatches.batchTransactions(GenerateAuditBatches.java:966)
at com.select.auditlink.GenerateAuditBatches.batchAudit(GenerateAuditBatches.java:439)
at com.select.auditlink.GenerateAuditBatches.run(GenerateAuditBatches.java:172)
GenerateAuditBatches.java sql 4 : select count(*) from tblTransaction where AuditID = 10001720 and ExcludedFromAudit = 'F' and SystemPricedFare = 'F'
Exception :java.sql.SQLException: Invalid handle
Exception :java.lang.Exception: Invalid handle [null] Database error code:0
GenerateAuditBatches.java sql 5 transactions : select tblTransaction.BatchID, tblTransaction.TransactionNumber, tblTransaction.PrimeDocumentNumber, tblTransaction.AgentIATACode, tblTransaction.NetRemitInd, tblTransaction.ITBTFare, tblTransaction.TourCode, tblTransaction.FareBasis, tblTransaction.TransactionCode, tblTransaction.TransactionCategory, tblTransaction.InternationalOrDomestic, tblTransaction.NumberOfSectors, tblTransaction.TransactionStatus, tblTransaction.TransactionStatusUserID, tblTransactionCRSCheck.FareCorrect, tblTransactionCRSCheck.TaxCorrect, tblTransactionCRSCheck.CommissionCorrect, tblTransactionCRSCheck.ContractRulesCorrect, tblTransactionCRSCheck.ContractID from tblTransaction left join tblTransactionCRSCheck on tblTransactionCRSCheck.AuditID = tblTransaction.AuditID and tblTransactionCRSCheck.TransactionNumber = tblTransaction.TransactionNumber where tblTransaction.AuditID = 10001720 and tblTransaction.ExcludedFromAudit = 'F' and tblTransaction.SystemPricedFare = 'F' order by tblTransaction.FareBasis
Exception :java.sql.SQLException: Invalid handle
java.lang.Exception: Invalid handle [null] Database error code:0
at com.select.auditlink.GenerateAuditBatches.batchTransactions(GenerateAuditBatches.java:966)
at com.select.auditlink.GenerateAuditBatches.batchAudit(GenerateAuditBatches.java:444)
at com.select.auditlink.GenerateAuditBatches.run(GenerateAuditBatches.java:172)
Exception :java.sql.SQLException: Connection is closed
GenerateAuditBatches.java sql 4 : select count(*) from tblTransaction where AuditID = 10001720 and ExcludedFromAudit = 'F' and SystemPricedFare = 'F'
Exception :java.sql.SQLException: Invalid handle
Exception :java.lang.Exception: Invalid handle [null] Database error code:0
GenerateAuditBatches.java sql 5 transactions : select tblTransaction.BatchID, tblTransaction.TransactionNumber, tblTransaction.PrimeDocumentNumber, tblTransaction.AgentIATACode, tblTransaction.NetRemitInd, tblTransaction.ITBTFare, tblTransaction.TourCode, tblTransaction.FareBasis, tblTransaction.TransactionCode, tblTransaction.TransactionCategory, tblTransaction.InternationalOrDomestic, tblTransaction.NumberOfSectors, tblTransaction.TransactionStatus, tblTransaction.TransactionStatusUserID, tblTransactionCRSCheck.FareCorrect, tblTransactionCRSCheck.TaxCorrect, tblTransactionCRSCheck.CommissionCorrect, tblTransactionCRSCheck.ContractRulesCorrect, tblTransactionCRSCheck.ContractID from tblTransaction left join tblTransactionCRSCheck on tblTransactionCRSCheck.AuditID = tblTransaction.AuditID and tblTransactionCRSCheck.TransactionNumber = tblTransaction.TransactionNumber where tblTransaction.AuditID = 10001720 and tblTransaction.ExcludedFromAudit = 'F' and tblTransaction.SystemPricedFare = 'F' order by tblTransaction.FareBasis
Exception :java.sql.SQLException: Invalid handle
Exception :java.sql.SQLException: Connection is closed
GenerateAuditBatches.java sql 4 : select count(*) from tblTransaction where AuditID = 10001720 and ExcludedFromAudit = 'F' and SystemPricedFare = 'T'
java.lang.Exception: Invalid handle [null] Database error code:0
at com.select.auditlink.GenerateAuditBatches.batchTransactions(GenerateAuditBatches.java:966)
at com.select.auditlink.GenerateAuditBatches.batchAudit(GenerateAuditBatches.java:449)
at com.select.auditlink.GenerateAuditBatches.run(GenerateAuditBatches.java:172)
Exception :java.sql.SQLException: Invalid handle
Exception :java.lang.Exception: Invalid handle [null] Database error code:0
GenerateAuditBatches.java sql 5 transactions : select tblTransaction.BatchID, tblTransaction.TransactionNumber, tblTransaction.PrimeDocumentNumber, tblTransaction.AgentIATACode, tblTransaction.NetRemitInd, tblTransaction.ITBTFare, tblTransaction.TourCode, tblTransaction.FareBasis, tblTransaction.TransactionCode, tblTransaction.TransactionCategory, tblTransaction.InternationalOrDomestic, tblTransaction.NumberOfSectors, tblTransaction.TransactionStatus, tblTransaction.TransactionStatusUserID, tblTransactionCRSCheck.FareCorrect, tblTransactionCRSCheck.TaxCorrect, tblTransactionCRSCheck.CommissionCorrect, tblTransactionCRSCheck.ContractRulesCorrect, tblTransactionCRSCheck.ContractID from tblTransaction left join tblTransactionCRSCheck on tblTransactionCRSCheck.AuditID = tblTransaction.AuditID and tblTransactionCRSCheck.TransactionNumber = tblTransaction.TransactionNumber where tblTransaction.AuditID = 10001720 and tblTransaction.ExcludedFromAudit = 'F' and tblTransaction.SystemPricedFare = 'T' order by tblTransaction.FareBasis
Exception :java.sql.SQLException: Invalid handle
Exception :java.sql.SQLException: Connection is closed
GenerateAuditBatches.java sql 4 : select count(*) from tblTransaction where AuditID = 10001720 and ExcludedFromAudit = 'F' and SystemPricedFare = 'T'
java.lang.Exception: Invalid handle [null] Database error code:0
at com.select.auditlink.GenerateAuditBatches.batchTransactions(GenerateAuditBatches.java:966)
at com.select.auditlink.GenerateAuditBatches.batchAudit(GenerateAuditBatches.java:454)
at com.select.auditlink.GenerateAuditBatches.run(GenerateAuditBatches.java:172)
Exception :java.sql.SQLException: Invalid handle
Exception :java.lang.Exception: Invalid handle [null] Database error code:0
GenerateAuditBatches.java sql 5 transactions : select tblTransaction.BatchID, tblTransaction.TransactionNumber, tblTransaction.PrimeDocumentNumber, tblTransaction.AgentIATACode, tblTransaction.NetRemitInd, tblTransaction.ITBTFare, tblTransaction.TourCode, tblTransaction.FareBasis, tblTransaction.TransactionCode, tblTransaction.TransactionCategory, tblTransaction.InternationalOrDomestic, tblTransaction.NumberOfSectors, tblTransaction.TransactionStatus, tblTransaction.TransactionStatusUserID, tblTransactionCRSCheck.FareCorrect, tblTransactionCRSCheck.TaxCorrect, tblTransactionCRSCheck.CommissionCorrect, tblTransactionCRSCheck.ContractRulesCorrect, tblTransactionCRSCheck.ContractID from tblTransaction left join tblTransactionCRSCheck on tblTransactionCRSCheck.AuditID = tblTransaction.AuditID and tblTransactionCRSCheck.TransactionNumber = tblTransaction.TransactionNumber where tblTransaction.AuditID = 10001720 and tblTransaction.ExcludedFromAudit = 'F' and tblTransaction.SystemPricedFare = 'T' order by tblTransaction.FareBasis
Exception :java.sql.SQLException: Invalid handle
Exception :java.sql.SQLException: Connection is closed
GenerateAuditBatches.java sql 4 : select count(*) from tblTransaction where AuditID = 10001720 and ExcludedFromAudit = 'F' and SystemPricedFare = 'T'
java.lang.Exception: Invalid handle [null] Database error code:0
at com.select.auditlink.GenerateAuditBatches.batchTransactions(GenerateAuditBatches.java:966)
at com.select.auditlink.GenerateAuditBatches.batchAudit(GenerateAuditBatches.java:459)
at com.select.auditlink.GenerateAuditBatches.run(GenerateAuditBatches.java:172)
Exception :java.sql.SQLException: Invalid handle
Exception :java.lang.Exception: Invalid handle [null] Database error code:0
GenerateAuditBatches.java sql 5 transactions : select tblTransaction.BatchID, tblTransaction.TransactionNumber, tblTransaction.PrimeDocumentNumber, tblTransaction.AgentIATACode, tblTransaction.NetRemitInd, tblTransaction.ITBTFare, tblTransaction.TourCode, tblTransaction.FareBasis, tblTransaction.TransactionCode, tblTransaction.TransactionCategory, tblTransaction.InternationalOrDomestic, tblTransaction.NumberOfSectors, tblTransaction.TransactionStatus, tblTransaction.TransactionStatusUserID, tblTransactionCRSCheck.FareCorrect, tblTransactionCRSCheck.TaxCorrect, tblTransactionCRSCheck.CommissionCorrect, tblTransactionCRSCheck.ContractRulesCorrect, tblTransactionCRSCheck.ContractID from tblTransaction left join tblTransactionCRSCheck on tblTransactionCRSCheck.AuditID = tblTransaction.AuditID and tblTransactionCRSCheck.TransactionNumber = tblTransaction.TransactionNumber where tblTransaction.AuditID = 10001720 and tblTransaction.ExcludedFromAudit = 'F' and tblTransaction.SystemPricedFare = 'T' order by tblTransaction.FareBasis
Exception :java.sql.SQLException: Invalid handle
Exception :java.sql.SQLException: Connection is closed
GenerateAuditBatches.java sql 4 : select count(*) from tblTransaction where AuditID = 10001720 and ExcludedFromAudit = 'F' and SystemPricedFare = 'F'
Exception :java.sql.SQLException: Invalid handle
Exception :java.lang.Exception: Invalid handle [null] Database error code:0
java.lang.Exception: Invalid handle [null] Database error code:0
at com.select.auditlink.GenerateAuditBatches.batchTransactions(GenerateAuditBatches.java:966)
at com.select.auditlink.GenerateAuditBatches.batchAudit(GenerateAuditBatches.java:464)
at com.select.auditlink.GenerateAuditBatches.run(GenerateAuditBatches.java:172)
java.lang.Exception: Invalid handle [null] Database error code:0
at com.select.auditlink.GenerateAuditBatches.batchTransactions(GenerateAuditBatches.java:966)
at com.select.auditlink.GenerateAuditBatches.batchAudit(GenerateAuditBatches.java:469)
at com.select.auditlink.GenerateAuditBatches.run(GenerateAuditBatches.java:172)
GenerateAuditBatches.java sql 5 transactions : select tblTransaction.BatchID, tblTransaction.TransactionNumber, tblTransaction.PrimeDocumentNumber, tblTransaction.AgentIATACode, tblTransaction.NetRemitInd, tblTransaction.ITBTFare, tblTransaction.TourCode, tblTransaction.FareBasis, tblTransaction.TransactionCode, tblTransaction.TransactionCategory, tblTransaction.InternationalOrDomestic, tblTransaction.NumberOfSectors, tblTransaction.TransactionStatus, tblTransaction.TransactionStatusUserID, tblTransactionCRSCheck.FareCorrect, tblTransactionCRSCheck.TaxCorrect, tblTransactionCRSCheck.CommissionCorrect, tblTransactionCRSCheck.ContractRulesCorrect, tblTransactionCRSCheck.ContractID from tblTransaction left join tblTransactionCRSCheck on tblTransactionCRSCheck.AuditID = tblTransaction.AuditID and tblTransactionCRSCheck.TransactionNumber = tblTransaction.TransactionNumber where tblTransaction.AuditID = 10001720 and tblTransaction.ExcludedFromAudit = 'F' and tblTransaction.SystemPricedFare = 'F' order by tblTransaction.FareBasis
Exception :java.sql.SQLException: Invalid handle
Exception :java.sql.SQLException: Connection is closed
GenerateAuditBatches.java sql 4 : select count(*) from tblTransaction where AuditID = 10001720 and ExcludedFromAudit = 'F' and SystemPricedFare = 'F'
Exception :java.sql.SQLException: Invalid handle
Exception :java.lang.Exception: Invalid handle [null] Database error code:0
GenerateAuditBatches.java sql 5 transactions : select tblTransaction.BatchID, tblTransaction.TransactionNumber, tblTransaction.PrimeDocumentNumber, tblTransaction.AgentIATACode, tblTransaction.NetRemitInd, tblTransaction.ITBTFare, tblTransaction.TourCode, tblTransaction.FareBasis, tblTransaction.TransactionCode, tblTransaction.TransactionCategory, tblTransaction.InternationalOrDomestic, tblTransaction.NumberOfSectors, tblTransaction.TransactionStatus, tblTransaction.TransactionStatusUserID, tblTransactionCRSCheck.FareCorrect, tblTransactionCRSCheck.TaxCorrect, tblTransactionCRSCheck.CommissionCorrect, tblTransactionCRSCheck.ContractRulesCorrect, tblTransactionCRSCheck.ContractID from tblTransaction left join tblTransactionCRSCheck on tblTransactionCRSCheck.AuditID = tblTransaction.AuditID and tblTransactionCRSCheck.TransactionNumber = tblTransaction.TransactionNumber where tblTransaction.AuditID = 10001720 and tblTransaction.ExcludedFromAudit = 'F' and tblTransaction.SystemPricedFare = 'F' order by tblTransaction.FareBasis
Exception :java.sql.SQLException: Invalid handle
Exception :java.sql.SQLException: Connection is closed
GenerateAuditBatches.java sql 4 : select count(*) from tblTransaction where AuditID = 10001720 and ExcludedFromAudit = 'F' and SystemPricedFare = 'F'
java.lang.Exception: Invalid handle [null] Database error code:0
at com.select.auditlink.GenerateAuditBatches.batchTransactions(GenerateAuditBatches.java:966)
at com.select.auditlink.GenerateAuditBatches.batchAudit(GenerateAuditBatches.java:474)
at com.select.auditlink.GenerateAuditBatches.run(GenerateAuditBatches.java:172)
Exception :java.sql.SQLException: Invalid handle
Exception :java.lang.Exception: Invalid handle [null] Database error code:0
GenerateAuditBatches.java sql 5 transactions : select tblTransaction.BatchID, tblTransaction.TransactionNumber, tblTransaction.PrimeDocumentNumber, tblTransaction.AgentIATACode, tblTransaction.NetRemitInd, tblTransaction.ITBTFare, tblTransaction.TourCode, tblTransaction.FareBasis, tblTransaction.TransactionCode, tblTransaction.TransactionCategory, tblTransaction.InternationalOrDomestic, tblTransaction.NumberOfSectors, tblTransaction.TransactionStatus, tblTransaction.TransactionStatusUserID, tblTransactionCRSCheck.FareCorrect, tblTransactionCRSCheck.TaxCorrect, tblTransactionCRSCheck.CommissionCorrect, tblTransactionCRSCheck.ContractRulesCorrect, tblTransactionCRSCheck.ContractID from tblTransaction left join tblTransactionCRSCheck on tblTransactionCRSCheck.AuditID = tblTransaction.AuditID and tblTransactionCRSCheck.TransactionNumber = tblTransaction.TransactionNumber where tblTransaction.AuditID = 10001720 and tblTransaction.ExcludedFromAudit = 'F' and tblTransaction.SystemPricedFare = 'F' order by tblTransaction.FareBasis
Exception :java.sql.SQLException: Invalid handle
Exception :java.sql.SQLException: Connection is closed
GenerateAuditBatches.java sql 1 : update tblAudit set NumberOfBatches = 1078 where AuditID = 10001720
Exception :java.sql.SQLException: Invalid handle
Exception :java.sql.SQLException: Connection is closed
GenerateAuditBatches.java sql 12 query2 : select BatchID from tblAuditBatch where AuditID = 10001720
Exception :java.sql.SQLException: Invalid handle
Exception :java.lang.Exception: Invalid handle [null] Database error code:0
java.lang.Exception: Invalid handle [null] Database error code:0
at com.select.auditlink.GenerateAuditBatches.updateAuditBatches(GenerateAuditBatches.java:1427)
at com.select.auditlink.GenerateAuditBatches.run(GenerateAuditBatches.java:217)
GenerateAuditBatches.java sql 2 : update tblAudit set NumberOfAuditedBatches = ( select count(*) from tblAuditBatch where AuditID = 10001720 and NumberOfAuditedTransactions = NumberOfTransactions) where AuditID = 10001720
Exception :java.sql.SQLException: Invalid handle
Exception :java.sql.SQLException: Connection is closed
GenerateAuditBatches.java sql 3 : update tblAudit set NumberOfAuditedTransactions = ( select count(*) from tblTransaction where AuditID = 10001720 and Audited = 'T') where AuditID = 10001720
Exception :java.sql.SQLException: Invalid handle
Exception :java.sql.SQLException: Connection is closed
Exception :java.sql.SQLException: Connection is closed
Please give me suitable solution of this issue.
Thanks
Rajnish
Message was edited by:
rajnishsunjavajava.sql.SQLException: [Microsoft][ODBC Visual FoxPro Driver]File must be opened exclusively.
In the Visual Foxpro table, I saw no READ ONLY settings.And also, there are
no delete permission grants and there is no user database sesssion concept.
The ODBC DSN for MYTABLE is setup as:
- Free Tables (not database)
- Null (checked)
- Deleted (checked)If you're using Visual Foxpro database(.DBC), you should see "Exclusive" option too. You can try check it, but I don't know whether your issue will disappear. -
I'm stuck for 2 days.
Can anyone advise where I can find online/download what this error means when I run a jsp page to connect to SQL server?
java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Invalid Descriptor IndexHi!
I have found this post in another forum:
David,
I had a similar problem today, using the JDBC-ODBC driver to connect to
Microsoft SQL Server 7. Apparently the order in which you retrieve columns
can make a difference. I got this information from the following URL:
http://enhydra.enhydra.org/project/mailingLists/enhydra/199911/msg00110.htm
l
I tried it in my application and it worked. Changing:
result.setTitle(rs.getString("title"));
result.setProducer(rs.getString("producer"));
to:
result.setProducer(rs.getString("producer"));
result.setTitle(rs.getString("title"));
made the exception disapear and now my code works fine. I still dont know
exactly where the problem comes from.
Hope this helps.
Regards,
Geri -
Hi,
while running jsp page i m getting error as follows:
java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Connection is busy with results for another hstmt..
what is this error...
what should i do to solve this problem...
plz let me know what is this error & how to solve this...
Thanx in advance....Why don't you do a search in google with the excpetion?
If you cannot then try this link
[http://www.idssoftware.com/faq-e.html] -
in my project i wanted insert a date object to the database for that i am using PreparedStatement.setDate(fieldNum,dateObject), i tried out the code segmets and used the java.sql.date onject only but i am gettig the exception"java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Optional feature not implemented".see the code below which i used
String sql = "insert into debug (filing_date) values (?)";
PreparedStatement insertPS = dbConn.prepareStatement(sql);
String dateS = "2001-00-01"; //That's jan 1, 2001
java.sql.Date date = java.sql.Date.valueOf(dateS);
insertPS.setDate(1,date);
insertPS.executeUpdate();
@@@@@@@@@@@@ i tried using this way also to get into the real format "MMM d, yyy"but got the exceptoin this time also, the code is
MMM d, yyy format, which java.sql.Date doesn't accept: String dateIn = "January 1, 2001"; String formatIn = "MMM d, yyyy"; // format of incoming string
//parse the date using java.util.Date classes
ParsePosition pp = new ParsePosition(0);
SimpleDateFormat sdfi = new SimpleDateFormat(formatIn);
java.util.Date date = sdfi.parse(dateIn,pp);
if( date == null ) (throw new RuntimeException"Unparsable date: "+dateIn);
//convert a java.util.Date to a java.sql.Date
java.sql.Date sqlFromLong = new java.sql.Date(date.getTime());
//output is: 2001-01-01 System.out.println("sqlFromLong (java.sql.Date): "+sqlFromLong);
pls help me regardig this thanks in advance susanthSame question at the ranch...
http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=3&t=009727 -
Hi all,
I am able to INSERT and SELECT records from FoxPRo database successfully.
The driver is Sun JDBC-ODBC bridge
The DELETE statement throws no exception.
I've tried to execute PACK after the DELETE call and got following exception:
java.sql.SQLException: [Microsoft][ODBC Visual FoxPro Driver]File must be opened exclusively.So I tried USE MYTABLE EXCLUSIVE in a Statement before calling PACK and got the exception:
java.sql.SQLException: [Microsoft][ODBC Visual FoxPro Driver]Syntax error or access violationI've also tried inserting the USE MYTABLE EXCLUSIVE before calling DELETE but got the same exception above.
The ODBC DSN for MYTABLE is setup as:
- Free Tables (not database)
- Null (checked)
- Deleted (checked)
- Fetch data in background (checked)
I am not able to issue any of the following commands to FoxPro using java
OPEN - To open a table
CLOSE - To close a table
USE - To open a table for uer either in exclusive mode or shared mode
The exception being generated is :
java.sql.SQLException: [Microsoft][ODBC Visual FoxPro Driver]Syntax error or access violationThe help file of the Microsoft Visual Foxpro Driver states that the driver has support for the above commands.I a not able to get the way to issue the above commands to the driver using java.
In setting up the ODBC DSN I saw no "read only" setting.
In the Visual Foxpro table, I saw no READ ONLY settings.And also, there are no delete permission grants and there is no user database sesssion concept.
I've tried all of the above with DSN mapped to a database(NOT free tables) and setting AUTO-COMMIT OFF and AUTO-COMMIT ON.But in vain. The same exceptions as those stated above persisted.
Environment:
Microsoft Windows XP Professional
JDK version "1.4.2_09"
Microsoft Visual Foxpro 06.00.8167
Microsoft Visual Foxpro Driver 6.01.8629.01
Don't know what else to try.
Can anybody please help me.
Thanks in advance
Archanajava.sql.SQLException: [Microsoft][ODBC Visual FoxPro Driver]File must be opened exclusively.
In the Visual Foxpro table, I saw no READ ONLY settings.And also, there are
no delete permission grants and there is no user database sesssion concept.
The ODBC DSN for MYTABLE is setup as:
- Free Tables (not database)
- Null (checked)
- Deleted (checked)If you're using Visual Foxpro database(.DBC), you should see "Exclusive" option too. You can try check it, but I don't know whether your issue will disappear. -
[Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax error
Hi , i am trying to execute siple SP using JDBC-ODBC Bridge Driver
Here my code :
String dsn="Tritek1";
String user="sa";
String password="imcindia";
Connection con1 = null;
CallableStatement cstmt = null;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
con1=DriverManager.getConnection("jdbc:odbc:"+dsn,user,password);
Statement st=con1.createStatement();
st.execute("use dm0102d");
st.execute("setuser 'dm01012'");
cstmt = conObject.connection(" ?=Call dms_ex_get_folder_info(?,?,?)");
cstmt.setString(1,folderType);
cstmt.registerOutParameter(2,java.sql.Types.VARCHAR);
cstmt.registerOutParameter(3,java.sql.Types.VARCHAR); bFlag=cstmt.execute();
Here my SP :
Procedure Name : dms_ex_get_folder_info
Input Parameter(s) : a. folder_type char(20)
Return Parameter(s) : a. Recordset consist edit_mask and folder_type_code from folder_reference table / error
Procedure Type : select
Programmer : Prashanth Kumar M.
Creation Date : 12/20/2005 (20th Dec, 2005)
Tables Accessed : folder_reference
Revised :
Programmer: Date: Description:
Prashanth Kumar M. 12/21/2005 Modified the script as per the approved program specifications.
Test Query:
Declare @edit_mask char(15)
Declare @folder_type_code char(2)
execute dms_ex_get_folder_info 'Policy Folder',@edit_mask output,@folder_type_code output
Print 'Edit Mask : ' + @edit_mask
Print 'Folder Type Code : ' + @folder_type_code
CREATE PROCEDURE dms_ex_get_folder_info
@folder_type char(20),
@edit_mask char(15) output,
@folder_type_code char(2) output
AS
BEGIN
-- Check if the record for @folder_type exists or not.
BEGIN
-- return the record from folder_reference
SELECT
@edit_mask= IsNull(edit_mask,''),
@folder_type_code = IsNull(folder_type_code,'')
FROM folder_reference
WHERE
folder_decode = ltrim(rtrim(@folder_type))
-- return the error message
IF @@error <> 0
BEGIN
RAISERROR 100016 'Error in gettting the record from folder_reference table'
RETURN (@@error)
END
IF @edit_mask = '' AND @folder_type_code = ''
BEGIN
RAISERROR 100017 'No matching details in the folder_reference table'
RETURN (@@error)
END
END
END
GO
Here My Exception:
java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax error
at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.SQLExecute(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.execute(Unknown Source)
at com.nyl.dms.bl.Folder.createFolder(Folder.java:121)
at com.nyl.dms.bl.Folder.main(Folder.java:223)
Any one can help me to overcome this problem . Thanks in advance.
venkatHere's from one of those 10s of books.
Quoted from JDBC 3.0 by Bernard Van Haecke:
Stored procedures can return multiple result types because they can be composed of SQL statements that return diverse result types: resultsets and update counts (this includes special error codes).
Now this doesn't sound very satisfactory. So I use Sybase since I don't have any other database at the moment, and write a simple stored procedure.
CREATE proc testproc AS
BEGIN
-- My return code
return 7
END
goThen a sample patchy buggy code to play around:
import java.sql.*;
public class ProcTesting {
public static void main(String[] args) {
String connUrl = "jdbc:sybase:Tds:myserver:5150/dbinst";
String userName = "username";
String password = "password";
Connection con = null;
CallableStatement stmt = null;
ResultSet rs = null;
String sql = "{? = call testproc}";
try {
Class.forName("com.sybase.jdbc2.jdbc.SybDriver").newInstance();
con = DriverManager.getConnection(connUrl, userName, password);
stmt = con.prepareCall(sql);
stmt.registerOutParameter(1, Types.INTEGER);
stmt.execute();
System.out.println(stmt.getInt(1));
} catch(Exception e) {
e.printStackTrace();
} finally {
closeAll(con, stmt);
public static void closeAll(Connection con, Statement stmt) {
try {
con.close();
} catch(Exception e) { }
try {
stmt.close();
} catch(Exception e) { }
}Followed by:
javac ProcTesting.java
java -cp "%CLASSPATH%;C:\jarutils\jconn2.jar" ProcTesting
Output:
7
Didn't you know this could be done?
Happy new year, grandpa! -
Hello I developed a small applicaion for insert data into database.but i am getting exception in the server like this.
app failed due to java.sql.SQLException: [Microsoft][ODBC driver for Oracle][Oracle]ORA-01401: inserted value too large for column
And the code is given below..
import java.io.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class Jdbc1 extends HttpServlet
public void service(HttpServletRequest request,HttpServletResponse response)throws ServletException,IOException
PrintWriter out=response.getWriter();
String no=request.getParameter("no");
String name=request.getParameter("name");
String age=request.getParameter("age");
try
System.out.println("1");
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
System.out.println("2");
Connection con=DriverManager.getConnection("jdbc:odbc:rakesh","scott","tiger");
System.out.println("3");
Statement st=con.createStatement();
System.out.println("4");
st.executeUpdate("INSERT INTO ind VALUES('+no+','+name+','+age+')" );
con.commit();
con.close();
catch(Exception e)
System.out.println(" app failed due to "+e);
}Please give solution for this....Hello sir..
thanks for ur reply...
for oracle 10g -----> we use XE as datasourse
name..What?
now i am using oracle 8i...Not so from the code you posted. Didn't I see "jdbc:odbc:..." in your first post?
so what should i
write...in the datasourse name...that means.......
Connection
con=DriverManager.getConnection("jdbc:oracle:thin:@loc
alhost:1521:????????","scott","tiger");Do you really use the default username and password?
What should i write in place of ?????????..The name of the database you wish to connect to, of course.
Do you have your tnsnames.ora set up properly? Did you install this database?
None of this has ANYTHING to do with the error you posted, of course. Fix that first and then worry about the thin driver. At least it appears that the code you posted managed to connect to the database.
% -
Hi, I'm getting an error in the eManager server log when running a load test:
Error executing prepared statement: sun.jdbc.odbc.JdbcOdbcPreparedStatement@189ff39
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Invalid argument.
I found this on the MS site concerning the 2GB size limitation for MDB files:
http://support.microsoft.com/?id=835416
The RSWReport.mdb file is more than 2GB in size, so I'm assuming that this file is causing the problem.
Is there anyway to purge this file? Will compacting the file or splitting the file as MS recommends fix the problem?
JamesYou can always just create a new mdb file and run with that. I typically create a new MDB for each project I work on, or build of an app.
The windows ODBC controls will let you create a blank MDB file.
1. Start - Settings - Control Panel - Administrative Tools - Data Cources (ODBC)
2. Chose the reporter ODBC - click configure - create. I tend to name by date and project, etc.
3. In e-Load, chose Manage - Databases - New. In that window, chose 'Create e-Load tables in the database, give it a name, enter the DSN name, chose 'set as current e-Load database' and click ok.
You should be good to go with a clean MDB file. If I missed a step or the instructions aren't clear let me know.
SQL will give you better performance, but if its not an option managing the MDB files will help.
- BT -
Hi,
I am writing a simple program wihich will display the list of table for a given database. Currently I am using JDBC-ODBC bridge for accessing MS Acccess data base. When I call getTables method of DatabaseMetaData. Following Exception was thrown. Any clue what could be the reason for this?
Exception java.sql.SQLException: [Microsoft][ODBC Microsoft Access 97 Driver]Driver not capable
java.sql.SQLException: [Microsoft][ODBC Microsoft Access 97 Driver]Driver not capable
at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6106)
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:6263)
at sun.jdbc.odbc.JdbcOdbc.SQLTables(JdbcOdbc.java:4917)
at sun.jdbc.odbc.JdbcOdbcDatabaseMetaData.getTables(JdbcOdbcDatabaseMetaData.java:2395)
at test.databaseMetaData.main(databaseMetaData.java:36)
This exception occured in the following block:
String[] strTables = {"TABLES"};
rs = dbmd.getTables( null, "DBIS", "A%", strTables);
Thanks in advance
Cheers,
KrishnaHi Krishna,
First, do you have a correct ODBC setup on the platform your working on -- data source, etc.
Second, please enclose the Java code for your connection, etc..
Good luck!
Francis -
i am trying to execute the following query using jdbc
String state = "select * from cs_test where Start_Time < DateAdd(\"s\",-19800,now()) AND End_Time >
DateAdd(\"s\",-19800,now())";
/java.sql.PreparedStatement querycs_test = c.prepareStatement(state);
java.sql.Statement querycs_test= c.createStatement();
java.sql.ResultSet rs = querycs_test.executeQuery(state);
when i run the same query at the prompt in MS Access it works fine.
The same line replaced with a simpler query works fine.
but when i run the above i get an error
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.Here's the value of your query before preparing it:
select * from cs_test where Start_Time < DateAdd("s",-19800,now()) AND End_Time > DateAdd("s",-19800,now())My SQL refererence doesn't have anything about functions called DateAdd or now. It might be Microsoft specific, in which case when your organization converts to another database your query is going to stop working. Don't use vender specific extensions.
Was your intention to call a Java method called DateAdd or now? Then your problem is a few missing quotes. Otherwise, I'm sorry I can't be of more help. -
Hello. I'm trying to do an INSERT into an MS Access 2002 database, and this is throwing:
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] '' is not a valid name. Make sure that it does not include invalid characters or punctuation and that it is not too long.
The INSERT is pretty straight forward:
INSERT INTO Nodes (ID, Name, IP, DateAdded) values ("m22", "Colt,Frankfurt,GR", "213.61.48.52", "2003-02-06")
ID is a TEXT field of length 3 and it is the key (table is currently empty)
Name is a TEXT field of length 50.
IP is a TEXT field of length 16.
DateAdded is TEXT field of length 10.
I tried putting dummy data into the table and doing a SELECT, and that worked without a problem.
Can anyone tell me what is or might be causing this? Thanks in advance!!!
- john ferguson, kansas cityOkay, I fixed this.
The fix was to change the double quotes (") to single quotes (') inside the VALUES part of the statement.
So it went from:
INSERT INTO Nodes (ID, Name, IP, DateAdded) values ("m22", "Colt,Frankfurt,GR", "213.61.48.52", "2003-02-06")
to:
INSERT INTO Nodes (ID, Name, IP, DateAdded) values ('m22', 'Colt,Frankfurt,GR', '213.61.48.52', '2003-02-06')
and now it works fine. -
Hello together!
I am trying to add a long value to an access db.
(I have a PreparedStatement.)
But I get the following error:
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]Optional feature not implemented
at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.SQLBindInParameterBigint(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setLong(Unknown Source)
at Import.writeLineToDb(Import.java:70)
at Import.main(Import.java:40)
when exucuting the followint line:
statement.setLong(2,new Long(data[1]).longValue());
How can I find out which feature is missing and install it?
Thanks.
MarkusCould it be that the driver is not installed for that?
I am connecting like that:
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
connection = DriverManager.getConnection("jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb)};DBQ="+path, "", "");
Thanks for your help. -
Can someone please help me? I get the error java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
The offending section of code is:
int resultsTableID = 0;
query = "SELECT results_table_01 FROM dbo_results_table_01 WHERE image_1_id = '" + file1ID + "' AND image_2_id = '" + file2ID + "'";
System.out.println(query);
rs = s.executeQuery(query);
The select statement comes out:
SELECT results_table_01 FROM dbo_results_table_01 WHERE image_1_id = '115' AND image_2_id = '116'
There does not seem to be a problem with the parameter separations, so if anyone can spot what I have done wrong I would appreciate it.
ThanksI have just tried what you advised: Not using single quotes, and I got the same error.
The query now looks like:
query = "SELECT results_table_01 FROM dbo_results_table_01 WHERE image_1_id = " + file1ID + " AND image_2_id = " + file2ID;
Thanks for your help, but it did not work. -
Hi
I am trying to implement the bulk data transfer from source(DB) and target(Excel File) but i am getting the below error.
can some please help me on that.
Knowledge USED:
LKM SQL TO SQL
IKM SQL INCREMENTAL UPDATE
CODE:
create table C$_0Sheet1
* C1_TEST NUMBER(15)*
ODI-1228: Task SrcSet0 (Loading) fails on the target MICROSOFT_EXCEL connection Ms_EXCE_TGT.
Caused By: java.sql.SQLException: [Microsoft][ODBC Excel Driver] Syntax error in CREATE TABLE statement.
at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6957)
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7114)
at sun.jdbc.odbc.JdbcOdbc.SQLPrepare(JdbcOdbc.java:4830)
at sun.jdbc.odbc.JdbcOdbcConnection.prepareStatement(JdbcOdbcConnection.java:475)
at sun.jdbc.odbc.JdbcOdbcConnection.prepareStatement(JdbcOdbcConnection.java:443)
at sun.reflect.GeneratedMethodAccessor70.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at oracle.odi.core.datasource.dwgobject.support.OnConnectOnDisconnectDataSourceAdapter$OnDisconnectCommandExecutionHandler.invoke(OnConnectOnDisconnectDataSourceAdapter.java:200)
at $Proxy2.prepareStatement(Unknown Source)
at oracle.odi.runtime.agent.execution.sql.SQLCommand.doInitializeStatement(SQLCommand.java:83)
at oracle.odi.runtime.agent.execution.sql.SQLCommand.getStatement(SQLCommand.java:117)
at oracle.odi.runtime.agent.execution.sql.SQLCommand.getStatement(SQLCommand.java:111)
at oracle.odi.runtime.agent.execution.sql.SQLCommand.execute(SQLCommand.java:158)
at oracle.odi.runtime.agent.execution.sql.SQLExecutor.execute(SQLExecutor.java:102)
at oracle.odi.runtime.agent.execution.sql.SQLExecutor.execute(SQLExecutor.java:1)
at oracle.odi.runtime.agent.execution.TaskExecutionHandler.handleTask(TaskExecutionHandler.java:50)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.processTask(SnpSessTaskSql.java:2913)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java:2625)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatAttachedTasks(SnpSessStep.java:558)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:464)
at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:2093)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$2.doAction(StartSessRequestProcessor.java:366)
at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:216)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:300)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$0(StartSessRequestProcessor.java:292)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$StartSessTask.doExecute(StartSessRequestProcessor.java:855)
at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:126)
at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$2.run(DefaultAgentTaskExecutor.java:82)
at java.lang.Thread.run(Thread.java:662)Hi
i refereed the blog and i modified the same but still it is throwing an error.
ODI-1228: Task SrcSet0 (Loading) fails on the target MICROSOFT_EXCEL connection TGT_Excel_TEST.
Caused By: java.sql.SQLException: [Microsoft][ODBC Excel Driver] Syntax error in CREATE TABLE statement.
Code:
create table C$_0POSITION_DEFINITION_ID
C1_POSITION_DEFINITION_ID NUMBER(15) ,
C2_ID_FLEX_NUM___________ NUMBER(15)
The above code is executed in the sql developer and it's successfully created the table.
Edited by: 985498 on May 16, 2013 3:54 AM
Maybe you are looking for
-
Everything correct, but the images are not there
Ok, with the podcast I do, All Things Gaming throught www.upstatefighting.com, I went throught and added the album art for the cast in the feed that we use. I checked in the store, and the image shows up. But when I resubscribe to the podcast, the
-
Hello , My form is having the following coding. IF :TR.CLEAR = 'Y' THEN DISPLAY_ITEM ('TR.TR_WORKED_DATE', 'CG$RED'); alert_button := SHOW_ALERT(FIND_ALERT('ALERT_DEL')); IF alert_button = ALERT_BUTTON1 THEN END IF; END Ifl In the abov
-
Na Data available in SFLIGHT, SCARR etc tables by Default after installatio
Hi Everyone, I have successfully managed to install the SAP NetWeaver 7.01 SR1 ABAP Trial Version. I can now login using user BCUSER. However when I checked SAP's standard training tables such as SCARR, SFLIGHT etc from package SAPBC_DATAMODEL. There
-
Extract schema, each object in its own file, maintain dependencies
Hi, is there a tool that exports a schema DDL so that each schema object creae statement is stored in a separated file, and a general script is provided which creates objects in the right order (dependencies). I know toad can do it, but it's a bit ov
-
Apple ID says my gmail account is already in use, but I didn't set it up?
I haven't used my Apple ID since I last had an iPhone over 2 years ago. Yesterday when I ordered my iPhone 6 I decided I wanted to create a new Apple ID, because I no longer use the email that I used to use. (I understand I can't merge the two accoun