diff --git a/openid-connect-server-webapp/src/main/resources/db/clients.sql b/openid-connect-server-webapp/src/main/resources/db/hsql/clients.sql
similarity index 100%
rename from openid-connect-server-webapp/src/main/resources/db/clients.sql
rename to openid-connect-server-webapp/src/main/resources/db/hsql/clients.sql
diff --git a/openid-connect-server-webapp/src/main/resources/db/tables/hsql_database_tables.sql b/openid-connect-server-webapp/src/main/resources/db/hsql/hsql_database_tables.sql
similarity index 100%
rename from openid-connect-server-webapp/src/main/resources/db/tables/hsql_database_tables.sql
rename to openid-connect-server-webapp/src/main/resources/db/hsql/hsql_database_tables.sql
diff --git a/openid-connect-server-webapp/src/main/resources/db/tables/loading_temp_tables.sql b/openid-connect-server-webapp/src/main/resources/db/hsql/loading_temp_tables.sql
similarity index 100%
rename from openid-connect-server-webapp/src/main/resources/db/tables/loading_temp_tables.sql
rename to openid-connect-server-webapp/src/main/resources/db/hsql/loading_temp_tables.sql
diff --git a/openid-connect-server-webapp/src/main/resources/db/scopes.sql b/openid-connect-server-webapp/src/main/resources/db/hsql/scopes.sql
similarity index 100%
rename from openid-connect-server-webapp/src/main/resources/db/scopes.sql
rename to openid-connect-server-webapp/src/main/resources/db/hsql/scopes.sql
diff --git a/openid-connect-server-webapp/src/main/resources/db/tables/security-schema.sql b/openid-connect-server-webapp/src/main/resources/db/hsql/security-schema.sql
similarity index 100%
rename from openid-connect-server-webapp/src/main/resources/db/tables/security-schema.sql
rename to openid-connect-server-webapp/src/main/resources/db/hsql/security-schema.sql
diff --git a/openid-connect-server-webapp/src/main/resources/db/users.sql b/openid-connect-server-webapp/src/main/resources/db/hsql/users.sql
similarity index 100%
rename from openid-connect-server-webapp/src/main/resources/db/users.sql
rename to openid-connect-server-webapp/src/main/resources/db/hsql/users.sql
diff --git a/openid-connect-server-webapp/src/main/resources/db/tables/mysql_database_tables.sql b/openid-connect-server-webapp/src/main/resources/db/mysql/mysql_database_tables.sql
similarity index 100%
rename from openid-connect-server-webapp/src/main/resources/db/tables/mysql_database_tables.sql
rename to openid-connect-server-webapp/src/main/resources/db/mysql/mysql_database_tables.sql
diff --git a/openid-connect-server-webapp/src/main/resources/db/mysql/security-schema.sql b/openid-connect-server-webapp/src/main/resources/db/mysql/security-schema.sql
new file mode 100644
index 000000000..bc5d70b88
--- /dev/null
+++ b/openid-connect-server-webapp/src/main/resources/db/mysql/security-schema.sql
@@ -0,0 +1,14 @@
+--
+-- Tables for Spring Security's user details service
+--
+
+create table IF NOT EXISTS users(
+ username varchar(50) not null primary key,
+ password varchar(50) not null,
+ enabled boolean not null);
+
+ create table IF NOT EXISTS authorities (
+ username varchar(50) not null,
+ authority varchar(50) not null,
+ constraint fk_authorities_users foreign key(username) references users(username),
+ constraint ix_authority unique (username,authority));
\ No newline at end of file
diff --git a/openid-connect-server-webapp/src/main/resources/db/clients_oracle.sql b/openid-connect-server-webapp/src/main/resources/db/oracle/clients_oracle.sql
similarity index 100%
rename from openid-connect-server-webapp/src/main/resources/db/clients_oracle.sql
rename to openid-connect-server-webapp/src/main/resources/db/oracle/clients_oracle.sql
diff --git a/openid-connect-server-webapp/src/main/resources/entity-mappings_oracle.xml b/openid-connect-server-webapp/src/main/resources/db/oracle/entity-mappings_oracle.xml
similarity index 100%
rename from openid-connect-server-webapp/src/main/resources/entity-mappings_oracle.xml
rename to openid-connect-server-webapp/src/main/resources/db/oracle/entity-mappings_oracle.xml
diff --git a/openid-connect-server-webapp/src/main/resources/db/tables/loading_temp_tables_oracle.sql b/openid-connect-server-webapp/src/main/resources/db/oracle/loading_temp_tables_oracle.sql
similarity index 100%
rename from openid-connect-server-webapp/src/main/resources/db/tables/loading_temp_tables_oracle.sql
rename to openid-connect-server-webapp/src/main/resources/db/oracle/loading_temp_tables_oracle.sql
diff --git a/openid-connect-server-webapp/src/main/resources/db/tables/oracle_database_tables.sql b/openid-connect-server-webapp/src/main/resources/db/oracle/oracle_database_tables.sql
similarity index 100%
rename from openid-connect-server-webapp/src/main/resources/db/tables/oracle_database_tables.sql
rename to openid-connect-server-webapp/src/main/resources/db/oracle/oracle_database_tables.sql
diff --git a/openid-connect-server-webapp/src/main/resources/db/scopes_oracle.sql b/openid-connect-server-webapp/src/main/resources/db/oracle/scopes_oracle.sql
similarity index 100%
rename from openid-connect-server-webapp/src/main/resources/db/scopes_oracle.sql
rename to openid-connect-server-webapp/src/main/resources/db/oracle/scopes_oracle.sql
diff --git a/openid-connect-server-webapp/src/main/resources/db/tables/security-schema_oracle.sql b/openid-connect-server-webapp/src/main/resources/db/oracle/security-schema_oracle.sql
similarity index 100%
rename from openid-connect-server-webapp/src/main/resources/db/tables/security-schema_oracle.sql
rename to openid-connect-server-webapp/src/main/resources/db/oracle/security-schema_oracle.sql
diff --git a/openid-connect-server-webapp/src/main/resources/db/users_oracle.sql b/openid-connect-server-webapp/src/main/resources/db/oracle/users_oracle.sql
similarity index 100%
rename from openid-connect-server-webapp/src/main/resources/db/users_oracle.sql
rename to openid-connect-server-webapp/src/main/resources/db/oracle/users_oracle.sql
diff --git a/openid-connect-server-webapp/src/main/resources/db/tables/psql_database_tables.sql b/openid-connect-server-webapp/src/main/resources/db/psql/psql_database_tables.sql
similarity index 100%
rename from openid-connect-server-webapp/src/main/resources/db/tables/psql_database_tables.sql
rename to openid-connect-server-webapp/src/main/resources/db/psql/psql_database_tables.sql
diff --git a/openid-connect-server-webapp/src/main/resources/db/psql/security-schema.sql b/openid-connect-server-webapp/src/main/resources/db/psql/security-schema.sql
new file mode 100644
index 000000000..bc5d70b88
--- /dev/null
+++ b/openid-connect-server-webapp/src/main/resources/db/psql/security-schema.sql
@@ -0,0 +1,14 @@
+--
+-- Tables for Spring Security's user details service
+--
+
+create table IF NOT EXISTS users(
+ username varchar(50) not null primary key,
+ password varchar(50) not null,
+ enabled boolean not null);
+
+ create table IF NOT EXISTS authorities (
+ username varchar(50) not null,
+ authority varchar(50) not null,
+ constraint fk_authorities_users foreign key(username) references users(username),
+ constraint ix_authority unique (username,authority));
\ No newline at end of file
diff --git a/openid-connect-server-webapp/src/main/webapp/WEB-INF/data-context.xml b/openid-connect-server-webapp/src/main/webapp/WEB-INF/data-context.xml
index 13c16ddb7..8143fdc81 100644
--- a/openid-connect-server-webapp/src/main/webapp/WEB-INF/data-context.xml
+++ b/openid-connect-server-webapp/src/main/webapp/WEB-INF/data-context.xml
@@ -32,14 +32,14 @@
-
+
-
+
-
-
-
-
+
+
+
+
@@ -48,7 +48,7 @@
+ src/main/resources/db/mysql/mysql_database_tables.sql -->
+ src/main/resources/db/psql/psql_database_tables.sql -->
+ src/main/resources/db/oracle/oracle_database_tables.sql -->
-
+