Thursday, July 16, 2015

Spring Boot with non JDBC database url

Using Spring Boot a DataSource usually is configured using spring.datasource.* properties as shown in the following example:

However database as a service providers (like Heroku Postgres, Compose PostgreSQL, ClearDB MySQL) provide the connection parameters in a format of
scheme://user:password@host:port/path
Would be nice to have a single URI property in Spring Boot to configure database connection properties, similar how we can configure a MongoDB connection via spring.data.mongodb.uri or a Redis connection via spring.redis.uri

Below you find how you could use a single URI property, in this case spring.datasource.uri to specify the database connection parameters to a Heroku PostgreSQL database service. The demo application is running on Heroku and using three datastore services:



The connection properties are managed on Heroku:



In the application we just reference the Heroku config variables, encapsulating them in a heroku profile.

Then we just need to extract the connection properties from the spring.datasource.uri and create a DataSource. In this example we use the Tomcat JDBC Connection Pool to create the DataSource instance.

The demo application is available on my github profile.

25 comments:

Jeffy said...

I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I’ll be subscribing to your feed and I hope you post again soon.


Digital Marketing Company in Chennnai

Ravi said...


this is really too useful and have more ideas from yours. keep sharing many techniques. eagerly waiting for your new blog and useful information. keep doing more.

Java Training in Chennai

Rajasekar L said...

Thank you for taking the time to provide us with your valuable information.
Freshers Jobs in Chennai

Priya B said...

Thank you for taking the time to provide us with your valuable information. Best Android Training in Velachery

Ahkansha said...
This comment has been removed by the author.
Ahkansha said...

The blog was interesting and It is excellent. The article is giving to valuable informative. thanks for sharing your article. It is really great post and getting some ideas for new blog post.
java training in chennai

Ancy merina said...
This comment has been removed by the author.
Unknown said...

Thank you a lot for providing individuals with a very spectacular possibility to read critical reviews from this site.

Java training in Chennai | Java training in Bangalore

Java online training | Java training in Pune

Mounika said...

I found your blog while searching for the updates, I am happy to be here. Very useful content and also easily understandable providing.. Believe me I did wrote an post about tutorials for beginners with reference of your blog. 
python interview questions and answers
python tutorials
python course institute in electronic city

prabha said...

Thanks you for sharing this unique useful information content with us. Really awesome work. keep on blogging
angularjs Training in marathahalli

angularjs interview questions and answers

angularjs Training in bangalore

angularjs Training in bangalore

angularjs online Training

angularjs Training in marathahalli

Jagadeesh said...

Nice blog very informative.
thanks for sharing this.
learn digital academy offers, Advanced Digital Marketing Master Course in Bangalore.
intense in-class training program, practically on Live Projects.

Sai Elakiyaa said...



Wonderful content on recent updates, waiting to read the next part of your article.

AngularJS Training in Chennai
Python Training in Chennai
Java Training in Chennai
German Classes in Chennai
Best devOps Training in Chennai
DevOps Training in Chennai

Tony Chew said...

Dibuktikan dengan diketemukannya artefak berbentuk potongan-potongan kartu itu dari prajurit sekaligus juga pahlawan Hung Wing di seputar th. 181 sampai 234 Masehi
asikqq
dewaqq
sumoqq
interqq
pionpoker
bandar ceme terbaik
hobiqq
paito warna
bocoran sgp
data hk

Aruna Ram said...


Lovely post! This is a very fruitful post and I am impressed with the effort you have so obviously put into this content. Thanks for sharing.

Oracle Training in Chennai
best oracle training institute in chennai
Corporate Training in Chennai
Embedded System Course Chennai
Unix Training in Chennai
Pega Training in Chennai
Excel Training in Chennai
Soft SkillsTraining in Chennai
JMeter Training in Chennai
Oracle Training in Anna Nagar


Tech News said...

Nice blog

VISIT HERE -> BIG DATA AND HADOOP TRAINING IN BANGALORE

Digital Blogging Era said...


Nice blog! i'm also working with a Digital marketing company in gurgaon
website designing in gurgaon
best website design services in gurgaon
web company in delhi
web desiging company
web design & development banner
web design & development company
web design & development services
web design agency delhi
web design agency in delhi
web design and development services
web design companies in delhi
web design company delhi
web design company in delhi
web design company in gurgaon
web design company in noida
web design company list
web design company services
web design company website
web design delhi
web design development company
web design development services
web design in delhi
web design service
web design services company
web design services in delhi
web designer company
web designer delhi
web designer in delhi
web designers delhi
web designers in delhi
web designing & development
web designing advertisement
web designing and development
web designing and development company
web designing and development services
web designing companies in delhi
web designing company delhi
web designing company in delhi
web designing company in gurgaon
web designing company in new delhi
web designing company in noida

Trishana said...

thank you for sharing this blog, it useful for understanding the software related issue.
Python training bangalore
Aws training bangalore
Data science training bangalore

i Digital Academy said...

Wonderful blog. Thanks for sharing informative post. It's very useful for me...
Digital Marketing Training in Bangalore

Khalif Mohammed said...
This comment has been removed by the author.
pranay said...

Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. This article inspired me to read more. keep it up.spring boot certification course!

Rani Dubey said...

Hurrah, that’s what I was exploring for, what stuff! present here at this webpage, thanks, admin of this web page.

Banasthali Vidhyapith ka time table | Bilashpur University time table 2022.

laxmicynixit said...

nice information thanks for sharing....!
spring boot certification course training

Deepika Verma said...

The information you have produced is so good and helpful, I will visit your website regularly.

result of Kalyan Matka Satta | Satta Matka Result Today |
सटका मटका रिजल्ट | सत्ता मत्ता मटका रिजल्ट

Import Globals said...

Import Globals is one of the best Global Import Export Data providers for 90+ countries. Visit our website for Vietnam imports, Philippines imports, mexico import, and Russia import data.
Global Import Export Data

iteducationcentre said...

Nice post.
Thanks for sharing.
Java Training in Pune