My goal is to run php on glassfish server. I installed Quercus and deployed it as an application within glassfish under (C:\glassfish4\glassfish\domains\domain1\applications\Quercus).
Now I try to connect to mysql. The mysql server is running and connection is verified through command (mysql -u root -p).
next test.php is created:
<?php
$servername="localhost";
$username="root";
$password="whatever";
$conn = new mysqli($servername, $username, $password);
if (!$conn) {
die("Failed : " . mysqli.connect_error());
}
echo "Connection Successful!";
?>
Running test.php gives the following message:
Warning: A link to the server could not be established.
url=jdbc:mysql://localhost/?
jdbcCompliantTruncation=false&characterSetResults=ISO885_1&characterEncoding=ISO8859_1&userServerPrepStmts=true
driver=com.mysql.jdbc.Driver com.caucho.quercus.QuercusModuleException:java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
Connection Successful!
From the message, it is probable that the mysql jdbc driver is not installed.
I added the driver to C:\glassfish4\glassfish\domains\domain1\lib\mysql-connector-java-8.0.11\mysql-connectior-java-8.0.11.jar. I am not sure how to add it from glassfish admin console. It is not shown under jdbc>connection pool.
2nd EDIT (based on comments): The jar files are moved into ...\domain1\lib and ...\glassfish\lib as well. A full system restart was done. To add a connection pool, I Followed the instructions on the following link: https://dev.mysql.com/doc/connector-j/5.1/en/connector-j-usagenotes-glassfish-config.html
Then I get the following error message:
HTTP Status 500 - Internal Server Error:
type Exception report
message Internal Server Error
description The server encountered an internal error that prevented it from fulfilling this request.
exception java.lang.IllegalStateException: getoutputStream() has already been called for this response.
...