Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package fr.eni.dao;
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.SQLException;
- import com.microsoft.sqlserver.jdbc.SQLServerDriver;
- public class AccesBdd
- {
- static
- {
- try {
- DriverManager.registerDriver(new SQLServerDriver());
- } catch (SQLException e) {
- e.printStackTrace();
- }
- }
- public static Connection getConnection()
- {
- Connection cnx = null;
- try
- {
- cnx = DriverManager.getConnection("jdbc:sqlserver://localhost:1433;databasename=TPJavaEE_GestionFormations;user=sa;password=Pa$$w0rd");
- }
- catch (SQLException e)
- {
- e.printStackTrace();
- }
- return cnx;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement