<%@ page import="java.io.*, java.util.*, javax.servlet.*, java.sql.*" %> <% Connection connection = null; try { String connectionURL = "jdbc:mysql://localhost/MyBd?useUnicode=yes&characterEncoding=UTF-8"; Class.forName("com.mysql.jdbc.Driver").newInstance(); connection = DriverManager.getConnection(connectionURL, "MyBd", "MyBd"); if(!connection.isClosed()) out.println("Successfully connected to " + connectionURL + " MySQL server using TCP/IP"); } catch (Exception e){ out.println("Unable to connect to database: " + e); } finally { if (connection != null) connection.close(); } %>