Skip to content

Commit

Permalink
#442: Migrate SQL Server virtual schema to its own repository
Browse files Browse the repository at this point in the history
  • Loading branch information
chiaradiamarcelo committed Jan 12, 2021
1 parent 4febc54 commit 51218a7
Show file tree
Hide file tree
Showing 22 changed files with 14 additions and 1,676 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ Running the Virtual Schema requires a Java Runtime version 9 or later.
| [Java Hamcrest](http://hamcrest.org/JavaHamcrest/) | Checking for conditions in code via matchers | BSD License |
| [JUnit](https://junit.org/junit5) | Unit testing framework | Eclipse Public License 1.0 |
| [Mockito](http://site.mockito.org/) | Mocking framework | MIT License |
| [Microsoft JDBC Driver for SQL Server][sql-server-jdbc-driver] | JDBC driver for SQL Server database | MIT License |
| [Testcontainers](https://www.testcontainers.org/) | Container-based integration tests | MIT License |
| [Test Database Builder][test-bd-builder] | Fluent database interfaces for testing | MIT License |

Expand All @@ -165,7 +164,6 @@ Running the Virtual Schema requires a Java Runtime version 9 or later.
[hbase-server]: http://hbase.apache.org/
[hive-jdbc-driver]: https://github.com/apache/hive/tree/master/jdbc/src/java/org/apache/hive/jdbc
[maven-enforcer-plugin]: http://maven.apache.org/enforcer/maven-enforcer-plugin/
[sql-server-jdbc-driver]: https://github.com/microsoft/mssql-jdbc
[sonatype-oss-index-maven-plugin]: https://sonatype.github.io/ossindex-maven/maven-plugin/
[test-bd-builder]: https://github.com/exasol/test-db-builder-java
[versions-maven-plugin]: https://www.mojohaus.org/versions-maven-plugin/
Expand All @@ -182,7 +180,7 @@ Running the Virtual Schema requires a Java Runtime version 9 or later.
[postgresql-dialect-doc]: https://github.com/exasol/postgresql-virtual-schema/blob/main/doc/dialects/postgresql.md
[redshift-dialect-doc]: doc/dialects/redshift.md
[sap-hana-dialect-doc]: doc/dialects/saphana.md
[sql-server-dialect-doc]: doc/dialects/sql_server.md
[sql-server-dialect-doc]: https://github.com/exasol/sqlserver-virtual-schema/blob/main/doc/user_guide/sqlserver_user_guide.md
[sybase-dialect-doc]: doc/dialects/sybase.md
[teradata-dialect-doc]: doc/dialects/teradata.md

Expand Down
14 changes: 9 additions & 5 deletions doc/changes/changes_6.0.0.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
# Exasol Virtual Schemas 6.0.0, released 2021-XX-XX

Code name: Migrated Oracle and DB2 dialect implementations to their own repository.
Code name: Migrated Oracle, DB2 and SQL Server dialect implementations to their own repository.

## Summary

Please we aware you can not create Oracle nor DB2 Virtual Schemas using this JAR anymore.
Oracle dialect implementation has been migrated to https://github.com/exasol/oracle-virtual-schema.
DB2 dialect implementation has been migrated to https://github.com/exasol/db2-virtual-schema.
Please we aware you can not create Oracle, DB2 nor SQL Server Virtual Schemas using this JAR anymore.
- Oracle dialect implementation has been migrated to https://github.com/exasol/oracle-virtual-schema.
- DB2 dialect implementation has been migrated to https://github.com/exasol/db2-virtual-schema.
- SQL Server dialect implementation has been migrated to https://github.com/exasol/sqlserver-virtual-schema.

## Refactoring

* #438: Removed Oracle dialect implementation as it has been migrated to https://github.com/exasol/mysql-virtual-schema.
* #440: Removed DB2 dialect implementation as it has been migrated to https://github.com/exasol/db2-virtual-schema.
* #442: Removed SQL Server dialect implementation as it has been migrated to https://github.com/exasol/sqlserver-virtual-schema.

## Dependency updates

* Removed `org.testcontainers:oracle-xe:1.15.0`
* Removed `com.oracle.ojdbc:ojdbc8:19.3.0.0`
* Removed `com.oracle.ojdbc:ojdbc8:19.3.0.0`
* Removed `org.testcontainers:mssqlserver:1.15.0`
* Removed `com.microsoft.sqlserver:mssql-jdbc:8.4.1.jre11`
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ List of enabled integration tests:

* ExasolSqlDialectIT (in [exasol-virtual-schema](https://github.com/exasol/exasol-virtual-schema) repository)
* PostgreSQLSqlDialectIT (in [postgresql-virtual-schema](https://github.com/exasol/postgresql-virtual-schema) repository)
* SqlServerSqlDialectIT

## Executing Disabled Integration Tests

Expand Down
129 changes: 1 addition & 128 deletions doc/dialects/sql_server.md
Original file line number Diff line number Diff line change
@@ -1,130 +1,3 @@
# SQL Server SQL Dialect

[Microsoft SQL Server](https://www.microsoft.com/en-us/sql-server/sql-server-2017) is a Relational Database Management System (RDBMS) developed by Microsoft.

## Registering the JDBC Driver in EXAOperation

First download the [SQL Server JDBC driver](https://github.com/microsoft/mssql-jdbc/releases).
We recommend using a `jre8` driver.

Now register the driver in EXAOperation:

1. Click "Software"
1. Switch to tab "JDBC Drivers"
1. Click "Browse..."
1. Select JDBC driver file
1. Click "Upload"
1. Click "Add"
1. In a dialog "Add EXACluster JDBC driver" configure the JDBC driver (see below)

You need to specify the following settings when adding the JDBC driver via EXAOperation.

| Parameter | Value |
|-----------|-----------------------------------------------------|
| Name | `SQLSERVER` |
| Main | `com.microsoft.sqlserver.jdbc.SQLServerDriver` |
| Prefix | `jdbc:sqlserver:` |
| Files | `mssql-jdbc-<version>.jre8.jar` |

## Uploading the JDBC Driver to EXAOperation

1. [Create a bucket in BucketFS](https://docs.exasol.com/administration/on-premise/bucketfs/create_new_bucket_in_bucketfs_service.htm)
1. Upload the driver to BucketFS

## Installing the Adapter Script

Upload the latest available release of [Virtual Schema JDBC Adapter](https://github.com/exasol/virtual-schemas/releases) to Bucket FS.

Then create a schema to hold the adapter script.

```sql
CREATE SCHEMA SCHEMA_FOR_VS_SCRIPT;
```

The SQL statement below creates the adapter script, defines the Java class that serves as entry point and tells the UDF framework where to find the libraries (JAR files) for Virtual Schema and database driver.

```sql
CREATE OR REPLACE JAVA ADAPTER SCRIPT SCHEMA_FOR_VS_SCRIPT.ADAPTER_SCRIPT_SQLSERVER AS
%scriptclass com.exasol.adapter.RequestDispatcher;
%jar /buckets/<BFS service>/<bucket>/virtual-schema-dist-8.0.0-bundle-6.0.0.jar;
%jar /buckets/<BFS service>/<bucket>/mssql-jdbc-<version>.jre8.jar;
/
```

## Defining a Named Connection

Define the connection to SQL Server as shown below. We recommend using TLS to secure the connection.

```sql
CREATE OR REPLACE CONNECTION SQLSERVER_JDBC_CONNECTION
TO 'jdbc:sqlserver://<server name>:<port>'
USER '<user>'
IDENTIFIED BY '<passsword>';
```

## Creating a Virtual Schema

Below you see how an SQL Server Virtual Schema is created.

```sql
CREATE VIRTUAL SCHEMA <virtual schema name>
USING SCHEMA_FOR_VS_SCRIPT.ADAPTER_SCRIPT_SQLSERVER
WITH
SQL_DIALECT = 'SQLSERVER'
CONNECTION_NAME = 'SQLSERVER_JDBC_CONNECTION'
CATALOG_NAME = '<database name>'
SCHEMA_NAME = '<schema name>';
```


Please, do not forget to specify the `SCHEMA_NAME` property.

Provide the SQL server's database name using one of the suggested ways:
1. Via the `CATALOG_NAME` property;
1. Via connection string definition: 'jdbc:sqlserver://<server name>:<port>/<database name>';

## Data Types Conversion

MS SERVER Data Type | Supported | Converted Exasol Data Type| Known limitations
--------------------|-----------|---------------------------|-------------------
BIGINT | ✓ | DECIMAL |
BINARY | × | |
BIT | ✓ | BOOLEAN |
CHAR | ✓ | CHAR |
DATE | ✓ | DATE |
DATETIME | ✓ | TIMESTAMP |
DATETIME2 | ✓ | TIMESTAMP |
DATETIMEOFFSET | ✓ | VARCHAR(34) |
DECIMAL | ✓ | DECIMAL |
FLOAT | ✓ | DOUBLE PRECISION |
GEOMETRY | × | |
GEOGRAPHY | × | |
HIERARCHYID | × | |
IMAGE | × | |
INT | ✓ | DECIMAL |
MONEY | ✓ | DECIMAL |
NCHAR | ✓ | CHAR |
NTEXT | ✓ | VARCHAR(2000000) |
NVARCHAR | ✓ | VARCHAR |
NUMERIC | ✓ | DECIMAL |
SQL_VARIANT | × | |
REAL | ✓ | DOUBLE PRECISION |
ROWVERSION | × | |
SMALLDATETIME | ✓ | TIMESTAMP |
SMALLINT | ✓ | DECIMAL |
SMALLMONEY | ✓ | DECIMAL |
TEXT | ✓ | VARCHAR(2000000) |
TIME | ✓ | VARCHAR(16) |
TINYINT | ✓ | DECIMAL |
UNIQUEIDENTIFIER | ✓ | CHAR(36) |
VARBINARY | × | |
VARCHAR | ✓ | VARCHAR |
XML | × | |

## Testing information

In the following matrix you find combinations of JDBC driver and dialect version that we tested.

| Virtual Schema Version | SQL SERVER Version | Driver Name | Driver Version |
|------------------------|------------------------------|-------------------|----------------|
| Latest | 2019-CU6-ubuntu-16.04 8.0.20 | MS SQL JDBC JRE 8 | 8.4.0 |
The SQL Server Virtual Schema has been migrated to its [own repository](https://github.com/exasol/sqlserver-virtual-schema/).
17 changes: 3 additions & 14 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -225,17 +225,6 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>8.4.1.jre11</version>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>mssqlserver</artifactId>
<version>${org.testcontainers.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.exasol</groupId>
<artifactId>test-db-builder-java</artifactId>
Expand Down Expand Up @@ -332,9 +321,9 @@
<!-- Set the highest log level for coverage testing, so that we have a chance to reach branches
<property> in the logging lambdas too. -->
<argLine>-Djava.util.logging.config.file=src/test/resources/logging.properties ${argLine}</argLine>
<includes>
<include>SqlServerSqlDialectIT.java</include>
</includes>
<excludes>
<include>HiveSqlDialectIT.java</include>
</excludes>
</configuration>
<executions>
<execution>
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 51218a7

Please sign in to comment.