Mercurial > dive4elements > framework
annotate artifact-database/src/main/java/de/intevation/artifactdatabase/db/DBConnection.java @ 416:733e76413bf8
Add REST service to be able to find a user by its account name
artifacts/trunk@5263 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Bjoern Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Fri, 24 Aug 2012 14:09:53 +0000 |
parents | 6d239c58c636 |
children |
rev | line source |
---|---|
305
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.artifactdatabase.db; |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
2 |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
3 import javax.sql.DataSource; |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
4 |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
5 import java.io.File; |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
6 |
309
86dd32b45d87
Use real db connection pooling for artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
308
diff
changeset
|
7 import org.apache.commons.pool.ObjectPool; |
86dd32b45d87
Use real db connection pooling for artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
308
diff
changeset
|
8 |
86dd32b45d87
Use real db connection pooling for artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
308
diff
changeset
|
9 import org.apache.commons.pool.impl.GenericObjectPool; |
86dd32b45d87
Use real db connection pooling for artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
308
diff
changeset
|
10 |
86dd32b45d87
Use real db connection pooling for artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
308
diff
changeset
|
11 import org.apache.commons.dbcp.DriverManagerConnectionFactory; |
86dd32b45d87
Use real db connection pooling for artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
308
diff
changeset
|
12 import org.apache.commons.dbcp.PoolableConnectionFactory; |
86dd32b45d87
Use real db connection pooling for artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
308
diff
changeset
|
13 import org.apache.commons.dbcp.PoolingDataSource; |
305
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
14 |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
15 import de.intevation.artifacts.common.utils.Config; |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
16 |
308
a077bb098eb4
Fixed broken SQL statement. Added debug output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
305
diff
changeset
|
17 import org.apache.log4j.Logger; |
a077bb098eb4
Fixed broken SQL statement. Added debug output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
305
diff
changeset
|
18 |
305
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
19 public class DBConnection |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
20 { |
308
a077bb098eb4
Fixed broken SQL statement. Added debug output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
305
diff
changeset
|
21 private static Logger log = Logger.getLogger(DBConnection.class); |
a077bb098eb4
Fixed broken SQL statement. Added debug output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
305
diff
changeset
|
22 |
305
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
23 public static final String DEFAULT_DRIVER = "org.h2.Driver"; |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
24 public static final String DEFAULT_USER = ""; |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
25 public static final String DEFAULT_PASSWORD = ""; |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
26 public static final String DEFAULT_DATABASE_FILE = "artifacts.db"; |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
27 public static final String DEFAULT_URL = getDefaultURL(); |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
28 |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
29 public static final String getDefaultURL() { |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
30 File configDir = Config.getConfigDirectory(); |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
31 File databaseFile = new File(configDir, DEFAULT_DATABASE_FILE); |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
32 return "jdbc:h2:" + databaseFile; |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
33 } |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
34 |
309
86dd32b45d87
Use real db connection pooling for artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
308
diff
changeset
|
35 protected DataSource dataSource; |
305
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
36 |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
37 protected String driver; |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
38 protected String url; |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
39 protected String user; |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
40 protected String password; |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
41 |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
42 public DBConnection() { |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
43 } |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
44 |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
45 public DBConnection( |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
46 String driver, |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
47 String url, |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
48 String user, |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
49 String password |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
50 ) { |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
51 this.driver = driver; |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
52 this.url = url; |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
53 this.user = user; |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
54 this.password = password; |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
55 } |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
56 |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
57 public String getUser() { |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
58 return user; |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
59 } |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
60 |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
61 public void setUser(String user) { |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
62 this.user = user; |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
63 } |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
64 |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
65 public String getPassword() { |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
66 return password; |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
67 } |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
68 |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
69 public void setPassword(String password) { |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
70 this.password = password; |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
71 } |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
72 |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
73 public String getDriver() { |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
74 return driver; |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
75 } |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
76 |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
77 public void setDriver(String driver) { |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
78 this.driver = driver; |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
79 } |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
80 |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
81 public String getUrl() { |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
82 return url; |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
83 } |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
84 |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
85 public void setUrl(String url) { |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
86 this.url = url; |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
87 } |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
88 |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
89 public synchronized DataSource getDataSource() { |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
90 if (dataSource == null) { |
308
a077bb098eb4
Fixed broken SQL statement. Added debug output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
305
diff
changeset
|
91 if (log.isDebugEnabled()) { |
a077bb098eb4
Fixed broken SQL statement. Added debug output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
305
diff
changeset
|
92 log.debug("create new datasource:"); |
a077bb098eb4
Fixed broken SQL statement. Added debug output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
305
diff
changeset
|
93 log.debug(" driver: " + driver); |
a077bb098eb4
Fixed broken SQL statement. Added debug output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
305
diff
changeset
|
94 log.debug(" url : " + url); |
a077bb098eb4
Fixed broken SQL statement. Added debug output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
305
diff
changeset
|
95 log.debug(" user : " + user); |
a077bb098eb4
Fixed broken SQL statement. Added debug output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
305
diff
changeset
|
96 } |
305
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
97 |
309
86dd32b45d87
Use real db connection pooling for artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
308
diff
changeset
|
98 try { |
337
6d239c58c636
Fixed flys/issue255
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
309
diff
changeset
|
99 synchronized (DBConnection.class) { |
6d239c58c636
Fixed flys/issue255
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
309
diff
changeset
|
100 Class.forName(driver); |
6d239c58c636
Fixed flys/issue255
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
309
diff
changeset
|
101 } |
309
86dd32b45d87
Use real db connection pooling for artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
308
diff
changeset
|
102 } |
86dd32b45d87
Use real db connection pooling for artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
308
diff
changeset
|
103 catch (ClassNotFoundException cnfe) { |
86dd32b45d87
Use real db connection pooling for artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
308
diff
changeset
|
104 log.error("cannot load driver", cnfe); |
86dd32b45d87
Use real db connection pooling for artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
308
diff
changeset
|
105 return null; |
86dd32b45d87
Use real db connection pooling for artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
308
diff
changeset
|
106 } |
86dd32b45d87
Use real db connection pooling for artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
308
diff
changeset
|
107 |
86dd32b45d87
Use real db connection pooling for artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
308
diff
changeset
|
108 DriverManagerConnectionFactory dmcf = |
86dd32b45d87
Use real db connection pooling for artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
308
diff
changeset
|
109 new DriverManagerConnectionFactory(url, user, password); |
86dd32b45d87
Use real db connection pooling for artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
308
diff
changeset
|
110 |
86dd32b45d87
Use real db connection pooling for artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
308
diff
changeset
|
111 ObjectPool cp = new GenericObjectPool(); |
86dd32b45d87
Use real db connection pooling for artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
308
diff
changeset
|
112 |
86dd32b45d87
Use real db connection pooling for artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
308
diff
changeset
|
113 PoolableConnectionFactory pcf = new PoolableConnectionFactory( |
86dd32b45d87
Use real db connection pooling for artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
308
diff
changeset
|
114 dmcf, cp, null, null, false, false); |
86dd32b45d87
Use real db connection pooling for artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
308
diff
changeset
|
115 |
86dd32b45d87
Use real db connection pooling for artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
308
diff
changeset
|
116 dataSource = new PoolingDataSource(cp); |
305
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
117 } |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
118 return dataSource; |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
119 } |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
120 } |
f33401ea2a6c
Artifact database: Refactorized the usage of dialect independent SQL to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
121 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |