Beruflich Dokumente
Kultur Dokumente
R16
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
Page 2
TAFJ-M S S QL I n s t all
Table of Contents
Instructions for SQL Server 2012 Express Edition..................................................................................4
Ensure SQL Server is started..............................................................................................4
Create Database in Microsoft SQL Server Management.....................................................4
Connect to Database with Visual Studio 2010.....................................................................7
Starting from scratch with a New Visual Studio project—Connect to Database with Visual
Studio 2010....................................................................................................................... 10
Create a Database on the command line..........................................................................14
Enable TCP/IP for jdbc data connections............................................................................................. 14
Which port am I running on?..........................................................................................14
Loading C# Stored Functions............................................................................................................... 15
Step1................................................................................................................................. 15
Step 2................................................................................................................................ 15
Step 3................................................................................................................................ 17
Step 4................................................................................................................................ 17
Step 5................................................................................................................................ 18
Set Authentication DLL......................................................................................................................... 18
Run a DBImport.................................................................................................................................... 19
Backup and Restore the Database....................................................................................................... 19
Appendix.............................................................................................................................................. 20
Can’t create your database in SQL Server Management...............................................20
TAFJ fails with c# stored procedures with HostProtectionException..............................22
JDBC Driver Fails With: Failed to load the sqljdbc_auth.dll or “This driver is not
configured for integrated authentication”........................................................................23
SQLCMD Errors: Fails to Start......................................................................................23
Page 3
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.
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 4
TAFJ-M S S QL I n s t all
Right-click on “Database”, then “New Database” and you should have the following.
Page 5
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 6
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 7
TAFJ-M S S QL I n s t all
Click “Continue”
Page 8
TAFJ-M S S QL I n s t all
Page 9
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 10
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 11
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 12
TAFJ-M S S QL I n s t all
Page 13
TAFJ-M S S QL I n s t all
Page 14
TAFJ-M S S QL I n s t all
Go to %TAFJ_HOME%\dbscripts\ms-sql.
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 15
TAFJ-M S S QL I n s t all
Page 16
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 17
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)
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
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:
Page 18
TAFJ-M S S QL I n s t all
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
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 =
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:
Page 19
TAFJ-M S S QL I n s t all
App e n d i x
Create a login for your user that must have admin privileges. In this case it is
roderickv
Page 20
TAFJ-M S S QL I n s t all
securityadmin
serveradmin
setupadmin
processadmin
diskadmin
dbcreator
bulkadmin
BUILTIN\Users
L40RB1P1\roderickv
(12 rows affected)
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 21
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:
at System.RuntimeMethodHandle.PerformSecurityCheck(Object obj,
RuntimeMethodHandleInternal method, RuntimeType parent, UInt32 invocationFlags)
Page 22
TAFJ-M S S QL I n s t all
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
C:\data\srcT24\rtc>sqlcmd -h-1 -y 0
Page 23
TAFJ-M S S QL I n s t all
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..
Page 24