mybatis通过jdbc连接330版本数据库,插入数据报错?

mybatis通过jdbc连接330版本数据库,插入数据报错?,第1张

java.lang.NoSuchFieldError: exceptionOverride 是一个常见的 Java 错误。通常,这个错误是由于在编译应用程序时使用的类库版本与运行时使用的类库版本不同导致的。

MyBatis 是一个持久层框架,可以通过 JDBC 连接到不同类型的数据库。在连接 GBase330 数据库时,您需要确保在编译应用程序时使用的 MyBatis 类库版本与运行时使用的 MyBatis 类库版本相同。如果两者不同,则可能会出现上述错误。

除此之外,还有一些其他因素可能会导致这个错误,例如在编译应用程序时,您引用了一个不存在的字段或方法。如果您遇到了这个错误,建议您检查您的代码,确保所有类库版本一致,并检查您的代码是否引用了不存在的字段或方法。

问题:运行 mybatis-generator 是报错: Failed to execute goal org.mybatis.generator:mybatis-generator-maven-plugin:1.3.5Access denied for user ‘root‘@‘localhost‘ (using password: NO)

前提是:我在DOS命令下等正常连接mysql,那就排除mysql服务是否启动相关的问题;我是新手,常常犯的错误就是单词拼写错误,那接下来我就比对两个有做mysql配置相关的文件做了检查,一个是application.properties,另一个是 mybatis-generator.xml ,在对比的过程中我就发现这两个文件的mysql密码是对不上的,瞬间six屎啦!

通过配置文件

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"

xmlns:context="http://www.springframework.org/schema/context"

xmlns:p="http://www.springframework.org/schema/p"

xmlns:aop="http://www.springframework.org/schema/aop"

xmlns:tx="http://www.springframework.org/schema/tx"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://www.springframework.org/schema/beans

http://www.springframework.org/schema/beans/spring-beans-4.0.xsd

http://www.springframework.org/schema/context

http://www.springframework.org/schema/context/spring-context-4.0.xsd

http://www.springframework.org/schema/aop

http://www.springframework.org/schema/aop/spring-aop-4.0.xsd

http://www.springframework.org/schema/tx

http://www.springframework.org/schema/tx/spring-tx-4.0.xsd

http://www.springframework.org/schema/util

http://www.springframework.org/schema/util/spring-util-4.0.xsd">

<!-- 开启注解扫描 -->

<context:component-scan base-package="com.ijava.springmvc.dao"/>

<!-- 加载配置文件 --> <!-- placeholder 占位符 -->

<context:property-placeholder location="classpath:resources/db.properties"/>

<!-- 数据库连接池 -->

<bean id="datasource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">

<property name="driverClassName" value="${jdbc.driver}" />

<property name="url" value="${jdbc.url}" />

<property name="username" value="${jdbc.username}" />

<property name="password" value="${jdbc.password}" />

</bean>

<!-- 创建对象 -->

<bean id="userDao" class="com.ijava.springmvc.dao.UserDaoImpl"></bean>

<bean id="userService" class="com.ijava.springmvc.service.UserServiceImpl"></bean>

<bean class="org.springframework.jdbc.core.JdbcTemplate">

<property name="dataSource" ref="datasource"></property>

</bean>

</beans>


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/sjk/6803314.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-03-28
下一篇 2023-03-28

发表评论

登录后才能评论

评论列表(0条)

保存