Skip to content

Commit

Permalink
HHH-10148 - SpatialDialect for SqlServer2012
Browse files Browse the repository at this point in the history
  • Loading branch information
maesenka committed Mar 7, 2019
1 parent 5974998 commit f68d08a
Show file tree
Hide file tree
Showing 22 changed files with 446 additions and 118 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ hibernate.dialect org.hibernate.spatial.dialect.db2.DB2SpatialDialect
hibernate.connection.driver_class com.ibm.db2.jcc.DB2Driver
hibernate.connection.url jdbc:db2://localhost:50000/hibern8
hibernate.connection.username db2inst1
hibernate.connection.password dbinst1-pwd
hibernate.connection.password password


hibernate.connection.pool_size 5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

hibernate.dialect org.hibernate.spatial.dialect.mysql.MySQL56SpatialDialect
hibernate.connection.driver_class com.mysql.jdbc.Driver
hibernate.connection.url jdbc:mysql://hibern8.cctaez8ywvn2.eu-west-1.rds.amazonaws.com:3306/hibernate_orm_test
hibernate.connection.url jdbc:mysql://localhost:3306/hibern8
hibernate.connection.username hibernateormtest
hibernate.connection.password hibernateormtest

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
jdbcDependency "com.oracle.jdbc:ojdbc6:11.1.0.7.0"
jdbcDependency "mysql:mysql-connector-java:8.0.12"
25 changes: 25 additions & 0 deletions hibernate-spatial/databases/mysql8/resources/hibernate.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#
# Hibernate, Relational Persistence for Idiomatic Java
#
# License: GNU Lesser General Public License (LGPL), version 2.1 or later.
# See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
#

hibernate.dialect org.hibernate.spatial.dialect.mysql.MySQL56SpatialDialect
hibernate.connection.driver_class com.mysql.jdbc.Driver
hibernate.connection.url jdbc:mysql://localhost:3306/hibern8
hibernate.connection.username hibernateormtest
hibernate.connection.password hibernateormtest


hibernate.connection.pool_size 5

hibernate.show_sql true
hibernate.format_sql true

hibernate.max_fetch_depth 5

hibernate.cache.region_prefix hibernate.test
hibernate.cache.region.factory_class org.hibernate.testing.cache.CachingRegionFactory


Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
jdbcDependency "com.oracle.jdbc:ojdbc6:11.1.0.7.0"
jdbcDependency "com.oracle:ojdbc7:12.1.0.2.0"
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

hibernate.dialect org.hibernate.spatial.dialect.oracle.OracleSpatial10gDialect
hibernate.connection.driver_class oracle.jdbc.driver.OracleDriver
hibernate.connection.url jdbc:oracle:thin:@localhost:1521/orcl12c
hibernate.connection.url jdbc:oracle:thin:@localhost:1521:ORCLCDB
hibernate.connection.username C##hibernate
hibernate.connection.password hibernate

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
jdbcDependency "com.oracle.jdbc:ojdbc6:11.1.0.7.0"
jdbcDependency "com.oracle:ojdbc7:12.1.0.2.0"
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

hibernate.dialect org.hibernate.spatial.dialect.oracle.OracleSpatial10gDialect
hibernate.connection.driver_class oracle.jdbc.driver.OracleDriver
hibernate.connection.url jdbc:oracle:thin:@localhost:1521/orcl12c
hibernate.connection.url jdbc:oracle:thin:@localhost:1521:ORCLCDB
hibernate.connection.username C##hibernate
hibernate.connection.password hibernate

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
jdbcDependency "com.oracle:ojdbc7:12.1.0.2.0"

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

hibernate.dialect org.hibernate.spatial.dialect.oracle.OracleSpatialSDO10gDialect
hibernate.connection.driver_class oracle.jdbc.driver.OracleDriver
hibernate.connection.url jdbc:oracle:thin:@localhost:1521/orcl12c
hibernate.connection.url jdbc:oracle:thin:@localhost:1521:ORCLCDB
hibernate.connection.username C##hibernate
hibernate.connection.password hibernate

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
hibernate.test.new_metadata_mappings = true
hibernate.dialect org.hibernate.spatial.dialect.postgis.PostgisPG95Dialect
hibernate.connection.driver_class org.postgresql.Driver
hibernate.connection.url jdbc:postgresql://hbpg96.cctaez8ywvn2.eu-west-1.rds.amazonaws.com:5432/hibernate
hibernate.connection.username hibbrtru
hibernate.connection.password QilTygcxHwk1
hibernate.connection.url jdbc:postgresql://localhost:9432
hibernate.connection.username hibern8
hibernate.connection.password hibern8


