Advertisement
Guest User

Untitled

a guest
Jun 2nd, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. public class DbConnection {
  2. public Connection Connect(){
  3. try {
  4. String url="jdbc:sqlserver://localhost:1433;databaseName=BdAula3";
  5. String user="sa";
  6. String password="sa2012";
  7. Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
  8. Connection conn=DriverManager.getConnection(url, user, password);
  9. return conn;
  10. } catch (ClassNotFoundException | SQLException ex) {
  11. Logger.getLogger(DbConnection.class.getName()).log(Level.SEVERE, null, ex);
  12. }
  13. return null;
  14. }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement