Note that there are some explanatory texts on larger screens.

plurals
  1. POProblem connecting to a remote database using hibernate
    text
    copied!<p>I'm trying to connect to a remote database (hosted on Netfirms <a href="http://www.netfirms.ca" rel="nofollow noreferrer">www.netfirms.ca</a> if anyone is curious) using hibernate. My mapping file is as follows:</p> <pre><code>&lt;hibernate-configuration&gt; &lt;session-factory&gt; &lt;property name="hibernate.connection.driver_class"&gt;com.mysql.jdbc.Driver&lt;/property&gt; &lt;property name="hibernate.connection.url"&gt;jdbc:mysql://mysql.netfirms.ca:3306/d60549476&lt;/property&gt; &lt;property name="hibernate.connection.username"&gt;u70612250&lt;/property&gt; &lt;property name="hibernate.connection.password"&gt;******&lt;/property&gt; &lt;property name="hibernate.dialect"&gt;org.hibernate.dialect.MySQL5Dialect&lt;/property&gt; &lt;!-- Use the C3P0 connection pool provider --&gt; &lt;property name="hibernate.c3p0.min_size"&gt;5&lt;/property&gt; &lt;property name="hibernate.c3p0.max_size"&gt;20&lt;/property&gt; &lt;property name="hibernate.c3p0.timeout"&gt;300&lt;/property&gt; &lt;property name="hibernate.c3p0.max_statements"&gt;50&lt;/property&gt; &lt;property name="hibernate.c3p0.idle_test_period"&gt;3000&lt;/property&gt; &lt;property name="show_sql"&gt;true&lt;/property&gt; &lt;property name="format_sql"&gt;true&lt;/property&gt; &lt;!-- List of XML mapping files --&gt; &lt;mapping resource="customer.hbm.xml"/&gt; &lt;mapping resource="customerSummary.hbm.xml"/&gt; &lt;mapping resource="charity.hbm.xml"/&gt; &lt;mapping resource="charitySummary.hbm.xml"/&gt; &lt;/session-factory&gt; &lt;/hibernate-configuration&gt; </code></pre> <p>When I start my application, I get the following printout:</p> <pre><code> 16 [main] INFO org.hibernate.cfg.Environment - hibernate.properties not found .... 94 [main] INFO org.hibernate.cfg.Configuration - configuring from resource: /hibernate.cfg.xml .... 485 [main] INFO org.hibernate.cfg.Configuration - Configured SessionFactory: null 532 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - Using Hibernate built-in connection pool (not for production use!) 532 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - Hibernate connection pool size: 20 547 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - autocommit mode: false 547 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://mysql.netfirms.ca:3306/d60549476 547 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - connection properties: {user=u70612250, password=****} 168719 [main] WARN org.hibernate.cfg.SettingsFactory - Could not obtain connection metadata com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception: ** BEGIN NESTED EXCEPTION ** java.net.NoRouteToHostException MESSAGE: No route to host: connect STACKTRACE: java.net.NoRouteToHostException: No route to host: connect at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(Unknown Source) </code></pre> <p>I ensured that my database is configured to allow remote access. I'm wondering what causes this. Obviously, I'm unable to establish a connection with the host, but I'm not sure why. Assuming the host name, user, and password are correct, am I missing something?</p> <p>Addendum: I tried connecting using the same driver with Squirrel, and got the same exact error.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload