无法 JDBC CONNECT 到 jdbc:mysql//localhost:3306

我搜索了所有内容以解决此问题,但我仍然如此,我不知道是什么...


mysql 版本是 5.7,hibernate 是 5.2.8.Final,我的 sql 连接器是 5.1.2。


我正在使用 STS IDE


pom.xml


<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">

  <modelVersion>4.0.0</modelVersion>


  <groupId>com.example</groupId>

  <artifactId>hibernate</artifactId>

  <version>0.0.1-SNAPSHOT</version>

  <packaging>jar</packaging>


  <name>hibernate</name>

  <url>http://maven.apache.org</url>


  <properties>

    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

  </properties>



  <dependencies>

  <dependency>

    <groupId>org.apache.tomcat</groupId>

    <artifactId>tomcat-jdbc</artifactId>

    <version>9.0.0.M21</version>

</dependency>

  <dependency>

    <groupId>com.sun.activation</groupId>

    <artifactId>javax.activation</artifactId>

    <version>1.2.0</version>

</dependency>

  <dependency>

    <groupId>javax.xml.bind</groupId>

    <artifactId>jaxb-api</artifactId>

    <version>2.3.0</version>

</dependency>

<dependency>

    <groupId>com.sun.xml.bind</groupId>

    <artifactId>jaxb-impl</artifactId>

    <version>2.4.0-b180725.0644</version>

</dependency>

<dependency>

    <groupId>com.sun.xml.bind</groupId>

    <artifactId>jaxb-core</artifactId>

    <version>2.3.0.1</version>

</dependency>

    <dependency>

      <groupId>junit</groupId>

      <artifactId>junit</artifactId>

      <version>3.8.1</version>

      <scope>test</scope>

    </dependency>


     <dependency>

            <groupId>org.hibernate</groupId>

            <artifactId>ejb3-persistence</artifactId>

            <version>1.0.2.GA</version>

        </dependency>


    <!-- <dependency>

        <groupId>org.hibernate</groupId>

        <artifactId>hibernate-annotations</artifactId>

        <version>3.5.6-Final</version>

    </dependency> -->

    <dependency>

        <groupId>mysql</groupId>

        <artifactId>mysql-connector-java</artifactId>

        <version>5.1.2</version>

    </dependency>


动漫人物
浏览 347回答 2
2回答

慕村9548890

您在连接 URL 中错过了:之后mysql。正确的应该是这样的jdbc:mysql://localhost:3306/database

人到中年有点甜

尝试使用,<property&nbsp;name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java