我尝试使用 MySQL 将项目设置从 SQL Server 重建到 Apache 2。我是 JDBC 的新人,无法弄清楚所有方面。
我根据本教程安装 MySQL/JDBC Driver Setting Up MySQL/JDBC Driver on Ubuntu。将此文件
添加到项目后,测试运行完美。.jar
内容hibernate.cfg.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- /MYPC:1433/Blog;instance=SQLEXPRESS local connection properties -->
<property name="hibernate.connection.driver_class">net.sourceforge.jtds.jdbc.Driver</property>
<property name="dialect">org.hibernate.dialect.SQLServerDialect</property>
<!--<property name="hibernate.connection.url">jdbc:jtds:sqlserver://streamer2005.softserveinc.com/_055_OMS;instance=tc;</property>-->
<property name="hibernate.connection.url">jdbc:jtds:mysql://nazar_art/_056_DB;instance=MYSQL;</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">nazarsql</property>
<!--<property name="hibernate.hbm2ddl.auto">create</property>-->
<!-- <property name="show_sql">true</property> <property name="format_sql">true</property> -->
<mapping class="com.softserveinc.edu.oms.domain.entities.Role" />
<mapping class="com.softserveinc.edu.oms.domain.entities.Region" />
<mapping class="com.softserveinc.edu.oms.domain.entities.CustomerType" />
<mapping class="com.softserveinc.edu.oms.domain.entities.User" />
<mapping class="com.softserveinc.edu.oms.domain.entities.OrderStatus" />
<mapping class="com.softserveinc.edu.oms.domain.entities.Order" />
<mapping class="com.softserveinc.edu.oms.domain.entities.Product" />
<mapping class="com.softserveinc.edu.oms.domain.entities.Dimension" />
<mapping class="com.softserveinc.edu.oms.domain.entities.OrderItem" />
<mapping class="com.softserveinc.edu.oms.domain.entities.CreditCardType" />
</session-factory>
</hibernate-configuration>
但是当我从 maven 运行它失败时,这不能正常工作。
如何解决这个问题?