JDBC Driver Connection URL strings
Are you struggling with performance issues in your Spring, Jakarta EE, or Java EE application?
What if there were a tool that could automatically detect what caused performance issues in your JPA and Hibernate data access layer?
Wouldn’t it be awesome to have such a tool to watch your application and prevent performance issues during development, long before they affect production systems?
Well, Hypersistence Optimizer is that tool! And it works with Spring Boot, Spring Framework, Jakarta EE, Java EE, Quarkus, Micronaut, or Play Framework.
So, rather than fixing performance issues in your production system on a Saturday night, you are better off using Hypersistence Optimizer to help you prevent those issues so that you can spend your time on the things that you love!
Introduction
Ever wanted to connect to a relational database using Java and didn’t know the URL connection string?
Then, this article is surely going to help you from now on.
Connect to a relational database using #Java with JDBC Driver Connection URL strings - @vlad_mihalcea https://t.co/vdCpoWvrIE pic.twitter.com/hy2OuQrYkC
— Java (@java) February 15, 2018
Oracle
The JDBC connection properties look as follows:
| JDBC Driver | oracle.jdbc.OracleDriver |
| JDBC URL | jdbc:oracle:thin:@localhost:1521:orclpdb1 |
| Hibernate Dialect | org.hibernate.dialect.OracleDialect |
And, if you want to connect using a JDBC DataSource, this is what you need to use:
OracleDataSource dataSource = new OracleDataSource();
dataSource.setDatabaseName("high_performance_java_persistence");
dataSource.setURL("jdbc:oracle:thin:@localhost:1521/orclpdb1");
dataSource.setUser("oracle");
dataSource.setPassword("admin");
MySQL
The JDBC connection properties look as follows:
| JDBC Driver | com.mysql.jdbc.Driver |
| JDBC URL | jdbc:mysql://localhost/high_performance_java_persistence |
| Hibernate Dialect | org.hibernate.dialect.MySQLDialect |
And, if you want to connect using a JDBC DataSource, this is what you need to use:
MysqlDataSource dataSource = new MysqlDataSource();
dataSource.setURL(
"jdbc:mysql://localhost/high_performance_java_persistence"
);
dataSource.setUser("mysql");
dataSource.setPassword("admin");
PostgreSQL
The JDBC connection properties look as follows:
| JDBC Driver | org.postgresql.Driver |
| JDBC URL | jdbc:postgresql://localhost/high_performance_java_persistence |
| Hibernate Dialect | org.hibernate.dialect.PostgreSQLDialect |
And, if you want to connect using a JDBC DataSource, this is what you need to use:
PGSimpleDataSource dataSource = new PGSimpleDataSource();
dataSource.setDatabaseName("high_performance_java_persistence");
dataSource.setServerName("localhost");
dataSource.setUser("postgres");
dataSource.setPassword("admin");
SQL Server
The JDBC connection properties look as follows:
| JDBC Driver | com.microsoft.sqlserver.jdbc.SQLServerDriver |
| JDBC URL | jdbc:sqlserver://localhost;instance=SQLEXPRESS;databaseName=high_performance_java_persistence |
| Hibernate Dialect | org.hibernate.dialect.SQLServerDialect |
And, if you want to connect using a JDBC DataSource, this is what you need to use:
SQLServerDataSource dataSource = new SQLServerDataSource();
dataSource.setURL(
"jdbc:sqlserver://localhost;instance=SQLEXPRESS;" +
"databaseName=high_performance_java_persistence;"
);
dataSource.setUser("sa");
dataSource.setPassword("adm1n");
MariaDB
The JDBC connection properties look as follows:
| JDBC Driver | org.mariadb.jdbc.Driver |
| JDBC URL | jdbc:mariadb://localhost/high_performance_java_persistence |
| Hibernate Dialect | org.hibernate.dialect.MariaDBDialect |
Db2 Community Edition
The JDBC connection properties look as follows:
| JDBC Driver | com.ibm.db2.jcc.DB2Driver |
| JDBC URL | jdbc:db2://localhost/high_performance_java_persistence |
| Hibernate Dialect | org.hibernate.dialect.DB2Dialect |
SAP HANA
The JDBC connection properties look as follows:
| JDBC Driver | com.sap.db.jdbc.Driver |
| JDBC URL | jdbc:sap://localhost/high_performance_java_persistence |
| Hibernate Dialect | org.hibernate.dialect.HANADialect |
Informix
The JDBC connection properties look as follows:
| JDBC Driver | com.informix.jdbc.IfxDriver |
| JDBC URL | jdbc:informix-sqli://localhost:9088/sysuser:INFORMIXSERVER=hpjp |
| Hibernate Dialect | org.hibernate.community.dialect.InformixDialect |
HSQLDB
The JDBC connection properties look as follows:
| JDBC Driver | org.hsqldb.jdbc.JDBCDriver |
| JDBC URL | jdbc:hsqldb:mem:high_performance_java_persistence |
| Hibernate Dialect | org.hibernate.dialect.HSQLDialect |
And, if you want to connect using a JDBC DataSource, this is what you need to use:
JDBCDataSource dataSource = new JDBCDataSource();
dataSource.setUrl("jdbc:hsqldb:mem:test");
dataSource.setUser("sa");
dataSource.setPassword("");
H2
The JDBC connection properties look as follows:
| JDBC Driver | org.h2.Driver |
| JDBC URL | jdbc:h2:mem:high_performance_java_persistence |
| Hibernate Dialect | org.hibernate.dialect.H2Dialect |
Derby
The JDBC connection properties look as follows:
| JDBC Driver | org.apache.derby.jdbc.EmbeddedDriver |
| JDBC URL | jdbc:derby:target/tmp/derby/hpjp;databaseName=high_performance_java_persistence;create=true |
| Hibernate Dialect | org.hibernate.dialect.DerbyDialect |
That’s it!
If you enjoyed this article, I bet you are going to love my Book and Video Courses as well.
Conclusion
Knowing the JDBC Driver Connection URL strings is mandatory if you want to connect to a relational database system from a Java application.
If there is a database system that I forgot to add, add a comment and I’ll update the article.