hibernate.connection.pool_size 5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ hibernate.dialect org.hibernate.spatial.dialect.sqlserver.SqlServer2008SpatialDi
hibernate.connection.driver_class com.microsoft.sqlserver.jdbc.SQLServerDriver
hibernate.connection.url jdbc:sqlserver://localhost:1433;databaseName=TestDb
hibernate.connection.username hibern8
hibernate.connection.password hibern8Pass
hibernate.connection.password langpaswoord123A%1


hibernate.connection.pool_size 5
Expand Down
11 changes: 11 additions & 0 deletions hibernate-spatial/databases/sqlserver2012_spatial/matrix.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
repositories {
mavenLocal( )
}

jdbcDependency 'com.microsoft.sqlserver:mssql-jdbc:6.4.0.jre8'
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#
# Hibernate, Relational Persistence for Idiomatic Java
#
# License: GNU Lesser General Public License (LGPL), version 2.1 or later.
# See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
#

hibernate.dialect org.hibernate.spatial.dialect.sqlserver.SqlServer2012SpatialDialect
hibernate.connection.driver_class com.microsoft.sqlserver.jdbc.SQLServerDriver
hibernate.connection.url jdbc:sqlserver://localhost:1433;databaseName=TestDb
hibernate.connection.username hibern8
hibernate.connection.password hibern8Pass


hibernate.connection.pool_size 5

hibernate.show_sql true
hibernate.format_sql true

hibernate.max_fetch_depth 5

hibernate.cache.region_prefix hibernate.test
hibernate.cache.region.factory_class org.hibernate.testing.cache.CachingRegionFactory
78 changes: 78 additions & 0 deletions hibernate-spatial/scripts/build-docker-db2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#!/usr/bin/env bash

WD=$(dirname $0)

docker run -h db2server_db2_22 \
--name db2_11 \
-p 50000:50000 -p 55000:55000\
--privileged=true \
--env-file db2_11_env \
-v ${WD}/../../../hibernate-spatial-docker-dbs/db2_11 \
--detach ibmcom/db2express-c:latest

#The followin steps need to be executed
#(This will need to end up in a script)
#
## First connect to the docker and switch to user db2inst
# docker exec -i -t db2 /bin/bash
#
# su - db2inst1

#
## create the database with 8K pagesize , connect to it and enable
#
#db2 create database hibern8 pagesize 8 k

#db2 connect to hibern8

#db2se enable_db hibern8

## generate the ewkt.sql script:
#cat > ewkt.sql <<EOF
#create or replace function db2gse.asewkt(geometry db2gse.st_geometry)
#returns clob(2G)
#specific db2gse.asewkt1
#language sql
#deterministic
#no external action
#reads sql data
#return 'srid=' || varchar(db2gse.st_srsid(geometry)) || ';' || db2gse.st_astext(geometry);
#
#create or replace function db2gse.geomfromewkt(instring varchar(32000))
#returns db2gse.st_geometry
#specific db2gse.fromewkt1
#language sql
#deterministic
#no external action
#reads sql data
#return db2gse.st_geometry(
#substr(instring,posstr(instring,';')+1, length(instring) - posstr(instring,';')),
#integer(substr(instring,posstr(instring,'=')+1,posstr(instring,';')-(posstr(instring,'=')+1))));
#
#create transform for db2gse.st_geometry ewkt (
# from sql with function db2gse.asewkt(db2gse.st_geometry),
# to sql with function db2gse.geomfromewkt(varchar(32000)) );
#
#drop transform db2_program for db2gse.st_geometry;
#create transform for db2gse.st_geometry db2_program (
# from sql with function db2gse.asewkt(db2gse.st_geometry),
# to sql with function db2gse.geomfromewkt(varchar(32000)) );
#EOF

## run the ewkt.sql script (see hibernate documentation)
#db2 -tvf ./ewkt.sql


### generate the EPSPG:4326 SRS
#db2se create_srs hibern8 \
# -srsName EPSG4326 \
# -srsId 4326 \
# -coordsysName GCS_WGS_1984 \
# -xOffset -180 \
# -xScale 1000000 \
# -yOffset -90 \
# -zOffset 0 \
# -zScale 1 \
# -mOffset 0 \
# -mScale 1
#
15 changes: 15 additions & 0 deletions hibernate-spatial/scripts/db2_11_env
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
LICENSE=accept
DB2INSTANCE=db2inst1
DB2INST1_PASSWORD=Eeyoim4Y
DBNAME=
BLU=false
ENABLE_ORACLE_COMPATIBILITY=false
UPDATEAVAIL=NO
TO_CREATE_SAMPLEDB=false
REPODB=false
IS_OSXFS=false
PERSISTENT_HOME=true
HADR_ENABLED=false
ETCD_ENDPOINT=
ETCD_USERNAME=
ETCD_PASSWORD=
Loading

0 comments on commit f68d08a

Please sign in to comment.