Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%@page import="java.sql.SQLException"%>
- <%@page import="java.sql.DriverManager"%>
- <%@page import="java.sql.Statement"%>
- <%@page import="java.sql.Connection"%>
- <%@page import="java.lang.ClassNotFoundException"%>
- <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
- pageEncoding="ISO-8859-1"%>
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/html4/loose.dtd">
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
- <title>Insert title here</title>
- </head>
- <body>
- <% Connection conn=null;
- Statement statement=null;
- try {
- Class.forName("com.jdbc.mysql.driver");
- System.out.println("entrein de se connecter");
- conn =
- DriverManager.getConnection("jdbc:mysql://localhost:3306/massar", "root", "root.123");
- System.out.println("connecté avec succés");
- }catch(SQLException se){
- se.printStackTrace();
- }catch(Exception e){
- e.printStackTrace();
- }finally{
- try{
- if(conn!=null)
- conn.close();
- }catch(SQLException se){
- se.printStackTrace();
- }
- }
- System.out.println("Goodbye!");
- %>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement