Skip to content

Commit 7980ce1

Browse files
committed
Teamcity MS SQL ODBC: Use more appropriate dialect and connection string.
We get many tests that fail in teardown with "System.ArgumentException : Unknown SQL type - SS_TIME_EX.". Use a dialect that avoids the TIME(7) server type to avoid this. Also, OdbcDriver allows concurrent readers. We must therefore enable this in the connection string too.
1 parent ded1803 commit 7980ce1

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

teamcity.build

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,16 @@
3838
<target name="setup-teamcity-sqlServerOdbc">
3939
<property name="nhibernate.connection.driver_class" value="NHibernate.Driver.OdbcDriver" />
4040
<property name="nhibernate.odbc.explicit_datetime_scale" value="3" />
41-
<property name="nhibernate.connection.connection_string" value="Driver={SQL Server Native Client 11.0};Server=.\SQLExpress;Database=nhibernateOdbc;Trusted_Connection=yes" />
41+
<!-- We need to use a dialect that avoids mapping DbType.Time to TIME on MSSQL. On modern SQL Server
42+
this becomes TIME(7). Later, such values cannot be read back over ODBC. The
43+
error we get is "System.ArgumentException : Unknown SQL type - SS_TIME_EX.". I don't know for certain
44+
why this occurs, but MS docs do say that for a client "compiled using a version of SQL Server Native
45+
Client prior to SQL Server 2008", TIME(7) cannot be converted back to the client. Assuming that .Net's
46+
OdbcDriver would be considered a "client compiled with a previous version", it would make sense. Anyway,
47+
using the MsSql2005Dialect avoids these test failures. -->
48+
<property name="nhibernate.dialect" value="NHibernate.Dialect.MsSql2005Dialect" />
49+
<!-- The OdbcDriver inherits SupportsMultipleOpenReaders=true from DriverBase, which requires Mars_Connection=yes for SQL Server. -->
50+
<property name="nhibernate.connection.connection_string" value="Driver={SQL Server Native Client 11.0};Server=.\SQLExpress;Database=nhibernateOdbc;Trusted_Connection=yes;Mars_Connection=yes;" />
4251
<property name="NHibernate.Test.IgnoreFail" value="true" />
4352
<property name="teamcity.last.result" value="${root.dir}/lib/teamcity/sqlServerOdbc/NHibernate.Test.last-results.xml" />
4453
</target>

0 commit comments

Comments
 (0)