如何配置Hibernate支援MySql
配置Tomcat+MySql+Hibernate
我修改了Hibernate.properties設定使用PostgreSQLDialect
hibernate.dialect net.sf.hibernate.dialect.MySQLDialect
hibernate.connection.driver_class org.gjt.mm.mysql.Driver
hibernate.connection.driver_class com.mysql.jdbc.Driver
hibernate.connection.url jdbc:mysql:MyTest
hibernate.connection.username root
hibernate.connection.password root
修改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-2.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="connection.datasource">MyTest</property>
<property name="show_sql">false</property>
<property name="use_outer_join">true</property>
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
<!-- Mapping files -->
<mapping resource="Cat.hbm.xml"/>
</session-factory>
</hibernate-configuration>
但是程式執行到InitialHibernate處出現以下錯誤
javax.naming.NameNotFoundException: Name gt3k is not bound in this Context
請指點
我修改了Hibernate.properties設定使用PostgreSQLDialect
hibernate.dialect net.sf.hibernate.dialect.MySQLDialect
hibernate.connection.driver_class org.gjt.mm.mysql.Driver
hibernate.connection.driver_class com.mysql.jdbc.Driver
hibernate.connection.url jdbc:mysql:MyTest
hibernate.connection.username root
hibernate.connection.password root
修改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-2.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="connection.datasource">MyTest</property>
<property name="show_sql">false</property>
<property name="use_outer_join">true</property>
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
<!-- Mapping files -->
<mapping resource="Cat.hbm.xml"/>
</session-factory>
</hibernate-configuration>
但是程式執行到InitialHibernate處出現以下錯誤
javax.naming.NameNotFoundException: Name gt3k is not bound in this Context
請指點
相關文章
- Spring中如何配置Hibernate事務Spring
- Hibernate配置OracleOracle
- hibernate基礎配置
- MYSQL 中max & lpad 語句在Hibernate如何使用?MySql
- Hibernate引入響應性Reactive支援React
- 01、Hibernate安裝配置
- Hibernate連線池配置
- struts string和hibernate 如何配置dataSource為連線池
- spring中對hibernate的支援(轉)Spring
- 現有表設計如下 如何生成hibernate的配置檔案???
- 如何修復MySQL配置檔案?MySql
- Vapor如何配置MySQL資料庫VaporMySql資料庫
- Hibernate配置檔案詳解
- Hibernate的配置檔案解析
- 如何透過Hibernate/JPA在MySQL中儲存UTC時區?MySql
- 【Hibernate】—Hibernate+mysql 環境搭建+入門例項MySql
- 如何安裝hibernate
- 怎麼在JBoss中配置MySQL資料庫連線池讓Mysql支援中文MySql資料庫
- java中Hibernate的環境配置Java
- 學習Hibernate原始碼三_Hibernate中的配置檔案解析原始碼
- hibernate 中怎樣連線MYSQL??MySql
- ThinkPHP學習(三)配置PHP5支援MySQL,連線MySQL資料庫PHPMySql資料庫
- nginx配置 laravel 支援NginxLaravel
- NGINX配置SSL支援Nginx
- Nginx配置支援phpNginxPHP
- Spring的DataSource配置、將Hibernate配置全部寫到Spring配置Spring
- 如何管理hibernate 的session?Session
- Spring+Hibernate框架下MySql讀寫分離,主從資料庫配置 (轉)Spring框架MySql資料庫
- MySQL5.7.21免安裝版如何配置MySql
- 關於Hibernate在Jbuilder中的配置UI
- eclipse 配置hibernate自動生成工具Eclipse
- 如何獲得Session物件及在Hibernate.cfg.xml檔案中的配置Session物件XML
- jboss+mysql+hibernate 出現錯誤!!!!!!!MySql
- Nginx 支援websocket的配置NginxWeb
- 配置nginx支援pathinfo功能Nginx
- ECMall如何支援SSL連線郵件伺服器的配置伺服器
- 如何配置全世界最小的 MySQL 伺服器MySql伺服器
- 如何選擇配置 MySQL innodb_log_file_sizeMySql