All, We are testing our new web application, built using Java JSP with MySQL Server as the DB, in a shared hosting environment (Linux). The DB connection is made using JDBC. The web application runs perfectly in our local machines. But we are unable to connect to the MySQL server when running the web application from the shared hosting environment. When we raised a ticket the support people told us that it is not possible to use JDBC to connect to MySQL Server DB in shared hosting environment. They also gave the below PHP sample DB connection code and asked us to introduce a similar DB connection method in our JSP code.
$dbh = mysql_connect ("localhost", "username", "") or die('Cannot connect to the database because: ' . mysql_error());
mysql_select_db ("DBname");
The below line of code is being used to connect to the DB server in the shared hosting environment. dbURL = "jdbc:mysql://01.01.01.001/,'UserName','PWD'" As you can see only the ip Address has been specified in the connection string and not the port number because we were provided only with the ip address and not the port number of MySQL server.
Pls let us know on how to overcome this issue?And why do you think that the JDBC connection has not been enabled by the shared hosting people? Is port number essential to connect the MySQL server DB?
The other details are:
Tomcat 5.5 JSP/Servlets 2.0 MySQL 5.0 MySQL Database Engine: Innodb
Thanks