Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mysql> show variables like '%ssl%';
- +---------------+------------------------------------+
- | Variable_name | Value |
- +---------------+------------------------------------+
- | have_openssl | DISABLED |
- | have_ssl | DISABLED |
- | ssl_ca | C:/Users/Krzysztof/ca-cert.pem |
- | ssl_capath | |
- | ssl_cert | C:/Users/Krzysztof/server-cert.pem |
- | ssl_cipher | |
- | ssl_key | C:/Users/Krzysztof/server-key.pem |
- +---------------+------------------------------------+
- SELECT A.* FROM
- (SELECT user,host FROM mysql.user WHERE ssl_type IS NOT NULL) A
- INNER JOIN
- (SELECT user,host FROM mysql.user WHERE ssl_cipher IS NOT NULL) B
- USING (user,host);
- SELECT * FROM
- (SELECT user,host FROM mysql.user WHERE ssl_type IS NOT NULL) A
- UNION
- (SELECT user,host FROM mysql.user WHERE ssl_cipher IS NOT NULL);
- [mysql]
- ssl
- C:> net stop mysql
- C:> net start mysql
- GRANT ALL PRIVILEGES ON *.* TO 'ssluser'@'localhost' IDENTIFIED BY 'ssluser' REQUIRE SSL;
- mysql -ussluser -pssluser -P3306 --ssl-key=
- package test;
- import java.io.*;
- import java.sql.*;
- import javax.servlet.*;
- import javax.servlet.http.*;
- public class Registration extends HttpServlet{
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- public void init(ServletConfig config) throws ServletException{
- super.init(config);
- }
- public void doPost(HttpServletRequest req, HttpServletResponse res)
- throws ServletException, IOException{
- String connectionURL = "jdbc:mysql://localhost:3306/jsp";
- Connection connection=null;
- ResultSet rs;
- res.setContentType("text/html");
- PrintWriter out = res.getWriter();
- String firstNamed = req.getParameter("firstName");
- String lastNamed = req.getParameter("lastName");
- String emaild = req.getParameter("email");
- String userNamed = req.getParameter("userName");
- String password1d = req.getParameter("password1");
- String zipd = req.getParameter("zip");
- String auto = "user";
- try {
- Class.forName("org.gjt.mm.mysql.Driver");
- connection = DriverManager.getConnection(connectionURL, "root", "root");
- String sql = "insert into userprofile values (?,?,?,?,?,?,?)";
- PreparedStatement pst = connection.prepareStatement(sql);
- pst.setString(1, firstNamed);
- pst.setString(2, lastNamed);
- pst.setString(3, emaild);
- pst.setString(4,userNamed);
- pst.setString(5, password1d);
- pst.setString(6, zipd);
- pst.setString(7, auto);
- int numRowsChanged = pst.executeUpdate();
- out.println(" Welcome : ");
- out.println(" '"+userNamed+"'");
- pst.close();
- }
- catch(ClassNotFoundException e){
- out.println("Couldn't load database driver: " + e.getMessage());
- }
- catch(SQLException e){
- out.println("SQLException caught: " + e.getMessage());
- }
- catch (Exception e){
- out.println(e);
- }
- finally {
- try {
- if (connection != null) connection.close();
- }
- catch (SQLException ignored){
- out.println(ignored);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement