Skip to content

Commit

Permalink
Added ability to specify db connection properties.
Browse files Browse the repository at this point in the history
  • Loading branch information
johncurrier committed Mar 14, 2006
1 parent 778f0f1 commit 45ceb60
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/net/sourceforge/schemaspy/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ public static void main(String[] argv) {
try {
maxDetailedTables = Integer.parseInt(getParam(args, "-maxdet"));
} catch (Exception notSpecified) {}

Properties userProperties = new Properties();
String loc = getParam(args, "-connprops");
if (loc != null)
userProperties.load(new FileInputStream(loc));

String classpath = getParam(args, "-cp");

Expand Down Expand Up @@ -127,7 +132,7 @@ public static void main(String[] argv) {
if (classpath != null)
driverPath = classpath + File.pathSeparator + driverPath;

Connection connection = getConnection(user, password, urlBuilder.getConnectionURL(), driverClass, driverPath, propertiesLoadedFrom.toString());
Connection connection = getConnection(user, password, urlBuilder.getConnectionURL(), driverClass, driverPath, propertiesLoadedFrom.toString(), userProperties);
DatabaseMetaData meta = connection.getMetaData();

if (analyzeAll) {
Expand Down Expand Up @@ -438,7 +443,7 @@ private static void dumpNoTablesMessage(String schema, String user, DatabaseMeta
}

private static Connection getConnection(String user, String password, String connectionURL,
String driverClass, String driverPath, String propertiesLoadedFrom) throws MalformedURLException {
String driverClass, String driverPath, String propertiesLoadedFrom, Properties userProperties) throws MalformedURLException {
System.out.println("Using database properties:");
System.out.println(" " + propertiesLoadedFrom);

Expand Down Expand Up @@ -487,6 +492,7 @@ private static Connection getConnection(String user, String password, String con
connectionProperties.put("user", user);
if (password != null)
connectionProperties.put("password", password);
connectionProperties.putAll(userProperties);

Connection connection = null;
try {
Expand Down

0 comments on commit 45ceb60

Please sign in to comment.