From 6cca4464edb52a52cf4535b5f5a401edeea729c3 Mon Sep 17 00:00:00 2001 From: Konstantin Krivopustov Date: Tue, 21 Mar 2017 12:48:53 +0400 Subject: [PATCH] PL-8826 Use native Microsoft SQL Server JDBC driver --- .../cuba/core/sys/utils/DbUpdaterUtil.java | 2 +- .../core/sys/dbupdate/DbPropertiesTest.java | 10 +++++----- .../src/com/haulmont/cuba/bom.properties | 2 +- modules/global/src/cuba-credits.xml | 19 ++++++++++++++++++- 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/modules/core/src/com/haulmont/cuba/core/sys/utils/DbUpdaterUtil.java b/modules/core/src/com/haulmont/cuba/core/sys/utils/DbUpdaterUtil.java index e69a607b06..3762e26d8f 100644 --- a/modules/core/src/com/haulmont/cuba/core/sys/utils/DbUpdaterUtil.java +++ b/modules/core/src/com/haulmont/cuba/core/sys/utils/DbUpdaterUtil.java @@ -168,7 +168,7 @@ public class DbUpdaterUtil extends DbUpdaterEngine { dbDriver = "org.postgresql.Driver"; break; case "mssql": - dbDriver = "net.sourceforge.jtds.jdbc.Driver"; + dbDriver = "com.microsoft.sqlserver.jdbc.SQLServerDriver"; break; case "oracle": dbDriver = "oracle.jdbc.OracleDriver"; diff --git a/modules/core/test/com/haulmont/cuba/core/sys/dbupdate/DbPropertiesTest.java b/modules/core/test/com/haulmont/cuba/core/sys/dbupdate/DbPropertiesTest.java index 4ffd671490..d48889c4c3 100644 --- a/modules/core/test/com/haulmont/cuba/core/sys/dbupdate/DbPropertiesTest.java +++ b/modules/core/test/com/haulmont/cuba/core/sys/dbupdate/DbPropertiesTest.java @@ -31,16 +31,16 @@ public class DbPropertiesTest { DbProperties dbProperties = new DbProperties(null); Assert.assertNull(dbProperties.getProperties()); - dbProperties = new DbProperties("jdbc:jtds:sqlserver://localhost/refapp_6"); + dbProperties = new DbProperties("jdbc:sqlserver://localhost"); Assert.assertNull(dbProperties.getProperties()); } @Test public void testWithParamsPostgres() { - DbProperties dbProperties = new DbProperties("jdbc:jtds:sqlserver://localhost/refapp_6;currentSchema=Person"); + DbProperties dbProperties = new DbProperties("jdbc:sqlserver://localhost;databaseName=refapp_6;currentSchema=Person"); Map properties = dbProperties.getProperties(); Assert.assertNotNull(properties); - Assert.assertTrue(properties.size() == 1); + Assert.assertTrue(properties.size() == 2); Assert.assertTrue("Person".equals(properties.get("currentSchema"))); dbProperties = new DbProperties("jdbc:postgresql://localhost/refapp_6?currentSchema=Person"); @@ -60,10 +60,10 @@ public class DbPropertiesTest { @Test public void testWithParamsMssql() { - DbProperties dbProperties = new DbProperties("jdbc:jtds:sqlserver://localhost/refapp_6;currentSchema=Person"); + DbProperties dbProperties = new DbProperties("jdbc:sqlserver://localhost;databaseName=refapp_6;currentSchema=Person"); Map properties = dbProperties.getProperties(); Assert.assertNotNull(properties); - Assert.assertTrue(properties.size() == 1); + Assert.assertTrue(properties.size() == 2); Assert.assertTrue("Person".equals(properties.get("currentSchema"))); Assert.assertTrue("Person".equals(dbProperties.getCurrentSchemaProperty())); diff --git a/modules/global/src/com/haulmont/cuba/bom.properties b/modules/global/src/com/haulmont/cuba/bom.properties index e34a7221f1..df02361223 100644 --- a/modules/global/src/com/haulmont/cuba/bom.properties +++ b/modules/global/src/com/haulmont/cuba/bom.properties @@ -2,7 +2,7 @@ org.apache.tomcat/tomcat-servlet-api = 8.0.26 org.postgresql/postgresql = 9.4-1201-jdbc41 org.hsqldb/hsqldb = 2.3.3 -net.sourceforge.jtds/jtds = 1.3.1 +com.microsoft.sqlserver/mssql-jdbc = 6.1.0.jre8 mysql/mysql-connector-java = 5.1.38 commons-logging/commons-logging = 1.2 diff --git a/modules/global/src/cuba-credits.xml b/modules/global/src/cuba-credits.xml index 5364d9662e..e9cfa53cab 100644 --- a/modules/global/src/cuba-credits.xml +++ b/modules/global/src/cuba-credits.xml @@ -188,7 +188,24 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI ]]> - + + +