JDBC

MySQL JDBC Driver

One thing I discovered is that MySQL or MariaDB will store empty datetime columns as NULL or "0000-00-00 00:00:00" or an actual value. There are of course a number of quirks involved where settings like MySQL :: MySQL 8.0 Reference Manual :: 5.1.11 Server SQL Modes have an impact, it is worth also reading MySQL :: MySQL 8.0 Reference Manual :: 11.3 Date and Time Types. The issues can start with the MySQL JDBC driver finds a zero date, as the default action is to throw an exception, which is not what one might expect. You can change this by setting zeroDateTimeBehavior to "conertToNull" as described at MySQL :: MySQL Connector/J 8.0 Developer Guide :: 6.3 Configuration Properties. It is worth noting that the version 8 driver now accepts the old 5.1 driver value as I specified, in addition to the newer equivalent value.

Another interesting thing is how the JDBC driver connection string is built for MySQL, here are some example, hopefully it show the pattern for how they are put together.
jdbc:mysql://localhost/database?user=geoff&password=secretpassword
jdbc:mysql://localhost:3307/database?user=geoff&password=secretpassword
jdbc:mysql://localhost/?user=geoff&password=secretpassword
jdbc:mysql://server1,server2/database?user=geoff&password=secretpassword&useUnicode=true
Hopefully these show how to specify a server, port, database, username, password, extra parameters and failover servers and how you can leave some parts out.

SQL Server

An example connection string for Microsoft SQL Server is s follows:
jdbc:sqlserver://servername:1433;database=mydb;user=geoff;password=secretpassword;loginTimeout=30