Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Learning Heroku Postgres
  • Table Of Contents Toc
Learning Heroku Postgres

Learning Heroku Postgres

By : Patrick Rafael de Oliveira Espake
4.3 (4)
close
close
Learning Heroku Postgres

Learning Heroku Postgres

4.3 (4)
By: Patrick Rafael de Oliveira Espake

Overview of this book

Learning Heroku Postgres is targeted at developers and database admins. Even if you're new to Heroku Postgres, you'll be able to master both the basic as well as advanced features of Heroku Postgres. Since Heroku Postgres is incredibly user-friendly, no previous experience in computer coding or programming is required.
Table of Contents (12 chapters)
close
close
9
A. Keyword List
11
Index

Connecting with Java


There are many ways to connect to the database using Java, the most common way is through the parameters contained in the database connection URL. It provides you with the information postgres://[username]:[password]@[host]/[database name].

JDBC

You can connect via JDBC using the DATABASE_URL variable or using another database URL provided by Heroku. The JDBC connection is performed through the database URL parsing and extracting the necessary parameters. The following is just a code sample to help you understand the concept:

URI connectionParams = new URI(System.getenv("DATABASE_URL"));
String jdbcUrl = "jdbc:postgresql://" + connectionParams.getHost() + connectionParams.getPath(); 
Properties properties = new Properties();
properties.setProperty("username", connectionParams.getUserInfo().split(":")[0]);
properties.setProperty("password", connectionParams.getUserInfo().split(":")[1]);
Connection connection = DriverManager.getConnection(jdbcUrl, properties);

Spring/XML...

CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Learning Heroku Postgres
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon