H2 3

[ Springboot - h2 ] could not execute statement ... constraint [null] , h2.jdbc.JdbcSQLIntegrityConstraintViolationException: NULL not allowed for column SQL statement 해결하기

Dev , Test DB 분리 후 테스트를 시도하던 중 아래와 같은 오류가 났습니다. org.springframework.dao.DataIntegrityViolationException: could not execute statement [NULL not allowed for column "ID"; SQL statemen .. insert into ... constraint [null] --- org.h2.jdbc.JdbcSQLIntegrityConstraintViolationException: NULL not allowed for column "ID"; SQL statement: 오류 내용을 살펴보면 PK로 설정했던 id 필드가 null 이 허용되지 않는다는 것 같습니다. 하지만 아래 그림처럼 누락 없..

trouble_shooting 2023.10.09

[h2] 접속 1 ( cmd , console 접속 )

CMD창에 [자신의 h2 경로] \ h2 \ bin 으로 이동한 후,(저는 c 에 h2 가 설치되어 있습니다!) h2.bat 을 입력해줍니다. (윈도우 기준// 맥은 ./h2.sh) 위와 같이 h2.bat 명령어를 입력하게 되면 자신의 cd ~ 경로에 test.mv.db 파일이 생성됩니다. C:\Users\wjdtn\[user name] 그럼 이런 창이 뜨게되는데 JDBC URL 을 변경해줍니다. 혹시 뜨지않는다면 인터넷 주소창에 jdbc:h2:mem:testdb 를 입력해 주세요. 아래와 같은 창을 확인할 수 있습니다. JDBC URL을 jdbc:h2:tcp://localhost/~/test 로 변경 후 연결을 해주세요. → 해당 url은 소켓을 통해 접근 . 여러 경로에서 접근 가능. 만약 연결에 문..

Database 2023.04.04

[h2] DB 접속 ( SpringBoot )

오늘은 h2 DB를 사용해 보겠습니다! 1. 먼저 src / main / resources / application.properties 로 이동합니다. h2를 사용하기 위해 웹 콘솔접근을 허용해야합니다. 기본값이 false 였던 설정을 true 로 변경하겠습니다. application.properties 파일에 아래와 같이 입력해줍니다. Spring.h2.console.enabled = true 2. 콘솔창으로 이동합니다. ctrl + f 키를 이용해 jdbc 를 검색합니다. 아래 그림과 같이 ' jdbc:h2:....... ' 라는 주소를 찾았다면 복사해줍니다. 3. 인터넷 주소창에 h2-console 를 입력해 접속합니다. localhost:8080/h2-console 4. h2에 로그인 합니다. 우..

Database 2023.01.17