JDBCConnection

If the built-in connections aren't enough, or you need to use a different version than the ones shipped with 360 you can supply your own driver with this JDBCConnection component.

Don't forget to include your driver jar file in your project.

Usage

Direct connection

Using a direct connection means that you connect to the database server directly using an IP address and a port. This is the easiest way since there is no configuration needed and it only requires a few parameters. However for production code, we strongly recommend you to look at connection pooling.

A connection is direct when the Connection pool option is not checked.

Driver

This field specifies the name of the driver. Check the documentation for the driver you want to use, it should look something like this:

com.mysql.jdbc.Driver

URL

This field specifies the URL of the connection string. It differs from driver to driver, but it should look something like this:

jdbc:mysql://localhost/test

User id and password

If your database uses authentication supply your username and password in these fields.

Properties

The Properties field allows you to specify any connection properties.

Direct connection example:

JDBCConnection con1 = new JDBCConnection("com.mysql.jdbc.Driver", "jdbc:mysql://localhost/test", "serobkle", "#$E%0xcGFzc3dvcmQ=", "");

Pooled connection

The recommended way to use connections is to use a connection pool. When you have a pool setup you check the Connection Pool option and select your pool from the helper icon. This will give you something like this:

JDBCConnection con1 = (JDBCConnection) PoolManager.instance().getIPool("myPool").getConnection();

If the list of pooled connection is empty you need to configure your pools in 360's administration tool. Please see the help section for Pool Connections.