postgresql

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

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.

JDBC connection string examples

Some days we all need something simple, like the example syntax for a JDBC connection string (URL) for a particular database.

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

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 JDBC driver for MySQL. Here's a link to the MySQL Connector/J 5.1 JDBC driver download page.

Tomcat DBCP error: Cannot create JDBC driver of class ... for connect URL null

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:

How to start a Postgres server on a Mac

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.

Spring JDBC - How to retrieve the auto-generated database key after an INSERT

Spring JDBC FAQ: How do I retrieve the auto-generated database key for a serial field (also known as an auto_increment field in MySQL) after I perform a SQL INSERT using Spring JDBC?

How to perform a SQL query for fields that are null (or not null)

Okay, maybe this is lame, but when I've been away from writing SQL database queries for a while 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.

How to perform a case-insensitive database query

Database FAQ: How do I do a case-insensitive database search?

Postgresql error - must be owner of relation

If you get a Postgresql error message like this:

ERROR:  must be owner of relation [your_table_here]

don't worry too much, it probably means what it says: You don't own the table (or relation) you're trying to modify. Well, I guess you can worry if you can't get someone to fix the permissions, but if you can it's no big deal.

Syndicate content