Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%@ page import="java.sql.*"%>
- <html>
- <head>
- <title>JDBC Connection example</title>
- </head>
- <body>
- <h1>JDBC Connection example</h1>
- <%
- String db = "soen";
- String user = "root";
- String password = "";
- try {
- java.sql.Connection con;
- Class.forName("org.gjt.mm.mysql.Driver");
- con = DriverManager.getConnection("jdbc:mysql://localhost/"+db, user, password);
- out.println (db+ ": database successfully opened.");
- }
- catch(SQLException e) {
- out.println("SQLException caught: " +e.getMessage());
- }
- %>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement