#1 2015-10-27 15:22:55

thr27
Member
Registered: 2015-10-27

SQL Server jTDS Support

In case anyone needs support for sourceforge jTDS Jdbc Access to SQLServer.

Pls. find attached the groovy script to install.

How to install new jdbc Support for any database is explained here .

jTDS supports access to SQL Server with Domain NTLM User/Password. This does not work with the Microsoft SQL Server JDBC Driver from Linux.

package databasehelper;

import net.datenwerke.rs.scripting.service.scripting.scriptservices.GlobalsWrapper;
import net.datenwerke.rs.base.service.dbhelper.DatabaseHelper
import net.datenwerke.rs.base.service.dbhelper.hooks.DatabaseHelperProviderHook
import net.datenwerke.rs.base.service.dbhelper.queries.LimitQuery
import net.datenwerke.rs.base.service.dbhelper.queries.OffsetQuery;
import net.datenwerke.rs.base.service.dbhelper.queries.OrderQuery;
import net.datenwerke.rs.base.service.dbhelper.queries.Query
import net.datenwerke.rs.base.service.dbhelper.querybuilder.ColumnNamingService
import net.datenwerke.rs.base.service.dbhelper.querybuilder.QueryBuilder
import net.datenwerke.rs.base.service.dbhelper.db.mssql.MsSQLLimitQuery;
import net.datenwerke.rs.base.service.dbhelper.db.mssql.MsSQLOffsetQuery;
import net.datenwerke.rs.base.service.dbhelper.db.mssql.MsSQLOrderQuery;

class JTDSSqlServer extends DatabaseHelper {

	public static final String DB_NAME = "JTDS SqlServer";
	public static final String DB_DRIVER = "net.sourceforge.jtds.jdbc.Driver";
	public static final String DB_DESCRIPTOR = "DBHelper_JTDSSqlServer";

	@Override
	public String getDescriptor() {
		return DB_DESCRIPTOR;
	}

	@Override
	public String getDriver() {
		return DB_DRIVER;
	}

	@Override
	public String getName() {
		return DB_NAME;
	}
	public String createDummyQuery()
  	{
    	return "SELECT 1 as A";
  	}

  	public LimitQuery getNewLimitQuery(Query nestedQuery, QueryBuilder queryBuilder)
  	{
    	return new MsSQLLimitQuery(nestedQuery, queryBuilder);
  	}

  	public OffsetQuery getNewOffsetQuery(Query nestedQuery, QueryBuilder queryBuilder, ColumnNamingService columnNamingService)
  	{
    	return new MsSQLOffsetQuery(nestedQuery, queryBuilder, columnNamingService);
  	}

  	public OrderQuery getNewOrderQuery(Query nestedQuery, QueryBuilder queryBuilder, ColumnNamingService columnNamingService)
  	{	
    	return new MsSQLOrderQuery(nestedQuery, queryBuilder, columnNamingService);
  	}
	
}


def HOOK_NAME = "DATASOURCE_HELPER_JTDSSQLSERVER"

def callback =  [
			provideDatabaseHelpers : {
				return Collections.singletonList(new JTDSSqlServer());
			}
		] as DatabaseHelperProviderHook;

GLOBALS.services.callbackRegistry.attachHook(HOOK_NAME, DatabaseHelperProviderHook.class, callback)

Offline

#2 2015-10-31 13:07:33

Arno Mittelbach
datenwerke
Registered: 2012-02-14

Re: SQL Server jTDS Support

Hey,

thanks for this. I've transformed this tip into a small blog post.

Cheers
-Arno

Offline

#3 2021-09-20 11:42:45

zaink89
Member
Registered: 2021-09-20

Re: SQL Server jTDS Support

Hello Thr27,

I am not sure how to go about adding jTDS support to my reportserver, the link you provided is not working.
Please assist with another link. I have already downloaded the driver "jtds-1.3.1.jar" and copied it to folder "C:\Program Files\Apache Software Foundation\Tomcat 8.5_Tomcat80\webapps\ROOT\WEB-INF\lib".

however the server still reports driver missing.

Offline

#4 2021-09-22 08:05:51

WendyWright
Member
Registered: 2021-09-22

Re: SQL Server jTDS Support

This is very helpful and much needed, thank you so much!!!!

Last edited by WendyWright (2021-09-22 08:06:17)

Offline

Board footer

Powered by FluxBB