1 | |
package br.mia.test.model.testlink.dao; |
2 | |
|
3 | |
import java.io.IOException; |
4 | |
import java.sql.Connection; |
5 | |
import java.sql.DriverManager; |
6 | |
import java.sql.SQLException; |
7 | |
|
8 | |
import br.mia.test.util.Util; |
9 | |
|
10 | 0 | public class Singleton { |
11 | |
|
12 | |
public static Connection getConnection() throws InstantiationException, |
13 | |
IllegalAccessException, ClassNotFoundException, SQLException, |
14 | |
IOException { |
15 | 0 | if (connection == null) { |
16 | |
|
17 | 0 | String url = Util.getPropriedade("conexaotestlink"); |
18 | |
|
19 | 0 | Class.forName("com.mysql.jdbc.Driver").newInstance(); |
20 | 0 | connection = DriverManager.getConnection(url); |
21 | |
|
22 | |
} |
23 | |
|
24 | 0 | return connection; |
25 | |
} |
26 | |
|
27 | |
private static Connection connection; |
28 | |
|
29 | |
} |