Java/JDBC connection FAQ: How do I connect to a database using Java and JDBC?
Let's take a look at a JDBC database connection example. In this example I'll connect to a Postgresql database, but as you'll see from the code and other examples on this web site, the steps are always very similar.
A Java/JDBC Postgresql database connection example
To get a JDBC connection to a PostgreSQL database do this: