summaryrefslogtreecommitdiffstats
path: root/src/com/iciql/Db.java
diff options
context:
space:
mode:
authorJames Moger <james.moger@gmail.com>2012-09-18 08:22:50 -0400
committerJames Moger <james.moger@gmail.com>2012-09-18 08:22:50 -0400
commit86ccd88f1e06476c2f9c8f917a223c57399c18ba (patch)
tree31f21bd8a3bc8729c0c04c0ed9d4afb8debba9c5 /src/com/iciql/Db.java
parent6d73bccdc39d9ee70fc744424778271a2509403e (diff)
downloadiciql-86ccd88f1e06476c2f9c8f917a223c57399c18ba.tar.gz
iciql-86ccd88f1e06476c2f9c8f917a223c57399c18ba.zip
Fixed password bug in model generator tool (issue 7)
Diffstat (limited to 'src/com/iciql/Db.java')
-rw-r--r--src/com/iciql/Db.java22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/com/iciql/Db.java b/src/com/iciql/Db.java
index 6e23a59..d436b8d 100644
--- a/src/com/iciql/Db.java
+++ b/src/com/iciql/Db.java
@@ -31,7 +31,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
-import java.util.Properties;
import java.util.Set;
import javax.sql.DataSource;
@@ -158,6 +157,15 @@ public class Db {
throw new IciqlException(e);
}
}
+
+ public static Db open(String url, String user, char[] password) {
+ try {
+ Connection conn = JdbcUtils.getConnection(null, url, user, password == null ? null : new String(password));
+ return new Db(conn);
+ } catch (SQLException e) {
+ throw new IciqlException(e);
+ }
+ }
/**
* Create a new database instance using a data source. This method is fast,
@@ -179,17 +187,7 @@ public class Db {
return new Db(conn);
}
- public static Db open(String url, String user, char[] password) {
- try {
- Properties prop = new Properties();
- prop.setProperty("user", user);
- prop.put("password", password);
- Connection conn = JdbcUtils.getConnection(null, url, prop);
- return new Db(conn);
- } catch (SQLException e) {
- throw new IciqlException(e);
- }
- }
+
/**
* Convenience function to avoid import statements in application code.