Older than dirt Postgres just works alvin October 23, 2014 - 1:38pm

This is cool. I used to prefer PostgreSQL/Postgres over MySQL, but guys at my company preferred MySQL. I’m glad to see Postgres is still around. Here’s a link to the story on ReadWrite.

A Scala JDBC connection and SQL SELECT example

Scala JDBC FAQ: How can I use the Java JDBC API in my Scala application?

If you want to use a SQL database with your Scala applications, it's good to know you can still use the traditional Java JDBC programming library to access databases. I just ran a simple JDBC connection and SQL SELECT test, and everything seems to work just as it does in Java.

Java JDBC Postgresql Driver class and URL example

Here's a quick post to help anyone that needs a quick JDBC Driver and URL reference when using Postgresql (Postgres) with Java (and JDBC).

The basic Postgresql JDBC Driver and URL information you need is shown here:

Tomcat connection pool - a Tomcat JNDI DBCP connection pool example alvin September 26, 2009 - 7:50pm

Here's a quick demonstration of how to create a Tomcat connection pool (database connection pool) using the Tomcat DBCP library.

I'm not going to go into a detailed explanation here of how Tomcat DBCP works, other than to say that it works for me, and I've tried to include everything here that you'll need to implement your own Tomcat DBCP database connection pool in your web applications.

Java JDBC connection string examples

Table of Contents1 - JDBC connection string examples2 - MySQL JDBC connection string (JDBC URL)3 - Postgresql JDBC connection string example4 - SQL Server JDBC connection string example5 - DB2 on an As/400 (iSeries)

Java JDBC FAQ: Can you share Java JDBC connection string examples for the most popular relational databases?

Some days we all need something simple, and today I needed the example syntax for a JDBC connection string (the JDBC URL) for MySQL and Postgresql databases. While I was digging through my old examples, I found JDBC connection string examples for other databases, and thought I'd share them all here.

To that end, here are some example Java JDBC connection string examples for various databases, including MySQL, Postgres, SQL Server, and DB2.

Back to top

JDBC connection string examples

Here’s a table showing the syntax for JDBC URLs and drivers that I've used on recent projects.

Java JDBC drivers and driver downloads

In need of a Java JDBC driver for your database? I thought I'd put together a quick list here showing the URLs where you can download the latest JDBC drivers for databases like Postgresql (Postgres), MySQL, and Microsoft SQL Server.

MySQL JDBC driver

MySQL Connector/J is the official MySQL JDBC driver. Here's a link to their JDBC driver: 

Tomcat DBCP error: Cannot create JDBC driver of class ... for connect URL null alvin May 18, 2009 - 7:47pm

I just ran into a crazy error related to Tomcat and DBCP connection pooling. The error message I got after trying to use the Tomcat DBCP connection pooling in my Java web application was:

Mac OS X Postgresql: How to start a Postgres server on a Mac alvin May 14, 2009 - 3:37pm

Wow, it had been a long time since I last started Postgres on my Mac computer (a MacBook Pro, to be specific), and it took almost almost 20 minutes to remember how to do it. So, to keep that from happening again, here's a quick tip on how to start Postgres (Postgresql) on a Mac OS X computer.

How to perform a SQL query for fields that are null (or not null) alvin August 28, 2008 - 7:13pm

For some reason I can never remember how to search for database table fields that are either NULL or NOT NULL. I always try to use the = operator or something else.

So, for myself, here’s an example of how to perform a SQL query and find all records where a field in a database table is NULL:


And here’s how to perform a SQL query showing all records in a database table where a column is NOT NULL: