Hi, Guys!
I have difficulties to talk to MySql via Java Servlet and Resin.
Platform:
We use Solaries, and Resin as Servlet container. The server I use and the
server with MySql database is connected via LAN.
What I have done:
1. I have put resin's mysql jdbc driver in resin/lib, and set up CLASSPATH
as Env variable and in resin.conf. My test code shows that the driver is
found.
2. I defined both jadbcDriver and dbURL
String jdbcDriver="com.caucho.jdbc.mysql.Driver";
String dbURL="jdbc:mysql://hostservername:3306/dbname";
3. Run code:
Class.forName(jdbcDriver).newInstance();
out.println("<h2>Got mysql driver in STAGING, ...</h2>\n\n");
dbConn=DriverManager.getConnection(dbURL, username, password);
out.println("<h2>And connect MySql in T1!</h2>");
Outcome:
Code
catch (Exception e) {
out.println("Error: " + e);
}
generated error message:
Error: java.sql.SQLException: Communication link failure: Bad handshake
My Questions:
1. Since I use 3306 as port number, could it be wrong? If it may, how could
I find the port which Mysql listens to?
2. If it is not a port problem, what might be the cause of the failure?
I appreciate much any of your helps!
Yan