-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Mike,
Mike LI wrote: >> Christopher Schultz wrote: >> >> Can you post more of this stack trace? I wonder if the real problem >> is "cannot connect to database", and not "SQL syntax error", as >> suggested by the exception class. > > [Mike] It's a shared web hosting, thus I cannot see the whole stack > trace. If it's a "cannot connect to database" problem, which file or > settings do you suggest to look at? That's unfortunate. You can't even see your own tomcat logs? I would look at all log files. >> Can you verify that you can reach the hibernate database from your >> app server? There may be a firewall or other barrier between the two >> machines. > > [Mike] The Tomcat and MySQL run on same machine. Can you > suggest an easy sample code to verify the connection between both? Sorry, I misread your original post: I thought you were moving just the database, not deploying to another server. My guess is that your database is called something else on the "remote" server. Check that your URL to connect to the database makes sense for the environment (as well as the username and password). You might want to look into the SQLGrammarException, too: it's possible that this isn't a connection problem, but a legitimate query problem (which would be weird, since it's the same web application in both cases). Are you sure the versions of the database servers are the same in both environments? Something simple like this would work (as a JSP, for ease of deployment, etc.): <%! imports and stuff %> <% Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; try { conn = DriverManager.getConnection(dbURL, username, password); ps = conn.prepareStatement("SELECT 1"); rs = ps.executeQuery(); if(rs.next()) { %>test passed<% } else { %>test failed<% } } finally { if(null != rs) try { rs.close(); } catch (SQLException) { %>cannot close ResultSet<% } if(null != ps) try { ps.close(); } catch (SQLException) { %>cannot close PreparedStatement<% } if(null != conn) try { conn.close(); } catch (SQLException) { %>cannot close Connection<% } } %> -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFHIme+9CaO5/Lv0PARAoETAJsFYc9oHlnB+ukpCLYOUPk9yG4r4ACfW7aV g4DWU0DWlNMjgj2K9YsuofQ= =Ps+R -----END PGP SIGNATURE----- --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]