Microsoft SQL Server™ Howto

This howto contains configuration help on using MS SQL Server with Turbine. This Howto supplements the TDK Howto page.

We appreciate all patches and contributions that improve this document.

Create Microsoft SQL Server™ Database

Use the SQL Server Enterprise Manager to create the database. When using the TDK, it helps to name the database the same name as your project. If the name is not the same, you will need to manually change the database name in your properties files. After the database is created, you will need to create a new user, or give an existing user permissions to the new database. Create the new user with SQL Server Authentication, and assign the users default database to the newly created database. Make sure the database user has the db_owner role. Please refer to SQL Server documentation for further details.

JDBC Driver

Microsoft has a JDBC driver for MS SQL Server in beta. Alternately, a third party commercial driver from JDBC(TM) Technology - Drivers , the JDBC-ODBC bridge driver from Sun, or the free driver from FreeTDS can be used.

The driver from FreeTDS, as of version 0.51, is unstable and buggy, and not recommended for production environments. Use at your own risk.

The JDBC-ODBC bridge driver from Sun is included with the Java 2 SDK Standard Edition as package sun.jdbc.odbc. Sun's statement on this driver is, "Note that the bridge driver included in the SDK is appropriate only for experimental use or when no other driver is available." So use at your own risk. Also, if you are using a non-windows box to run Turbine, you will need to find ODBC drivers for SQL server for that platform. For UNIX environments, you can use unixODBC . Please follow the ODBC driver instructions and setup a DSN for the new database. You must uncheck the box that says, "Use ANSI nulls, paddings and warnings.".

Edit property files

In the ...\WEB-INF\build\build.properties file make sure that;

database=mssql
database.manual.creation = true

And set the JDBC connection information:

databaseDriver = [JDBC Driver]
databaseUser = [db username]
databasePassword = [db password]
databaseHost = [hostname]
databaseUrl = [Follow JDBC Driver Docs]

If you are using the Microsoft driver (i.e. com.microsoft.jdbc.sqlserver.SQLServerDriver ), you'll need to use the SelectMethod=cursor parameter in the JDBC connection string (as outlined by this JDC thread ). Your databaseUrl would look something like the following:

jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=mydb;SelectMethod=cursor

If you are using the JDBC-ODBC bridge driver:

databaseUrl = jdbc:odbc:[DSN Name]
databaseHost = [hostname]
databaseDriver = sun.jdbc.odbc.JdbcOdbcDriver
databaseUser = [db username]
databasePassword = [db password]

In the ..\WEB-INF\conf\TurbineResources.properties file, set;

services.DatabaseService.database.adaptor=DBMSSQL
services.DatabaseService.database.adaptor.DBMSSQL=[JDBC Driver]