Last change
on this file since 68 was
68,
checked in by cbipsl, 14 years ago
|
commit v1 eccad
|
-
Property svn:executable set to
*
|
File size:
1.2 KB
|
Line | |
---|
1 | package org.medias.eccad.persistance.jdbc; |
---|
2 | |
---|
3 | import java.sql.Connection; |
---|
4 | import java.sql.SQLException; |
---|
5 | |
---|
6 | |
---|
7 | import org.medias.eccad.helpers.LoggerPerso; |
---|
8 | import org.medias.eccad.persistance.exception.PersistanceException; |
---|
9 | |
---|
10 | public class GeneriqueDAOjdbc { |
---|
11 | private SGBD_jdbc sgbd; |
---|
12 | |
---|
13 | protected GeneriqueDAOjdbc(SGBD_jdbc sgbd) { |
---|
14 | this.sgbd = sgbd; |
---|
15 | } |
---|
16 | |
---|
17 | protected GeneriqueDAOjdbc() { |
---|
18 | this.sgbd = null; |
---|
19 | } |
---|
20 | |
---|
21 | public SGBD_jdbc getSgbd() { |
---|
22 | return sgbd; |
---|
23 | } |
---|
24 | |
---|
25 | public void setSgbd(SGBD_jdbc sgbd) { |
---|
26 | this.sgbd = sgbd; |
---|
27 | } |
---|
28 | |
---|
29 | /** |
---|
30 | * Permet d'obtenir une connexion à la base de donnée |
---|
31 | * @return la connexion à la base :) |
---|
32 | * @throws PersistanceException |
---|
33 | */ |
---|
34 | protected Connection getConnection() throws PersistanceException { |
---|
35 | Connection conn; |
---|
36 | try { |
---|
37 | conn = sgbd.connexion(); |
---|
38 | } |
---|
39 | catch (SQLException sqle) { |
---|
40 | throw new PersistanceException(sqle, "impossible de se connecter au sgbd :: ParametreDAOjdbc.getListParametre"); |
---|
41 | } |
---|
42 | LoggerPerso.log(GeneriqueDAOjdbc.class, LoggerPerso.DEBUG, "-- jdbc connexion -- "); |
---|
43 | return conn; |
---|
44 | } |
---|
45 | |
---|
46 | protected void closeConnection() { |
---|
47 | LoggerPerso.log(GeneriqueDAOjdbc.class, LoggerPerso.DEBUG, "-- jdbc deconnexion -- "); |
---|
48 | sgbd.deconnexion(); |
---|
49 | } |
---|
50 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.