작성
·
596
0
안녕하세요?
좋은 강의 잘 듣고 있습니다.
다름이 아니라 초반부터 계속 h2 db가 생성이 안되거나 접속이 안되는 등 문제가 많았는데...
이건 며칠 째 혼자 해결이 안되어 질문 드립니다.
다른 분들이 질문하신 것 보았고 h2 버전과 hibernate 버전 모두 올려 보았지만
결과가 똑같습니다. 이메일로 프로젝트 압축 파일 첨부하겠습니다.
아래는 콘솔 에러 메세지 입니다.
12월 26, 2020 6:38:00 오후 org.hibernate.resource.transaction.backend.jdbc.internal.DdlTransactionIsolatorNonJtaImpl getIsolatedConnection
INFO: HHH10001501: Connection obtained from JdbcConnectionAccess [org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess@7726e185] for (non-JTA) DDL execution was not in auto-commit mode; the Connection 'local transaction' will be committed and the Connection will be set into auto-commit mode.
12월 26, 2020 6:38:00 오후 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PoolState stop
INFO: HHH10001008: Cleaning up connection pool [jdbc:h2:tcp://localhost/~/jpaShop]
답변 1
0
안녕하세요. Ikobean H 님
다음 2가지 부분을 변경하면 정상 동작합니다.
jdbc:h2:tcp://localhost/~/jpaShop
-> jdbc:h2:tcp://localhost/~/jpashop (만약 테이블을 만들지 않았다면 /jpashop 대신에 /test로)
password="1234"
-> password=""
설정을 다음과 같이 맞추어보시겠어요?
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.2" xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_2.xsd">
<persistence-unit name="hello">
<properties>
<!-- 필수 속성 -->
<property name="javax.persistence.jdbc.driver" value="org.h2.Driver"/>
<property name="javax.persistence.jdbc.user" value="sa"/>
<property name="javax.persistence.jdbc.password" value=""/>
<property name="javax.persistence.jdbc.url" value="jdbc:h2:tcp://localhost/~/test"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
<!-- 옵션 -->
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.format_sql" value="true"/>
<property name="hibernate.use_sql_comments" value="true"/>
<property name="hibernate.hbm2ddl.auto" value="create" />
</properties>
</persistence-unit>
</persistence>
주신 코드를 이걸로 변경해서 잘 동작하는 것을 확인했습니다.
혹시 안되면 댓글 남겨주세요^^