Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 excpetion

Author  Topic 

somsahi
Starting Member

23 Posts

Posted - 2006-08-25 : 15:11:45
Hi getting this exception

Caused by: java.sql.BatchUpdateException: Missing key in referenced table for referential constraint (webadrep.det_fk).
at com.informix.jdbc.IfxPreparedStatement.executeBatch(IfxPreparedStatement.java:3437)
at com.dhl.auditdatamgr.dao.AuditDAO.setDetailedAuditData(AuditDAO.java:94)
... 1 more

now problem 1)not getting the meaning of missing key in refrenced table for refrential constartint 2)how to remove this exception.
regards

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2006-08-25 : 15:15:44
Could you post the SQL Server code that is generating this exception?

Tara Kizer
Go to Top of Page

somsahi
Starting Member

23 Posts

Posted - 2006-08-25 : 15:19:06
ya I have one content relavantt to this which is

"As a result of unit testing, we would like to add a referential constraint to the auditat_service column and auditat_facility in the detailed_a table.
Referenced table is regional_a table.

auditat_servicearea of detailed_a will refer the iata_code column of the regional_a "

Now pls let me know how to do this
regards
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2006-08-25 : 15:20:58
So where's the code?

Tara Kizer
Go to Top of Page

somsahi
Starting Member

23 Posts

Posted - 2006-08-25 : 15:24:33
Hi
code is not creating the problem I am sure about this.pls read my previous mail i need to set some key in refrenced table as per exception by using alt table statement but i dont know how to do it
regards
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2006-08-25 : 15:33:25
I don't understand what you are trying do. Your code is generating an exception.

In order for us to help, you have to provide more information.

Is the back-end SQL Server?

Tara Kizer
Go to Top of Page

somsahi
Starting Member

23 Posts

Posted - 2006-08-25 : 15:41:19
Hi please find the code
int [] i = ps.executeBatch(); this line is giving exception.
thanxs


try
{
con = ds.getConnection(dbUrl);
con.setAutoCommit(false);
String sql = QueriesHelper.getInsertDetailedAuditDataSQL();
ps = con.prepareStatement(sql);

DetailedFacilityAuditData detailedFacilityAuditData = null;
for(Iterator i = detailedAuditDataList.iterator(); i.hasNext();)
{
detailedFacilityAuditData = (DetailedFacilityAuditData)i.next();

ps.setDate(1, detailedFacilityAuditData.getAuditDate());
ps.setString(2, detailedFacilityAuditData.getBuiltAtServiceArea());
ps.setString(3, detailedFacilityAuditData.getBuiltAtFacility());
ps.setString(4, detailedFacilityAuditData.getAuditAtFacility());
ps.setString(5, detailedFacilityAuditData.getAuditAtServiceArea());
ps.setString(6, detailedFacilityAuditData.getHuid());
ps.setString(7, detailedFacilityAuditData.getHuType());
ps.setInt(8, detailedFacilityAuditData.getHuExpected().intValue());
ps.setInt(9, detailedFacilityAuditData.getHuMissing().intValue());
ps.setInt(10, detailedFacilityAuditData.getHuExtra().intValue());
ps.setInt(11, detailedFacilityAuditData.getShipmentExpected().intValue());
ps.setInt(12, detailedFacilityAuditData.getShipmentMissing().intValue());
ps.setInt(13, detailedFacilityAuditData.getShipmentExtra().intValue());
ps.setInt(14, detailedFacilityAuditData.getPieceIdsExpected().intValue());
ps.setInt(15, detailedFacilityAuditData.getPieceIdsMissing().intValue());
ps.setInt(16, detailedFacilityAuditData.getPieceIdsExtra().intValue());
ps.setString(17, detailedFacilityAuditData.getAuditor());
ps.setTimestamp(18, detailedFacilityAuditData.getAuditTime());
ps.setString(19, Constants.CREATED_UPDATED_BY);
ps.setString(20,Constants.CREATED_UPDATED_BY);
ps.addBatch();

}

int [] i = ps.executeBatch();
con.commit();
con.setAutoCommit(true);
System.out.println(i.length);
}
catch(BatchUpdateException be)
{
throw new DatabaseException("Unable to insert detailed facility audit data. ", be);
}
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2006-08-25 : 15:51:15
Where is the SQL code that is causing the exception? Is this even a SQL Server question?

Tara Kizer
Go to Top of Page

somsahi
Starting Member

23 Posts

Posted - 2006-08-25 : 15:58:53
Hi
No its a sql question.

I have the above code and a sql database.
and getting error

sorr if causing incovenienc
eregards
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2006-08-25 : 16:01:58
Okay at least I know it's SQL. Could you post the relevant SQL code then?

Tara Kizer
Go to Top of Page

somsahi
Starting Member

23 Posts

Posted - 2006-08-25 : 16:10:39
Hi i have already posted the relavent sql code with exception now find detail of dataabse

constarint name referenced column refrencing table refrencing column

det_fk iata_code detail auditatiata
facility_code detail auditatfacility
Go to Top of Page

somsahi
Starting Member

23 Posts

Posted - 2006-08-25 : 16:12:07
Hi i have already posted the relavent sql code with exception now find detail of dataabse

constarint name referenced column refrencing table refrencing column

det_fk iata_code detail auditatiata
facility_code detail auditatfacility
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2006-08-25 : 16:16:44
I can't find the SQL code anywhere in this thread. All I see is Java code.

Tara Kizer
Go to Top of Page

somsahi
Starting Member

23 Posts

Posted - 2006-08-25 : 16:25:06
Hi tara thanxs for your effort .
whatever information I have already given to you
regards
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2006-08-25 : 16:27:59
quote:
Originally posted by somsahi

Hi tara thanxs for your effort .
whatever information I have already given to you
regards



There is no way for us to help then. We do not have enough information yet. No where in this thread is there SQL code. We can't troubleshoot an exception coming from SQL Server without the SQL code.

Good luck.

Tara Kizer
Go to Top of Page

somsahi
Starting Member

23 Posts

Posted - 2006-08-25 : 16:33:45
better if you could give your email address so that I can send u some screenshots
Go to Top of Page

somsahi
Starting Member

23 Posts

Posted - 2006-08-25 : 16:37:11
better if you could give your email address so that I can send u some screenshots
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2006-08-25 : 16:38:16
quote:
Originally posted by somsahi

better if you could give your email address so that I can send u some screenshots


You're kidding, right?





CODO ERGO SUM
Go to Top of Page
   

- Advertisement -