I try to do deploying (I use pivotal.io).
Before deploying I try to create tables of my DB.
On pivotal.io I create the test database (ElephantSQL). This new DB have:
Shared high performance cluster
20 MB data
4 concurrent connections
I use Spring and this describe my DB in application properties. This works if I create DB on my localhost.`
spring.datasource.url=jdbc:postgresql://stampy.db.elephantsql.com:5432/iyraxwqa
spring.datasource.username=iyraxwqa
spring.datasource.password=*************************
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
spring.jpa.hibernate.ddl-auto=create
spring.jpa.database=POSTGRESQL
spring.datasource.platform=postgres
spring.jpa.show-sql=false`
When I Run my application I see this ERROR:
2017-05-14 12:53:38.810 ERROR 4880 --- [ main] o.a.tomcat.jdbc.pool.ConnectionPool : Unable to create initial connections of pool.
org.postgresql.util.PSQLException: FATAL: too many connections for role "iyraxwqa"
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2455) ~[postgresql-9.4.1212.jre7.jar:9.4.1212.jre7]
at org.postgresql.core.v3.QueryExecutorImpl.readStartupMessages(QueryExecutorImpl.java:2586) ~[postgresql-9.4.1212.jre7.jar:9.4.1212.jre7]
at org.postgresql.core.v3.QueryExecutorImpl.<init>(QueryExecutorImpl.java:113) ~[postgresql-9.4.1212.jre7.jar:9.4.1212.jre7]
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:222) ~[postgresql-9.4.1212.jre7.jar:9.4.1212.jre7]
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:51) ~[postgresql-9.4.1212.jre7.jar:9.4.1212.jre7]
at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:215) ~[postgresql-9.4.1212.jre7.jar:9.4.1212.jre7]
at org.postgresql.Driver.makeConnection(Driver.java:404) ~[postgresql-9.4.1212.jre7.jar:9.4.1212.jre7]
at org.postgresql.Driver.connect(Driver.java:272) ~[postgresql-9.4.1212.jre7.jar:9.4.1212.jre7]
at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:310) ~[tomcat-jdbc-8.5.6.jar:na]
at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:203) ~[tomcat-jdbc-8.5.6.jar:na]
at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:718) [tomcat-jdbc-8.5.6.jar:na]
I include hibernate h3p0
and add this code:
spring.jpa.properties.hibernate.c3p0.min_size = 1
spring.jpa.properties.hibernate.c3p0.max_size = 2
spring.jpa.properties.hibernate.c3p0.timeout = 300
But I see the same error.
If I try to create manually all is working, but I have a lot of tables and half year ago I created tables with spring and hibernate
One of my tables:
@Entity
@Table(name = "INTERIOR", schema = "public")
public class InteriorModel extends AllFinishProductModel {
@Column(name = "PHOTO")
private String photo;
@Column(name = "PHOTO01")
private String photo01;
@Column(name = "PHOTO02")
private String photo02;
@Id
@Column(name = "ID")
@GeneratedValue(strategy=GenerationType.IDENTITY)
private Long id;
@Column
private String name;
@Column(name = "DESCRIPTION")
private String description;
@Column(name = "COLOR")
private String color;
@Column(name = "QUANTITY")
private Double quantity;
@Column(name = "PRICE")
private BigDecimal price;
// getters and setters....
Somebody know, where my mistake?