Jump to content

Recommended Posts

Posted

Hi for my website I need to connect to a database. I have a MySQL database created and is on myphpadmin. In my code for my jsp I am using a connection string, Connection  con = DriverManager.getConnection("jdbc:mysql://localhost:3306/lauraccc_fyp", "root", "*");, however when I try to run this jsp page on heliohost it is not connecting and I am getting a blank page. I am doing something wrong?

 

Posted

 

("jdbc:mysql://localhost:3306/lauraccc_fyp", "root", "*");

 

 

You need to create a database user in cPanel, assign it to the DB, then specify that username and password in the connection string. Users don't have root access here unlike on a development box.

Posted

I am still receiving a blank jsp page. My database is called lauraccc_fyp, my username is lauraccc_root and I have the correct passowrd. I am trying to insert into a table called lauraccc_fyp.register and the status is ok in cPanel

 

Connection  con = DriverManager.getConnection("jdbc:mysql://localhost:3306/lauraccc_fyp", "lauraccc_root", "****");
           
        
          Statement stmt = con.createStatement();
          stmt.execute("insert into lauraccc_fyp.register (…...

Posted

When uploading .jsp files, etc. to your public_html folder the .jar files aren't loaded until Tomcat restarts. So likely what is happening is your site just doesn't have its mysql-connector loaded. I have restarted Tomcat. Are your mysql connections working now?

Posted

'root'@'localhost'

You don't have the root password for the server for obvious security reasons. Your mysql username will be something like lauraccc_root. You can create databases and database users through the mysql button in cpanel.
Posted

Sorry for still bothering but I am still receiving this error. mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Access denied for user 'lauraccc_root'@'localhost' to database 'lauraccc_fyp'

Guest
This topic is now closed to further replies.
×
×
  • Create New...