title: unable JDBC CONNECT to jdbc:mysql//localhost:3306/database
body: <p>I search all to resolve this problem, but i still with that, i dont know what is...</p>
  
  <p>mysql version is 5.7 and hibernate is 5.2.8.Final, my sql connector is 5.1.2.</p>
  
  <p>im using STS IDE</p>
  
  <p>pom.xml</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
    &lt;groupId&gt;com.example&lt;/groupId&gt;
    &lt;artifactId&gt;hibernate&lt;/artifactId&gt;
    &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
    &lt;packaging&gt;jar&lt;/packaging&gt;
  
    &lt;name&gt;hibernate&lt;/name&gt;
    &lt;url&gt;http://maven.apache.org&lt;/url&gt;
  
    &lt;properties&gt;
      &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
    &lt;/properties&gt;
  
  
    &lt;dependencies&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;org.apache.tomcat&lt;/groupId&gt;
      &lt;artifactId&gt;tomcat-jdbc&lt;/artifactId&gt;
      &lt;version&gt;9.0.0.M21&lt;/version&gt;
  &lt;/dependency&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;com.sun.activation&lt;/groupId&gt;
      &lt;artifactId&gt;javax.activation&lt;/artifactId&gt;
      &lt;version&gt;1.2.0&lt;/version&gt;
  &lt;/dependency&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;javax.xml.bind&lt;/groupId&gt;
      &lt;artifactId&gt;jaxb-api&lt;/artifactId&gt;
      &lt;version&gt;2.3.0&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;com.sun.xml.bind&lt;/groupId&gt;
      &lt;artifactId&gt;jaxb-impl&lt;/artifactId&gt;
      &lt;version&gt;2.4.0-b180725.0644&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;com.sun.xml.bind&lt;/groupId&gt;
      &lt;artifactId&gt;jaxb-core&lt;/artifactId&gt;
      &lt;version&gt;2.3.0.1&lt;/version&gt;
  &lt;/dependency&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;junit&lt;/groupId&gt;
        &lt;artifactId&gt;junit&lt;/artifactId&gt;
        &lt;version&gt;3.8.1&lt;/version&gt;
        &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
  
       &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;ejb3-persistence&lt;/artifactId&gt;
              &lt;version&gt;1.0.2.GA&lt;/version&gt;
          &lt;/dependency&gt;
  
      &lt;!-- &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-annotations&lt;/artifactId&gt;
          &lt;version&gt;3.5.6-Final&lt;/version&gt;
      &lt;/dependency&gt; --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;mysql&lt;/groupId&gt;
          &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
          &lt;version&gt;5.1.2&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;!-- &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-commons-annotations&lt;/artifactId&gt;
              &lt;version&gt;3.2.0.Final&lt;/version&gt;
          &lt;/dependency&gt; --&gt;
  
      &lt;dependency&gt;
         &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
         &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;
         &lt;version&gt;1.7.5&lt;/version&gt;
     &lt;/dependency&gt;
     &lt;dependency&gt;
         &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
         &lt;artifactId&gt;slf4j-simple&lt;/artifactId&gt;
         &lt;version&gt;1.6.4&lt;/version&gt;
     &lt;/dependency&gt;
  
       &lt;dependency&gt;
         &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
         &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt;
         &lt;version&gt;5.2.8.Final&lt;/version&gt;
      &lt;/dependency&gt;
  
    &lt;/dependencies&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>hibernate.cfg.xml</p>
  
  <p>i think the problem is here, i guess is the version, but in my investigation i readed is the JDBC not installes but i installed the connector 8.0.12.jar that is compatible with 5.7 mysql.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE hibernate-configuration PUBLIC 
          "-//Hibernate/Hibernate Configuration DTD 3.0//EN" 
          "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"&gt; 
  &lt;hibernate-configuration&gt;
      &lt;session-factory&gt;
          &lt;property name="hibernate.connection.driver_class"&gt;com.mysql.cj.jdbc.Driver&lt;/property&gt;
          &lt;property name="hibernate.connection.url"&gt;jdbc:mysql//localhost:3306/database&lt;/property&gt;
          &lt;property name="hibernate.connection.username"&gt;username&lt;/property&gt;
          &lt;property name="hibernate.connection.password"&gt;password&lt;/property&gt;
  
          &lt;!-- Disable the second-level cache --&gt;
          &lt;property name="cache.provider_class"&gt;org.hibernate.cache.NoCacheProvider&lt;/property&gt;
  
  
      &lt;!-- JDBC connection pool (use the built-in) --&gt;
      &lt;property name="connection_pool_size"&gt;true&lt;/property&gt;
  
          &lt;!-- SQL dialect --&gt;
      &lt;property name="hibernate.dialect"&gt;org.hibernate.dialect.MySQL5Dialect&lt;/property&gt;
      &lt;!-- Echo all executed SQL to stdout --&gt;
      &lt;property name="hibernate.show_sql"&gt;true&lt;/property&gt;
  
      &lt;!-- Enable Hibernate's automatic session context management --&gt;
          &lt;property name="hibernate.current_session_context_class"&gt;thread&lt;/property&gt;
  
  
          &lt;mapping class="com.example.hibernate.model.SocialMedia" /&gt;
          &lt;mapping class="com.example.hibernate.model.Course" /&gt;
          &lt;mapping class="com.example.hibernate.model.Teacher" /&gt;
          &lt;mapping class="com.example.hibernate.model.TeacherSocialMedia" /&gt;
      &lt;/session-factory&gt;
  &lt;/hibernate-configuration&gt;
  </code></pre>
  
  <p>configuration</p>
  
  <pre><code>SessionFactory sessionFactory;
             Configuration configuration = new Configuration();
            configuration.configure("hibernate.cfg.xml");
            sessionFactory = configuration.buildSessionFactory();
            Session session = sessionFactory.openSession();
  </code></pre>
  
  <p>error...</p>
  
  <pre><code>Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
  </code></pre>
  
  <p>and...</p>
  
  <pre><code>Unable to make JDBC Connection [jdbc:mysql//localhost:3306/database]
  </code></pre>