Changeset 95
- Timestamp:
- 05/13/16 08:49:56 (9 years ago)
- Location:
- trunk/CrossPare
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/CrossPare/.classpath
r94 r95 26 26 <classpathentry kind="lib" path="lib/jgap.jar"/> 27 27 <classpathentry kind="lib" path="lib/commons-lang3-3.4.jar"/> 28 <classpathentry kind="lib" path="lib/commons-dbcp2-2.1.1.jar"/> 28 29 <classpathentry kind="output" path="bin"/> 29 30 </classpath> -
trunk/CrossPare/build.xml
r93 r95 36 36 <pathelement location="lib/jgap.jar" /> 37 37 <pathelement location="lib/commons-lang3-3.4.jar" /> 38 <pathelement location="lib/dbcp2-2.1.1.jar" /> 38 39 </path> 39 40 -
trunk/CrossPare/src/de/ugoe/cs/cpdp/eval/MySQLResultStorage.java
r86 r95 24 24 import java.util.Properties; 25 25 26 import org.apache.commons.dbcp2.BasicDataSource; 27 28 import com.mysql.jdbc.jdbc2.optional.MysqlDataSource; 29 26 30 import de.lmu.ifi.dbs.elki.logging.Logging.Level; 27 31 import de.ugoe.cs.util.console.Console; … … 39 43 * Connection to the database 40 44 */ 41 private Connection con = null; 45 //private Connection con = null; 46 47 /** 48 * Connection pool for the data base. 49 */ 50 private MysqlDataSource connectionPool = null; 42 51 43 52 /** … … 95 104 String dbPass) 96 105 { 106 connectionPool = new MysqlDataSource(); 107 connectionPool.setUser(dbUser); 108 connectionPool.setPassword(dbPass); 109 connectionPool.setUrl("jdbc:mysql://" + dbHost + ":" + dbPort + "/" + dbName); 110 /* 97 111 try { 98 112 Properties connectionProperties = new Properties(); … … 102 116 connectionProperties.put("maxReconnects", "10000"); 103 117 Class.forName("com.mysql.jdbc.Driver"); 118 104 119 con = DriverManager.getConnection("jdbc:mysql://" + dbHost + ":" + dbPort + "/" + 105 120 dbName, connectionProperties); … … 114 129 Console.printerr("VendorError: " + e.getErrorCode()); 115 130 } 131 */ 116 132 } 117 133 … … 153 169 Statement stmt; 154 170 try { 155 stmt = con .createStatement();171 stmt = connectionPool.getConnection().createStatement(); 156 172 stmt.executeUpdate(sql.toString().replace("NaN", "NULL")); 157 173 } … … 177 193 boolean contained = false; 178 194 try { 179 stmt = con .createStatement();195 stmt = connectionPool.getConnection().createStatement(); 180 196 ResultSet results = stmt.executeQuery(sql); 181 197 results.next(); … … 188 204 Console.printerr("SQLState: " + e.getSQLState() + "\n"); 189 205 Console.printerr("VendorError: " + e.getErrorCode() + "\n"); 206 Console.printerr("\nskipping product since we could not check if the results is available"); 207 contained = true; 190 208 } 191 209 return contained;
Note: See TracChangeset
for help on using the changeset viewer.