Thursday, March 23, 2017

JDBC drivers and connection strings

Recently I was fixing a bug in gadget creation in WSO2 DAS 3.1.0 in which gadget creation throws errors on some database types. So I have to check for major database types for gadget creation and I came up with following database drivers and connection strings and little more information their JDBC drivers.

MySQL
Driver class : com.mysql.jdbc.Driver
Connection string : jdbc:mysql://localhost:3306/databaseName

You can download JDBC driver from their official site.

MSSQL
Driver class : com.microsoft.sqlserver.jdbc.SQLServerDriver
Connection string :jdbc:sqlserver://hostName:1433;database=databaseName

You can download MSSQL driver from microsoft site. According to the JRE it comes from several flavours as below.

• Sqljdbc41.jar requires a JRE of 7 and supports the JDBC 4.1 API
• Sqljdbc42.jar requires a JRE of 8 and supports the JDBC 4.2 API

Apart from official MSSQL driver there are other supported drivers like jtds as well. You can find more information about them by referring this stackoverflow question.

PostgreSQL
Driver class : org.postgresql.Driver
Connection string : jdbc:postgresql://localhost:5432/databaseName

You can download the PostgreSQL driver from their official site and it also comes in different flavours depend on the Java version. It would be very easy to work with PostgresSQL if you are using postgres.app. For mac users, note that to uninstall all previous versions of PostgreSQL versions to work with postgres app.

DB2
Driver class : com.ibm.db2.jcc.DB2Driver
Connection string : jdbc:db2://myhost:5021/mydb

You can download db2 JDBC driver from their official site.

Oracle
Driver class : oracle.jdbc.OracleDriver
Connection string : jdbc:oracle:thin:@hostName:1521/wso2qa11g

You can download Oracle JDBC driver from their official site.

No comments:

Post a Comment

How to choose IP address range for resources for AWS virtual private cloud

You will often need to allocate  an IP address range when you design the network of an AWS VPC. Since VPC is a small network of resources(E...