Revision 4686
Added by daigle about 16 years ago
src/edu/ucsb/nceas/metacat/DBConnection.java | ||
---|---|---|
56 | 56 |
private SQLWarning warningMessage; |
57 | 57 |
private String checkOutMethodName; |
58 | 58 |
|
59 |
|
|
60 | 59 |
private static String DBDriver; |
61 | 60 |
private static String DBConnectedJDBC; |
62 | 61 |
private static String userName; |
63 | 62 |
private static String passWord; |
64 |
static { |
|
65 |
try { |
|
66 |
DBDriver=PropertyService.getProperty("database.driver"); |
|
67 |
DBConnectedJDBC=PropertyService.getProperty("database.connectionURI"); |
|
68 |
userName=PropertyService.getProperty("database.user"); |
|
69 |
passWord=PropertyService.getProperty("database.password"); |
|
70 |
} catch (PropertyNotFoundException pnfe) { |
|
71 |
System.err.println("Could not get property in static block: " |
|
72 |
+ pnfe.getMessage()); |
|
73 |
} |
|
74 |
} |
|
75 | 63 |
|
76 | 64 |
private static Logger logMetacat = Logger.getLogger(DBConnection.class); |
77 | 65 |
|
... | ... | |
81 | 69 |
*/ |
82 | 70 |
public DBConnection() throws SQLException |
83 | 71 |
{ |
72 |
try { |
|
73 |
DBDriver = PropertyService.getProperty("database.driver"); |
|
74 |
DBConnectedJDBC = PropertyService.getProperty("database.connectionURI"); |
|
75 |
userName = PropertyService.getProperty("database.user"); |
|
76 |
passWord = PropertyService.getProperty("database.password"); |
|
77 |
} catch (PropertyNotFoundException pnfe) { |
|
78 |
System.err.println("Could not get property in static block: " |
|
79 |
+ pnfe.getMessage()); |
|
80 |
} |
|
81 |
|
|
84 | 82 |
conn = openConnection(); |
85 | 83 |
tag = conn.toString(); |
86 | 84 |
status = 0; |
Also available in: Unified diff
Move global connection variable setters into the constructor so they are retrieved every time we get a new dbConnetion object