From 7f486bd6b4f60f47b0c6e212a70ca37c6ab901da Mon Sep 17 00:00:00 2001
From: brinn <brinn>
Date: Tue, 22 May 2007 14:51:37 +0000
Subject: [PATCH] Add simple error handling for the case where the db user
 already exists.

SVN: 168
---
 .../ch/systemsx/cisd/dbmigration/DBMigrationEngine.java   | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/dbmigration/source/java/ch/systemsx/cisd/dbmigration/DBMigrationEngine.java b/dbmigration/source/java/ch/systemsx/cisd/dbmigration/DBMigrationEngine.java
index 1f79f499511..4d30c0935bc 100644
--- a/dbmigration/source/java/ch/systemsx/cisd/dbmigration/DBMigrationEngine.java
+++ b/dbmigration/source/java/ch/systemsx/cisd/dbmigration/DBMigrationEngine.java
@@ -95,7 +95,13 @@ public class DBMigrationEngine
             String createUserSQL = createScript("createUser.sql", owner, databaseName);
             String createDatabaseSQL = createScript("createDatabase.sql", owner, databaseName);
             
-            template.execute(createUserSQL);
+            try
+            {
+                template.execute(createUserSQL);
+            } catch (BadSqlGrammarException ex)
+            {
+                // TODO: have better error checking here.
+            }
             template.execute(createDatabaseSQL);
             
             migrateOrCreate(version);
-- 
GitLab