Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>What is standing out to me on first sight are the properties you set. From what I know Hibernate expects to find the connection properties you specified in the hibernate properties. (see the following from <a href="http://docs.huihoo.com/hibernate/hibernate-reference-2.1.7/session-configuration.html" rel="nofollow">http://docs.huihoo.com/hibernate/hibernate-reference-2.1.7/session-configuration.html</a>)</p> <pre><code> Hibernate will obtain (and pool) connections using java.sql.DriverManager if you set the following properties: Table 3.1. Hibernate JDBC Properties Property name Purpose hibernate.connection.driver_class jdbc driver class hibernate.connection.url jdbc URL hibernate.connection.username database user hibernate.connection.password database user password hibernate.connection.pool_size maximum number of pooled connections </code></pre> <p>In your case this means replacing:</p> <pre><code> &lt;property name="connection.url"&gt;jdbc:mysql://localhost:3306/mkyong&lt;/property&gt; &lt;property name="connection.driver_class"&gt;com.mysql.jdbc.Driver&lt;/property&gt; &lt;property name="connection.username"&gt;root&lt;/property&gt; &lt;property name="connection.password"&gt;mypassword&lt;/property&gt; </code></pre> <p>With (which is how it is shown on mykong):</p> <pre><code> &lt;property name="hibernate.connection.url"&gt;jdbc:mysql://localhost:3306/mkyong&lt;/property&gt; &lt;property name="hibernate.connection.driver_class"&gt;com.mysql.jdbc.Driver&lt;/property&gt; &lt;property name="hibernate.connection.username"&gt;root&lt;/property&gt; &lt;property name="hibernate.connection.password"&gt;mypassword&lt;/property&gt; </code></pre> <p>Another possible way would be to specify a JDBC DataSource been and injecting it to into the SessionFactory, like this for example:</p> <pre><code> &lt;bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt; &lt;property name="driverClassName" value="com.microsoft.sqlserver.jdbc.SQLServerDriver" /&gt; &lt;property name="url" value="jdbc:sqlserver://&lt;Host&gt;:&lt;Port&gt;;databaseName=&lt;DBName&gt;;" /&gt; &lt;property name="username" value=&lt;username&gt; /&gt; &lt;property name="password" value=&lt;password&gt; /&gt; &lt;/bean&gt; &lt;bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"&gt; &lt;property name="dataSource" ref="dataSource" /&gt; ...... </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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