Created
March 2, 2019 02:26
-
-
Save lubarinobr/0530dc68cece40aa21f9fea159626ad2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package br.com.lubarino.profiles.conexao; | |
import org.springframework.beans.factory.annotation.Value; | |
import java.sql.Connection; | |
import java.sql.DriverManager; | |
import java.sql.SQLException; | |
public class JDBCConnection { | |
@Value("${database.url}") | |
private String url; | |
@Value("${database.username}") | |
private String username; | |
@Value("${database.password}") | |
private String password; | |
public Connection connect() throws ClassNotFoundException, SQLException { | |
Class.forName("com.mysql.jdbc.Driver"); | |
Connection connection = DriverManager.getConnection(url,username, password); | |
return connection; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment