When you need to connect to Microsoft SQLServer 2005 or 2008 this component will help you. There are two ways of getting a connection; a direct connection or through a pool. For more info about pools see the Connections Pool section of the help. Also, if you need help configuring your SQL Server see the SQL Server Configuration help section.


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.

Basic fields

The first fields are self explanatory, enter the IP address or hostname in the Server field, the port in Port and type in the name of the database you want to use in the Database field. User id and Password are your login credentials.


The Properties field allows you to specify any connection properties. For a list of properties and why/when to use them please see this document.

appName property

A good rule of thumb is to always include the appName property for each connection. This will give your connection a readable name which is really useful for database administrators when using the Profiling tool to identify problems.

To set this property add appName=OrderPrinter in the properties field like:

SQLServerConnection con1 = new SQLServerConnection("", 1433, "dbname", "username", "#$E%0xcGFzc3dvcmQ=", "appName=Mike");

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:

SQLServerConnection con1 = (SQLServerConnection) 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.