TAFJ MSSQLInstall
TAFJ MSSQLInstall
R19
TAFJ-M S S QL I n s t all
Amendment History:
Revisio
Date Amended Name Description
n
11 1st April 2011 TAFJ team Initial version
7st February
12 H. Aubert R12GA review
2012
16th January
13 R. Vincent R13GA review
2013
th
14 29 April 2013 R. Vincent R13GA review update
20th September
20 JN. Charpin Instructions to setup XA
2017
22nd March
22 TAFJ team R19 AMR review
2019
Page 2
TAFJ-M S S QL I n s t all
Table of Contents
Copyright................................................................................................................................................ 5
Errata and Comments............................................................................................................................ 5
Instructions for SQL Server 2012 Express Edition..................................................................................6
Ensure SQL Server is started................................................................................................ 6
Create Database in Microsoft SQL Server Management...................................................... 6
Connect to Database with Visual Studio 2010...................................................................... 9
Starting from scratch with a New Visual Studio project—Connect to Database with Visual
Studio 2010......................................................................................................................... 12
Create a Database on the command line............................................................................ 17
Enable TCP/IP for jdbc data connections............................................................................................. 17
Which port am I running on?............................................................................................ 17
Loading C# Stored Functions............................................................................................................... 18
Step1................................................................................................................................... 18
Step 2.................................................................................................................................. 18
Step 3.................................................................................................................................. 20
Step 4.................................................................................................................................. 20
Step 5.................................................................................................................................. 21
XA support............................................................................................................................................ 22
Running the MS DTC Service.......................................................................................... 23
Set Authentication DLL......................................................................................................................... 23
Run a DBImport.................................................................................................................................... 24
Backup and Restore the Database....................................................................................................... 25
Appendix.............................................................................................................................................. 25
Can’t create your database in SQL Server Management................................................ 25
TAFJ fails with c# stored procedures with HostProtectionException............................... 28
JDBC Driver Fails With: Failed to load the sqljdbc_auth.dll or “This driver is not
configured for integrated authentication”......................................................................... 29
SQLCMD Errors: Fails to Start....................................................................................... 29
Page 3
TAFJ-M S S QL I n s t all
Create Assembly fails with: SAFE or EXTERNAL_ACCESS option failed because the ‘clr
strict security’ option of sp_configure is set to 1.............................................................. 30
Page 4
TAFJ-M S S QL I n s t all
Copyri g h t
Copyright © Temenos Headquarters SA 2009-2019. All rights reserved.
This document contains proprietary information that is protected by copyright. No part of this document may
be reproduced, transmitted, or made available directly or indirectly to a third party without the express
written agreement of TEMENOS UK Limited. Receipt of this material directly TEMENOS UK Limited
constitutes its express permission to copy. Permission to use or copy this document expressly excludes
modifying it for any purpose, or using it to create a derivative therefrom.
Temenos Headquarters SA
2 Rue de l’Ecole-de-Chimie,
CH - 1205 Geneva,
Switzerland
Please include your name, company, address, and telephone and fax numbers, and email
address if applicable. [email protected]
Page 5
TAFJ-M S S QL I n s t all
The below instructions describe how to get a SQL Server 2012 Express Edition in a state
where the user can do a DBImport. This assumes that SQL Server 2012 Express Edition
and TAFJ have already been installed and that the install directory of TAFJ is %TAFJ_HOME
%. When downloading SQLServer 2012 Express Edition also download and install SQL
Server Management Studio Express (Tools only) and LocalDB.
Page 6
TAFJ-M S S QL I n s t all
After starting Microsoft SQL Server Management, in the upper left hand corner click
“Connect”. A pop up should appear as below with the <Name of your PC>\SQLEXPRESS.
Click “Connect”.
Page 7
TAFJ-M S S QL I n s t all
Right-click on “Database”, then “New Database” and you should have the following.
Page 8
TAFJ-M S S QL I n s t all
NOTE: The client can choose any collation, but care should be taken to make sure the
collation accommodates ‘CASE-SENSITIVE’ as this is a requirement for TAFJ.
Page 9
TAFJ-M S S QL I n s t all
Now connect to your database in Visual Studio by ToolsConnect to Database, you will then
see the following:
Page 10
TAFJ-M S S QL I n s t all
Click “Continue”
Page 11
TAFJ-M S S QL I n s t all
Page 12
TAFJ-M S S QL I n s t all
Start Visual Studio 2010, click on FileNew Project. Select the database tab, then
SQL Server, then “Visual C# SQL CLR Database Project”.
Page 13
TAFJ-M S S QL I n s t all
You then should see a pop-up with your database that you just created. Select it and then hit
“OK”.
Page 14
TAFJ-M S S QL I n s t all
If you don’t see it, hit “Add New Reference” and you will be redirected to the following screen
in which case you put your computer name in “Server Name”, hit refresh, then select your
database.
Page 15
TAFJ-M S S QL I n s t all
Page 16
TAFJ-M S S QL I n s t all
Page 17
TAFJ-M S S QL I n s t all
Page 18
TAFJ-M S S QL I n s t all
Go to %TAFJ_HOME%\dbscripts\ms-sql.
Page 19
TAFJ-M S S QL I n s t all
St e p 1
Alter the script csharpload.sql to your target database, default is master, (Temenos
recommends something other than this), and the full path to TAFJSQLServer.dll
St e p 2
Startup sqlcmd with: sqlcmd –S<Computer Name>\SQLEXPRESS -E -h-1 -y 0
Page 20
TAFJ-M S S QL I n s t all
St e p 3
Now load the c# stored functions (the output of this will go to output.txt in this example):
(Note that output.txt will only contain "Changed database context to TESTDB if objects
already created)
St e p 4
Now verify that functions are loaded as below on the sqlcmd prompt:
1> SELECT ROUTINE_NAME FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_TYPE =
'FUNCTION' ORDER BY ROUTINE_NAME
2> GO
ROUTINE_NAME
------------------------------------------------------------------------
extractValueJS
FM
SM
tafjcat
tafjcats
tafjchar
tafjconvert
tafjcount
tafjdate
tafjdcount
tafjequal
tafjfget
tafjfield
tafjfields
tafjfmt
tafjget
tafjiconv
tafjlen
tafjlower
tafjmatches
tafjmatchfield
tafjoconv
tafjraise
tafjsub
tafjsubstrings
tafjsum
VM
Page 21
TAFJ-M S S QL I n s t all
St e p 5
- Alter the script csharpunload.sql to the database you want (default is master)
Page 22
TAFJ-M S S QL I n s t all
XA sup p o r t
A specific DLL has to be deployed to be able to perform XA transactions when a data source
is configured to use XA.
To enable XA please follow the following steps as instructed in the MS-SQL driver under, i.e.
sqljdbc_6.0\enu\xa\ xa_install.sql :
sqljdbc_6.0\enu\xa\x64\sqljdbc_xa.dll
sqljdbc_6.0\enu\xa\ xa_install.sql
4- In case of SQLJDBC_XA DTC_ERROR, make sure that the DTC service is correctly
configured and running:
Page 23
TAFJ-M S S QL I n s t all
The MS DTC service should be marked Automatic in Service Manager to make sure that it is running
when the SQL Server service is started. To enable MS DTC for XA transactions, you must follow these
steps:
1. Click the Start button, type dcomcnfg in the Start Search box, and then press ENTER to
open Component Services. You can also type %windir%\system32\comexp.msc in
the StartSearch box to open Component Services.
2. Expand Component Services, Computers, My Computer, and then Distributed Transaction
Coordinator.
3. Right-click Local DTC and then select Properties.
4. Click the Security tab on the Local DTC Properties dialog box.
5. Select the Enable XA Transactions check box, and then click OK. This will cause a MS DTC
service restart.
6. Click OK again to close the Properties dialog box, and then close Component Services.
7. Stop and then restart SQL Server to make sure that it syncs up with the MS DTC changes.
To get detailed information regarding XA support you could refer to the following MS-SQL
documentation.
https://docs.microsoft.com/en-us/sql/connect/jdbc/understanding-xa-transactions
Se t Auth e n t i c a t i o n DLL
Set TCP/IP enabled using SQL Server Configuration manager and then restart the SQL
Server service.
Generally, the SQLServer default port is 4333, but could be another one (such as 53963).
Use a tool such as tcpview if you are having issues discovering it and can’t find it in SQL
Server Configuration manager or refer back to section “Which port am I running on?” You
will need the port for the JDBC url which is shown below in “Run a DBImport”
set PATH=%PATH%;%TAFJ_HOME%\ext\sqljdbc_1.2\enu\auth\x64
or
set PATH=%PATH%;%TAFJ_HOME%\ext\sqljdbc_1.2\enu\auth\x86
Page 24
TAFJ-M S S QL I n s t all
Make sure you are using the 32 bit one if your JVM is 32 bit, or 64 bit with a 64 bit JVM,
otherwise you get an error such as the following:
Run a DBI m p o r t
Please refer to TAFJ-DBSetup documentation. Typical TAFJ properties for SQL Server
(using integrated security) are shown below.
temn.tafj.jdbc.url =
jdbc:sqlserver://localhost:1433;databaseName=TESTDB;integratedSecurity=true;
temn.tafj.jdbc.driver =
com.microsoft.sqlserver.jdbc.SQLServerDriver
temn.tafj.jdbc.username =
temn.tafj.jdbc.password =
Page 25
TAFJ-M S S QL I n s t all
You should also create a MSSQL user and grant him with DBO privilege.
temn.tafj.jdbc.url =
jdbc:sqlserver://localhost:1433;databaseName=TESTDB;
temn.tafj.jdbc.driver =
com.microsoft.sqlserver.jdbc.SQLServerDriver
temn.tafj.jdbc.username = sqlserveruser
temn.tafj.jdbc.password = sqlserveruserpwd
A restore example:
App e n d i x
Page 26
TAFJ-M S S QL I n s t all
Create a login for your user that must have admin privileges. In this case it is
roderickv
Page 27
TAFJ-M S S QL I n s t all
Put sqlserver in single instance mode by starting SQL Server Configuration Manager
Then click on “SQL Server Services”. On the right pane, right click on the SQL Server
running, then “Properties”
Then add –m as a startup property and restart the sql server service once changes are
applied.
Page 28
TAFJ-M S S QL I n s t all
The protected resources (only available with full trust) were: All
The demanded resources were: Synchronization
System.Security.HostProtectionException:
Page 29
TAFJ-M S S QL I n s t all
at System.RuntimeMethodHandle.PerformSecurityCheck(Object obj,
RuntimeMethodHandleInternal method, RuntimeType parent, UInt32 invocationFlags)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder
binder, Object[] parameters, CultureInfo culture)
at System.SecurityUtils.ConstructorInfoInvoke(ConstructorInfo ctor, Object[] args)
at System.Diagnostics.TraceUtils.GetRuntimeObject(String className, Type baseType,
String initializeData)
at System.Diagnostics.TypedElement.BaseGetRuntimeObject()
at System.Diagnostics.ListenerElement.GetRuntimeObject()
at System.Diagnostics.ListenerElementsCollection.GetRuntimeObject()
at System.Diagnostics.TraceInternal.get_Listeners()
at System.Diagnostics.TraceInternal.WriteLine(String message)
at UserDefinedFunctions.tafjmatches(String sVal1, String sMask)
To fix this:
c. 2> GO
This occurs when the jdbc url includes integratedSecurity=true. Either the version of
sqljdbc_auth.dll is incorrect (you are using a 32 bit version on a 64 bit machine or vice versa)
or java is failing to load the sqljdbc_auth.dll
Description: After trying to start sqlcmd it complains with Named Pipe error
Page 30
TAFJ-M S S QL I n s t all
C:\data\srcT24\rtc>sqlcmd -h-1 -y 0
Named Pipes Provider: Could not open a connection to SQL Server [2].
Sqlcmd: Error: Microsoft SQL Native Client : An error has occurred while establishing a
connection to the server. When connecting to SQL Server 2005, this failure may be caused
by the fact that under the default settings SQL Server does not allow remote connections..
Description: Create assembly will not work in SQL Server 2017 because of the new
security features introduced in 2017. While executing the csharpload script, “CREATE
ASSEMBLY TAFJSQLServer from '<<full path to TAFJSQLServer.dll including
TAFJSQLServer.dll in name>>' WITH PERMISSION_SET = SAFE” command will throw the
below shown error message,
RECONFIGURE;
Page 31
TAFJ-M S S QL I n s t all
RECONFIGURE;
If there is any issue regarding access rights while executing the above commands, then set
the trustworthy to on as follows,
Page 32