我在J/connector文件夹中没有找到mysql-connector-java-version.jar文件

rpppsulh  于 2023-08-01  发布在  Java
关注(0)|答案(2)|浏览(240)

我从mysql网站下载了j/connector。但我找不到可执行的JAR文件,而是有另一个zip文件。但是当我解压缩里面的另一个zip文件时,我可以找到JAR文件。Instead of being jar file there is zip file with no jar file inside it如果你有那么你也可以请分享我的文件。

wqlqzqxt

wqlqzqxt1#

您可以打开此链接并搜索您需要的https://mvnrepository.com/artifact/mysql/mysql-connector-java版本,尽管我建议使用maven项目。
pom是

  1. <dependencies>
  2. <dependency>
  3. <groupId>org.springframework.boot</groupId>
  4. <artifactId>spring-boot-starter-web</artifactId>
  5. </dependency>
  6. <!-- send email -->
  7. <dependency>
  8. <groupId>org.springframework.boot</groupId>
  9. <artifactId>spring-boot-starter-mail</artifactId>
  10. </dependency>
  11. <dependency>
  12. <groupId>org.springframework.boot</groupId>
  13. <artifactId>spring-boot-starter-test</artifactId>
  14. <scope>test</scope>
  15. <exclusions>
  16. <exclusion>
  17. <groupId>org.junit.vintage</groupId>
  18. <artifactId>junit-vintage-engine</artifactId>
  19. </exclusion>
  20. </exclusions>
  21. </dependency>
  22. <dependency>
  23. <groupId>io.springfox</groupId>
  24. <artifactId>springfox-swagger2</artifactId>
  25. <version>2.9.2</version>
  26. </dependency>
  27. <!-- https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple -->
  28. <dependency>
  29. <groupId>com.googlecode.json-simple</groupId>
  30. <artifactId>json-simple</artifactId>
  31. <version>1.1.1</version>
  32. </dependency>
  33. <!-- https://mvnrepository.com/artifact/com.github.fge/jackson-coreutils -->
  34. <dependency>
  35. <groupId>com.github.fge</groupId>
  36. <artifactId>jackson-coreutils</artifactId>
  37. <version>1.0</version>
  38. </dependency>
  39. <dependency>
  40. <groupId>org.projectlombok</groupId>
  41. <artifactId>lombok</artifactId>
  42. <optional>true</optional>
  43. </dependency>
  44. <dependency>
  45. <groupId>io.springfox</groupId>
  46. <artifactId>springfox-swagger-ui</artifactId>
  47. <version>2.9.2</version>
  48. </dependency>
  49. <!-- Configuracion del ORM de spring boot para persistencia -->
  50. <dependency>
  51. <groupId>org.springframework.boot</groupId>
  52. <artifactId>spring-boot-starter-data-jpa</artifactId>
  53. </dependency>
  54. <!-- Conector/libreria de MYSQL para java -->
  55. <dependency>
  56. <groupId>mysql</groupId>
  57. <artifactId>mysql-connector-java</artifactId>
  58. <scope>runtime</scope>
  59. </dependency>
  60. <!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
  61. <dependency>
  62. <groupId>com.google.code.gson</groupId>
  63. <artifactId>gson</artifactId>
  64. <version>2.8.5</version>
  65. </dependency>
  66. <dependency>
  67. <groupId>net.sf.dozer</groupId>
  68. <artifactId>dozer</artifactId>
  69. <version>5.5.1</version>
  70. </dependency>
  71. <!-- https://mvnrepository.com/artifact/log4j/log4j -->
  72. <dependency>
  73. <groupId>log4j</groupId>
  74. <artifactId>log4j</artifactId>
  75. <version>1.2.17</version>
  76. </dependency>
  77. <dependency>
  78. <groupId>io.jsonwebtoken</groupId>
  79. <artifactId>jjwt</artifactId>
  80. <version>0.9.1</version>
  81. </dependency>
  82. </dependencies>

字符串
如果使用的是Spring,则只需要属性文件中的next

  1. spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver


spring.datasource.url=jdbc:mysql://:@/?reconnect=true spring.datasource.username= spring.datasource.password=

展开查看全部
iyfjxgzm

iyfjxgzm2#

解压缩第一个zip文件,但不解压缩其他zip文件。而是复制该zip文件并将其粘贴到项目文件夹中单独文件夹中。例如,如果您有一个名为JDBC的项目文件夹(在eclipse中打开JDBC文件夹),则创建一个子文件夹lib,然后在本地计算机中打开lib文件夹并将mysql-connector-j zip文件粘贴到其中。现在,eclipse将正确地将其检测为jar文件。现在右键单击jar文件并添加到构建路径。

相关问题