Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Biblioteca
Biblioteca
Commits
cb7103fc
Commit
cb7103fc
authored
7 years ago
by
Projetos
Browse files
Options
Download
Email Patches
Plain Diff
Update ConexaoUtil.java
parent
3df7e0f2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/br/com/biblioteca/util/ConexaoUtil.java
+32
-32
src/br/com/biblioteca/util/ConexaoUtil.java
with
32 additions
and
32 deletions
+32
-32
src/br/com/biblioteca/util/ConexaoUtil.java
View file @
cb7103fc
package
br.com.biblioteca.util
;
import
java.sql.Connection
;
import
java.sql.DriverManager
;
import
java.sql.SQLException
;
import
java.util.ResourceBundle
;
/**
*
* @author cassio trindade
*
*/
public
class
ConexaoUtil
{
private
static
ResourceBundle
configDB
=
ResourceBundle
.
getBundle
(
Constantes
.
AMBIENTE_PROPERTIES
);
private
static
Connection
conexao
;
public
static
Connection
getConexao
()
throws
ClassNotFoundException
,
SQLException
{
Class
.
forName
(
configDB
.
getString
(
Constantes
.
CONEXAO_BD_DRIVE
));
if
(
conexao
==
null
||
conexao
.
isClosed
())
conexao
=
DriverManager
.
getConnection
(
configDB
.
getString
(
Constantes
.
CONEXAO_BD_URL
),
configDB
.
getString
(
Constantes
.
CONEXAO_BD_USER
),
configDB
.
getString
(
Constantes
.
CONEXAO_BD_PASSWORD
));
return
conexao
;
}
}
package
br.com.biblioteca.util
;
import
java.sql.Connection
;
import
java.sql.DriverManager
;
import
java.sql.SQLException
;
import
java.util.ResourceBundle
;
/**
*
* @author cassio trindade
*
*/
public
class
ConexaoUtil
{
private
static
ResourceBundle
configDB
=
ResourceBundle
.
getBundle
(
Constantes
.
AMBIENTE_PROPERTIES
);
//
private static Connection conexao;
public
static
Connection
getConexao
()
throws
ClassNotFoundException
,
SQLException
{
Class
.
forName
(
configDB
.
getString
(
Constantes
.
CONEXAO_BD_DRIVE
));
//
if (conexao == null || conexao.isClosed())
return
DriverManager
.
getConnection
(
configDB
.
getString
(
Constantes
.
CONEXAO_BD_URL
),
configDB
.
getString
(
Constantes
.
CONEXAO_BD_USER
),
configDB
.
getString
(
Constantes
.
CONEXAO_BD_PASSWORD
));
//
return conexao;
}
}
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help