A Java DB2 JDBC Driver class and URL example

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

If all you need is a reference to the DB2 JDBC Driver and URL connection string syntax, this basic information should work:

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.

Ruby DB2 ODBC - how to access a DB2 database on an As/400 or iSeries

Here's a quick look at a "Ruby DB2" program I created to read data from a DB2 database table on an AS/400 (iSeries) DB2 database.

My Ruby DB2 ODBC example program

First, here's the example Ruby program that accesses the As400 DB2 database, with a few names changed to protect the innocent: