h2를 다운받은 후, 다운로드폴더에서 바로 ./h2.sh 를 통하여 db를 시작했다.
웹브라우저를 통해 H2콘솔에 접근해서 테이블을 하나 만든 후, JDBC로 접속하려는데 접속이안된다.(jdbc:h2:tcp://localhost/~/test)
왜 안될까 왜안될까 보다가 h2콘솔에서도 jdbc:h2:tcp://localhost/~/test로는 접속이 안되는것을 확인했다.
default경로는 jdbc:h2:file:./test인것 같은데......하면서 계속보니까 h2.sh파일 경로에 test.mv.db가 생기네...?
그래서 내 계정패스(/Users/seol)에 가서(cd ~) h2.sh와 jar를 옴기고, h2.sh를 실행 하니까 /Users/seol/test.mv.db가 생겼고 JDBC접근이 된다..
잠깐 실습에 적용하려고 받은것이 내시간을.... 아 내일해야지
====================================================
근본적 해결방법
1. 터미널에서 h2설치경로 이동
2. h2.sh 실행(명령어 : ./h2.sh)
3. 실행되면서 자동적으로 웹브라우저 콘솔페이지가 오픈됨(Mac기준)
4. 연결url에 jdbc:h2:~/db명 입력 후 연결. ex) jdbc:h2:~/test
5. 콘솔 로그인되면, db파일이 만들어졌는지 확인. ex) test.mv.db
6. 콘솔 로그아웃
7. jdbc:h2:tcp://localhost/~/test 로 접속되는지 확인
8. 잘되면 웹어플리케이션에서도 localhost 통해 h2접근
h2콘솔(http://localhost:8082/)에서 90149 에러코드.
JDBC연결시 아래오류.
ERROR: Connection is broken: "java.net.UnknownHostException: localhost: nodename nor servname provided, or not known: localhost" [90067-200]
Exception in thread "main" org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:275)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:237)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
at org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory.injectServices(DefaultIdentifierGeneratorFactory.java:152)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.injectDependencies(AbstractServiceRegistryImpl.java:286)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:243)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.(InFlightMetadataCollectorImpl.java:175)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:118)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:900)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:931)
at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:56)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:79)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54)
at hellojpa.Main.main(Main.java:14)
Caused by: org.hibernate.exception.JDBCConnectionException: Error calling Driver#connect
at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:48)
at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:113)
at org.hibernate.engine.jdbc.connections.internal.BasicConnectionCreator.convertSqlException(BasicConnectionCreator.java:118)
at org.hibernate.engine.jdbc.connections.internal.DriverConnectionCreator.makeConnection(DriverConnectionCreator.java:41)
at org.hibernate.engine.jdbc.connections.internal.BasicConnectionCreator.createConnection(BasicConnectionCreator.java:58)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections.addConnections(DriverManagerConnectionProviderImpl.java:321)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections.(DriverManagerConnectionProviderImpl.java:240)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections.(DriverManagerConnectionProviderImpl.java:218)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections$Builder.build(DriverManagerConnectionProviderImpl.java:359)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.buildPool(DriverManagerConnectionProviderImpl.java:98)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.configure(DriverManagerConnectionProviderImpl.java:73)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:107)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:246)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.buildJdbcConnectionAccess(JdbcEnvironmentInitiator.java:145)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:66)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:35)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:101)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:263)
... 14 more
Caused by: org.h2.jdbc.JdbcSQLNonTransientConnectionException: Connection is broken: "java.net.UnknownHostException: localhost: nodename nor servname provided, or not known: localhost" [90067-200]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:622)
at org.h2.message.DbException.getJdbcSQLException(DbException.java:429)
at org.h2.message.DbException.get(DbException.java:194)
at org.h2.engine.SessionRemote.connectServer(SessionRemote.java:439)
at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:321)
at org.h2.jdbc.JdbcConnection.(JdbcConnection.java:173)
at org.h2.jdbc.JdbcConnection.(JdbcConnection.java:152)
at org.h2.Driver.connect(Driver.java:69)
at org.hibernate.engine.jdbc.connections.internal.DriverConnectionCreator.makeConnection(DriverConnectionCreator.java:38)
... 29 more
Caused by: java.net.UnknownHostException: localhost: nodename nor servname provided, or not known
at java.base/java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.base/java.net.InetAddress$PlatformNameService.lookupAllHostAddr(InetAddress.java:924)
at java.base/java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1504)
at java.base/java.net.InetAddress$NameServiceAddresses.get(InetAddress.java:843)
at java.base/java.net.InetAddress.getAllByName0(InetAddress.java:1494)
at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1353)
at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1287)
at java.base/java.net.InetAddress.getByName(InetAddress.java:1237)
at org.h2.util.NetUtils.createSocket(NetUtils.java:82)
at org.h2.engine.SessionRemote.initTransfer(SessionRemote.java:119)
at org.h2.engine.SessionRemote.connectServer(SessionRemote.java:435)
... 34 more
Process finished with exit code 1
'Other > DB' 카테고리의 다른 글
Toad Editor 단축키 (0) | 2012.08.20 |
---|---|
PL/SQL SQL PLUS상에서 STORED PROCEDURE 소스 확인 방법 (0) | 2012.08.14 |
PL/SQL 프로시저 (procedure) (0) | 2012.08.14 |
MySQL : 해당 필드에 중복된 값 찾기 (0) | 2012.06.15 |
mysql - DATE_FORMAT & TIME_FORMAT (1) | 2012.06.12 |