0% found this document useful (0 votes)
15 views2 pages

Dependecy

Uploaded by

Travassos Manuel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views2 pages

Dependecy

Uploaded by

Travassos Manuel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

<dependencies>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.32</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<version>8.4.0</version>
</dependency>

<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
<version>0.10.2</version>
</dependency>

<dependency>
<groupId>net.java.dev.timingframework</groupId>
<artifactId>timingframework</artifactId>
<version>1.0</version>
</dependency>

<dependency>
<groupId>net.miginfocom</groupId>
<artifactId>miglayout</artifactId>
<version>4.0</version>
</dependency>

<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>6.3.0</version>
</dependency>

package modelo.conexao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class ConexaoMySQL {

private static final String URL = "jdbc:mysql://localhost/gestaovenda";


private static final String USER = "root";
private static final String PASSWORD = "";
private static Connection connection ;

private ConexaoMySQL () {

}
public static Connection obterConexao () throws SQLException{
if (connection == null){
connection = DriverManager.getConnection(URL, USER, PASSWORD);
}
return connection;
}
public static void fecharConexao () throws SQLException{
if (connection != null){
connection.close();
}
}
public static void main(String[] args) throws SQLException {
System.out.println(obterConexao());
}
}

You might also like