Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- `<%@ page import="java.sql.Connection" %>
- <%@ page import="java.sql.DriverManager" %>
- <%--
- Created by IntelliJ IDEA.
- User: KidusMT
- Date: 11/15/2016
- Time: 9:59 AM
- To change this template use File | Settings | File Templates.
- --%>
- <%@ page contentType="text/html;charset=UTF-8" language="java" %>
- <%
- try {
- String connectionURL = "jdbc:mysql://localhost:3306/jsp_database";
- Connection connection = null;
- Class.forName("com.mysql.jdbc.Driver").newInstance();
- connection = DriverManager.getConnection(connectionURL, "root", "");
- if(!connection.isClosed())
- out.println("Successfully connected to " + "MySQL server using TCP/IP...");
- connection.close();
- }catch(Exception ex){
- out.println("Unable to connect to database "+ex);
- }
- %>`
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement