Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Connection conn =null; // Create connection object
- String database = "egertons"; // Name of database
- String user = "egertons"; //
- String password = "gewedonk";
- String url = "jdbc:mysql://mudfoot.doc.stu.mmu.ac.uk/" + database;
- String docType =
- "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 "+
- "Transitional//EN\">\n";
- response.setContentType("text/html");
- PrintWriter out = response.getWriter();
- out.println(docType);
- try{
- Class.forName("com.mysql.jdbc.Driver").newInstance();
- } catch(Exception e) {
- System.err.println(e);
- }
- // connecting to database
- try{
- conn = DriverManager.getConnection(url, user, password);
- }
- catch(SQLException se) {
- System.err.println(se);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement