jdbc

recent blog posts related to java and jdbc, including databases like mysql and postgresql

Case insensitive SQL SELECT query examples

Case insensitive SQL SELECT query FAQ: How do I issue SQL SELECT queries while ignoring case (ignoring whether a string is uppercase or lowercase)?

When I first started writing SQL queries, I did some pretty crazy things to try to ignore case in my text/string queries. Unfortunately for me, I first started with Postgresql, and used some of their custom regular expression capabilities. That seemed like a good idea at the time, but when I tried to move my application to a MySQL database, I paid a price in having to rewrite my case-insensitive SQL queries.

Java JDBC connection string examples

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.

Spring Dao - Spring JDBC DELETE examples

Spring JDBC DELETE FAQ: Can you provide some examples of using SQL DELETE queries using Spring JDBC (Spring Dao classes and methods)?

Here are a few Spring Dao examples, specifically JDBC/SQL DELETE examples.

Spring JDBC delete example #1: Delete a record by the primary key

In this first Spring JDBC DELETE example, I pass in an id parameter, which represents the primary key in my hosts database table. This JDBC/SQL statement deletes the record from that table that matches that id field.

A Spring JDBC SELECT and INSERT example (Spring DAO)

A Spring JDBC SELECT and INSERT example: Here's the source code for a complete Spring DAO class from a project that I'm currently working on (a Java-based web interface to the open source Nagios project) that shows how to use a few Spring JDBC methods, including both a SELECT example and a simple INSERT example.

I'll add more examples to this site later (and with more introduction/description), but for now I'm just going to drop this Java class sample out here and hope that it helps you "Learn Spring JDBC by example".

Java JDBC example - connect to a Postgres database

I don't know if this Java/JDBC sample program will help anyone, but I thought I'd share it here. It's a variation of a program I use to connect to a JDBC database (in this case a Postgresql database) whenever I need to look at some information. In this particular case I wrote the program because I didn't have access to the psql command-line tool, so I created this Java program, compiled it, and ran it to see what I wanted to see.

Syndicate content