기록
Home
  • 분류 전체보기 (187)
    • Programming (109)
      • JAVA (15)
      • Javascript (0)
      • 데이터베이스 (8)
      • React (7)
      • 프레임워크 (1)
      • Spring (11)
      • 웹(Web) (4)
      • 운영체제 (5)
      • 서버&네트워크 (6)
      • 자료구조 (0)
      • 알고리즘 (1)
      • 형상관리 (0)
      • 에러노트 (35)
      • 개발 툴 (15)
      • TEMP. (1)
    • Project (0)
      • 트러블슈팅 (0)
    • Personal (2)
      • 리뷰 (1)
      • 업무 (0)
    • Course (73)
      • 모든 개발자를 위한 HTTP 웹 기본 지식 (1)
      • 스프링 핵심 원리 - 기본편 (51)
      • 자바 ORM 표준 JPA 프로그래밍 - 기본편 (21)
    • TEMP (0)
Home
  • 분류 전체보기 (187)
    • Programming (109)
      • JAVA (15)
      • Javascript (0)
      • 데이터베이스 (8)
      • React (7)
      • 프레임워크 (1)
      • Spring (11)
      • 웹(Web) (4)
      • 운영체제 (5)
      • 서버&네트워크 (6)
      • 자료구조 (0)
      • 알고리즘 (1)
      • 형상관리 (0)
      • 에러노트 (35)
      • 개발 툴 (15)
      • TEMP. (1)
    • Project (0)
      • 트러블슈팅 (0)
    • Personal (2)
      • 리뷰 (1)
      • 업무 (0)
    • Course (73)
      • 모든 개발자를 위한 HTTP 웹 기본 지식 (1)
      • 스프링 핵심 원리 - 기본편 (51)
      • 자바 ORM 표준 JPA 프로그래밍 - 기본편 (21)
    • TEMP (0)
블로그 내 검색

기록

  • Programming/에러노트

    [SQL] java.sql.SQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails

    2022. 6. 29.

    by. 개발도비

    java.sql.SQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails

     

     

    참조테이블에 없는 값을 추가해서 발생한 오류이다.

     

    참조 무결성에 따라서 부모키에 해당하는 값만 넣을 수 있음.

    참조하는 테이블에 데이터를 먼저 추가한 후, 참조받는 테이블에 데이터를 추가하면 오류 해결.

    (외래키로 연결한 값을 동일하게 줘야 한다)

     

     

    References https://live-everyday.tistory.com/188

     

    MySQL Error Code: 1452. Cannot add or update a child row 해결

    에러메시지 Error Code: 1452. Cannot add or update a child row: a foreign key constraint fails (`vanilla`.`#sql-1c10_73`, CONSTRAINT `document_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `_user` (`id`..

    live-everyday.tistory.com

    'Programming > 에러노트' 카테고리의 다른 글

    [AJAX] URL에러 상태로 성공  (0) 2022.07.23
    [Tomcat] The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.  (0) 2022.06.30
    [SpringFramework/스프링프레임워크] org.springframework.context.support.DefaultMessageSourceResolvable  (0) 2022.06.27
    input값 에러  (0) 2022.06.24
    getter/setter 오류  (0) 2022.06.20

    댓글

    관련글

    • [AJAX] URL에러 상태로 성공 2022.07.23
    • [Tomcat] The origin server did not find a current representation for the target resource or is not willing to disclose that one exists. 2022.06.30
    • [SpringFramework/스프링프레임워크] org.springframework.context.support.DefaultMessageSourceResolvable 2022.06.27
    • input값 에러 2022.06.24
    맨 위로
전체 글 보기
Tistory 로그인
Tistory 로그아웃
로그아웃 글쓰기 관리

Today

Total

Powered by ⓒ Kakao Corp.

Designed by Nana
블로그 이미지
개발도비

티스토리툴바