Advertisement
Guest User

Untitled

a guest
Jul 16th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. <%@page import="java.sql.SQLException"%>
  2. <%@page import="java.sql.DriverManager"%>
  3. <%@page import="java.sql.Statement"%>
  4. <%@page import="java.sql.Connection"%>
  5. <%@page import="java.lang.ClassNotFoundException"%>
  6. <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
  7. pageEncoding="ISO-8859-1"%>
  8. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  9. "http://www.w3.org/TR/html4/loose.dtd">
  10. <html>
  11. <head>
  12. <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  13. <title>Insert title here</title>
  14. </head>
  15. <body>
  16. <% Connection conn=null;
  17. Statement statement=null;
  18. try {
  19. Class.forName("com.jdbc.mysql.driver");
  20. System.out.println("entrein de se connecter");
  21. conn =
  22. DriverManager.getConnection("jdbc:mysql://localhost:3306/massar", "root", "root.123");
  23. System.out.println("connecté avec succés");
  24. }catch(SQLException se){
  25.  
  26. se.printStackTrace();
  27. }catch(Exception e){
  28.  
  29. e.printStackTrace();
  30. }finally{
  31.  
  32. try{
  33. if(conn!=null)
  34. conn.close();
  35. }catch(SQLException se){
  36. se.printStackTrace();
  37. }
  38. }
  39. System.out.println("Goodbye!");
  40. %>
  41. </body>
  42. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement