0 Replies - 357 Views - Last Post: 05 January 2016 - 12:23 PM

#1 LegiitUser   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 05-January 16

Connecting Spring boot to Azure Database

Posted 05 January 2016 - 12:23 PM

Hi!!

I was planning to make an application with a database located on azure.

I've made a clean Spring Project with JPA/Hibernate and changed some properties, to try if the connection to the database worked.

When executing my clean project I get the following error:
 SEVERE [RMI TCP Connection(3)-127.0.0.1] org.apache.tomcat.jdbc.pool.ConnectionPool.init Unable to create initial connections of pool. 

& another one:

User 'xxxxxx' has exceeded the 'max_user_connections' resource (current value: 4)



you can find the full stractrace right here: http://pastebin.com/u6ifaTLJ

The only thing I have in my application is my ServletInitializer.java & Application.java wich were generated.
In the "application.properties" I've added the following:

# ===============================
# = DATA SOURCE
# ===============================

# Connection url for the database "myTestingDB"
spring.datasource.url = jdbc:mysql://eu-cdbr-azure-west-c.cloudapp.net:3306/myTestingDB

# Username and password
spring.datasource.username = xxxxxxxx
spring.datasource.password = xxxxxxxx

# Keep the connection alive if idle for a long time (needed in production)
#spring.datasource.testWhileIdle = true
#spring.datasource.validationQuery = SELECT 1
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.maxActive=100
spring.datasource.max-idle=30
spring.datasource.max-wait=10000
spring.datasource.max-user-connection=100

#spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver

# ===============================
# = JPA / HIBERNATE
# ===============================

# Show or not log for each sql query
spring.jpa.show-sql = true

# none - create - update - create-drop
spring.jpa.hibernate.ddl-auto = update

# Naming strategy
spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy

# Allows Hibernate to generate SQL optimized for a particular DBMS
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect




I've replaced the username & password for obvious reasons.

Is This A Good Question/Topic? 0
  • +

Page 1 of 1