|
1 |
| |
|
2 |
| |
|
3 |
| |
|
4 |
| |
|
5 |
| |
|
6 |
| |
|
7 |
| package org.jconfig.handler; |
|
8 |
| |
|
9 |
| import java.sql.Connection; |
|
10 |
| import java.sql.DriverManager; |
|
11 |
| |
|
12 |
| import org.jconfig.ConfigurationManagerException; |
|
13 |
| import org.jconfig.utils.ConfigurationUtils; |
|
14 |
| |
|
15 |
| |
|
16 |
| |
|
17 |
| |
|
18 |
| public class MockJDBCHandler extends JDBCHandler { |
|
19 |
| |
|
20 |
13
| public MockJDBCHandler() {
|
|
21 |
| } |
|
22 |
| |
|
23 |
13
| protected Connection JDBCLogin() throws ConfigurationManagerException {
|
|
24 |
13
| try {
|
|
25 |
13
| Class.forName("org.hsqldb.jdbcDriver");
|
|
26 |
13
| String dbName = ConfigurationUtils.getFileFromInputStream("configDB").getAbsolutePath();
|
|
27 |
13
| return DriverManager.getConnection("jdbc:hsqldb:"+ dbName,"sa","");
|
|
28 |
| } |
|
29 |
| catch (Exception e) { |
|
30 |
0
| throw new ConfigurationManagerException("Cannot load the jdbc driver:"+e.getMessage());
|
|
31 |
| } |
|
32 |
| } |
|
33 |
| |
|
34 |
| } |