2016-01-06 13 views
0

Для URL соединенияНе удается подключиться к Postgres

postgres://swnstvngfhgcks:[email protected]s.com:5432/d3tqm9uep7oufb 

Я использую следующие настройки persistence

<?xml version="1.0" encoding="UTF-8"?> 
<persistence version="2.1" 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_1.xsd"> 
    <persistence-unit name="HotelPU" transaction-type="RESOURCE_LOCAL"> 
     <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider> 
     <properties> 
      <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQL82Dialect"/> 

      <property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver"/> 
      <property name="javax.persistence.jdbc.url" value="postgres://ec2-54-235-170-124.compute-1.amazonaws.com:5432/d3tqm9uep7oufb"/> 
      <property name="javax.persistence.jdbc.user" value="swnstvngfhgcks"/> 
      <property name="javax.persistence.jdbc.password" value="s6oqSe93DVkrcEnyJEHStzpfAt"/> 

      <property name="javax.persistence.schema-generation.database.action" value="create"/> 
      <property name="javax.persistence.schema-generation.create-source" value="script"/> 
      <property name="javax.persistence.schema-generation.create-script-source" 
         value="sql/hotel_postgres.sql"/> 
     </properties> 

    </persistence-unit> 
</persistence> 

Но я получаю следующее исключение:

Caused by: org.hibernate.HibernateException: Unable to make JDBC Connection [postgres://ec2-54-235-170-124.compute-1.amazonaws.com:5432/d3tqm9uep7oufb] 
    at org.hibernate.engine.jdbc.connections.internal.BasicConnectionCreator.createConnection(BasicConnectionCreator.java:77) 
    at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.configure(DriverManagerConnectionProviderImpl.java:106) 
    at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:111) 
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:234) 
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:206) 
    at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.buildJdbcConnectionAccess(JdbcServicesImpl.java:260) 
    at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:94) 
    at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:111) 
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:234) 
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:206) 
    at org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.java:1885) 
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1843) 
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:850) 
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:843) 
    at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:398) 
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:842) 
    at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:75) 

Где я неправильный

+1

надстройкой 'JDBC:' в начале подключения? –

+2

Также вы должны удалить пользователя/пароль из этого сообщения. – abalos

ответ

Смежные вопросы