testUsersDAOImpl报错
这个报错怎么解决?
这个报错怎么解决?
2017-10-30
如果你把数据库的jar包导入了的话就应该看下你用的那个数据库了下面是我针对不同数据库百度的你先看看
无法创建请求服务,后面跟着jdbc环境问题,hibernate的配置文件中关于数据库连接和配置的地方有问题。
这是连接oracle的代码
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.connection.url">jdbc:oracle:thin:@172.28.144.110:1521:SHKRP1QA</property>
<property name="hibernate.connection.username">TP</property>
<property name="hibernate.connection.password">PSH#TP</property>
<mapping class="it.robot.po.User_infor"/>
<mapping resource="it/robot/po/user_hbm.xml"/>
</session-factory>
</hibernate-configuration>
这是连接mysql的配置文件代码
<?xml version="1.0" encoding="GBK" ?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://www.hibernate.org/dtd/hibernate-Configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">
com.mysql.jdbc.Driver
</property>
<property name="hibernate.connection.url">
jdbc:mysql://localhost:3306/shopping
</property>
<property name="hibernate.connection.username">
root
</property>
<property name="hibernate.connection.password">
root
</property>
<property name="dialect">
org.hibernate.dialect.MySQLInnoDBDialect
</property>
<property name="show_sql">true</property>
<mapping resource="Newsss.hbm.xml"/>
</session-factory>
</hibernate-configuration>
其实 很有可能是你配置文件中没有配置数据库方言,你试试配置一下数据库方言
mysql的方言就是上面代码中
<property name="dialect">
org.hibernate.dialect.MySQLInnoDBDialect
</property>
举报