The configuration template of the hibernate. cfg. xml file and the configuration parameters of different databases

Source: Internet
Author: User

The configuration template of the hibernate. cfg. xml file and the configuration parameters of different databases


(1) configuration template of the hibernate. cfg. xml file

 
 
 
  
   
   
    
Com. mysql. jdbc. Driver
   
   
    
Root
   
   
    
Root
   
   
    
Jdbc: mysql: // 127.0.0.1: 3306/hibernatetest
   
   
   
    
Org. hibernate. dialect. MySQLDialect
   
   
   
    
True
   
   
   
    
Update
   
   
    
    

(2) The above knowledge introduces the Oracle configuration method, but there is no relevant configuration for the url driver configured in many other databases;

Below is the detailed information about the current mainstream Database Configuration templates:

## HypersonicSQLhibernate.dialect org.hibernate.dialect.HSQLDialecthibernate.connection.driver_class org.hsqldb.jdbcDriverhibernate.connection.username sahibernate.connection.passwordhibernate.connection.url jdbc:hsqldb:./build/db/hsqldb/hibernate#hibernate.connection.url jdbc:hsqldb:hsql://localhost#hibernate.connection.url jdbc:hsqldb:test## H2 (www.h2database.com)#hibernate.dialect org.hibernate.dialect.H2Dialect#hibernate.connection.driver_class org.h2.Driver#hibernate.connection.username sa#hibernate.connection.password#hibernate.connection.url jdbc:h2:mem:./build/db/h2/hibernate#hibernate.connection.url jdbc:h2:testdb/h2test#hibernate.connection.url jdbc:h2:mem:imdb1#hibernate.connection.url jdbc:h2:tcp://dbserv:8084/sample; #hibernate.connection.url jdbc:h2:ssl://secureserv:8085/sample; #hibernate.connection.url jdbc:h2:ssl://secureserv/testdb;cipher=AES## MySQL#hibernate.dialect org.hibernate.dialect.MySQLDialect#hibernate.dialect org.hibernate.dialect.MySQLInnoDBDialect#hibernate.dialect org.hibernate.dialect.MySQLMyISAMDialect#hibernate.connection.driver_class com.mysql.jdbc.Driver#hibernate.connection.url jdbc:mysql:///test#hibernate.connection.username gavin#hibernate.connection.password## Oracle#hibernate.dialect org.hibernate.dialect.OracleDialect#hibernate.dialect org.hibernate.dialect.Oracle9Dialect#hibernate.connection.driver_class oracle.jdbc.driver.OracleDriver#hibernate.connection.username ora#hibernate.connection.password ora#hibernate.connection.url jdbc:oracle:thin:@localhost:1521:orcl#hibernate.connection.url jdbc:oracle:thin:@localhost:1522:XE## PostgreSQL#hibernate.dialect org.hibernate.dialect.PostgreSQLDialect#hibernate.connection.driver_class org.postgresql.Driver#hibernate.connection.url jdbc:postgresql:template1#hibernate.connection.username pg#hibernate.connection.password## DB2#hibernate.dialect org.hibernate.dialect.DB2Dialect#hibernate.connection.driver_class com.ibm.db2.jcc.DB2Driver#hibernate.connection.driver_class COM.ibm.db2.jdbc.app.DB2Driver#hibernate.connection.url jdbc:db2://localhost:50000/somename#hibernate.connection.url jdbc:db2:somename#hibernate.connection.username db2#hibernate.connection.password db2## TimesTen#hibernate.dialect org.hibernate.dialect.TimesTenDialect#hibernate.connection.driver_class com.timesten.jdbc.TimesTenDriver#hibernate.connection.url jdbc:timesten:direct:test#hibernate.connection.username#hibernate.connection.password ## DB2/400#hibernate.dialect org.hibernate.dialect.DB2400Dialect#hibernate.connection.username user#hibernate.connection.password password## Native driver#hibernate.connection.driver_class COM.ibm.db2.jdbc.app.DB2Driver#hibernate.connection.url jdbc:db2://systemname## Toolbox driver#hibernate.connection.driver_class com.ibm.as400.access.AS400JDBCDriver#hibernate.connection.url jdbc:as400://systemname## Derby (not supported!)#hibernate.dialect org.hibernate.dialect.DerbyDialect#hibernate.connection.driver_class org.apache.derby.jdbc.EmbeddedDriver#hibernate.connection.username#hibernate.connection.password#hibernate.connection.url jdbc:derby:build/db/derby/hibernate;create=true## Sybase#hibernate.dialect org.hibernate.dialect.SybaseDialect#hibernate.connection.driver_class com.sybase.jdbc2.jdbc.SybDriver#hibernate.connection.username sa#hibernate.connection.password sasasa#hibernate.connection.url jdbc:sybase:Tds:co3061835-a:5000/tempdb## SAP DB#hibernate.dialect org.hibernate.dialect.SAPDBDialect#hibernate.connection.driver_class com.sap.dbtech.jdbc.DriverSapDB#hibernate.connection.url jdbc:sapdb://localhost/TST#hibernate.connection.username TEST#hibernate.connection.password TEST#hibernate.query.substitutions yes 'Y', no 'N'## MS SQL Server#hibernate.dialect org.hibernate.dialect.SQLServerDialect#hibernate.connection.username sa#hibernate.connection.password sa## JSQL Driver#hibernate.connection.driver_class com.jnetdirect.jsql.JSQLDriver#hibernate.connection.url jdbc:JSQLConnect://1E1/test## JTURBO Driver#hibernate.connection.driver_class com.newatlanta.jturbo.driver.Driver#hibernate.connection.url jdbc:JTurbo://1E1:1433/test
(3) C3P0 connection pool

############################## C3P0 Connection Pool###############################hibernate.c3p0.max_size 2#hibernate.c3p0.min_size 2#hibernate.c3p0.timeout 5000#hibernate.c3p0.max_statements 100#hibernate.c3p0.idle_test_period 3000#hibernate.c3p0.acquire_increment 2#hibernate.c3p0.validate false

(4) Proxool connection pool

################################# Proxool Connection Pool################################### Properties for external configuration of Proxoolhibernate.proxool.pool_alias pool1## Only need one of the following#hibernate.proxool.existing_pool true#hibernate.proxool.xml proxool.xml#hibernate.proxool.properties proxool.properties

(5) JDBC Settings

######################## JDBC Settings ########################## specify a JDBC isolation level#hibernate.connection.isolation 4## enable JDBC autocommit (not recommended!)#hibernate.connection.autocommit true## set the JDBC fetch size#hibernate.jdbc.fetch_size 25## set the maximum JDBC 2 batch size (a nonzero value enables batching)#hibernate.jdbc.batch_size 5#hibernate.jdbc.batch_size 0## enable batch updates even for versioned datahibernate.jdbc.batch_versioned_data true## enable use of JDBC 2 scrollable ResultSets (specifying a Dialect will cause Hibernate to use a sensible default)#hibernate.jdbc.use_scrollable_resultset true## use streams when writing binary types to / from JDBChibernate.jdbc.use_streams_for_binary true## use JDBC 3 PreparedStatement.getGeneratedKeys() to get the identifier of an inserted row#hibernate.jdbc.use_get_generated_keys false## choose a custom JDBC batcher# hibernate.jdbc.factory_class## enable JDBC result set column alias caching ## (minor performance enhancement for broken JDBC drivers)# hibernate.jdbc.wrap_result_sets## choose a custom SQL exception converter#hibernate.jdbc.sql_exception_converter

(6) Second-level Cache (level 2 Cache)

############################# Second-level Cache ############################### optimize chache for minimal "puts" instead of minimal "gets" (good for clustered cache)#hibernate.cache.use_minimal_puts true## set a prefix for cache region nameshibernate.cache.region_prefix hibernate.test## disable the second-level cache#hibernate.cache.use_second_level_cache false## enable the query cache#hibernate.cache.use_query_cache true## store the second-level cache entries in a more human-friendly format#hibernate.cache.use_structured_entries true## choose a cache implementation#hibernate.cache.provider_class org.hibernate.cache.EhCacheProvider#hibernate.cache.provider_class org.hibernate.cache.EmptyCacheProviderhibernate.cache.provider_class org.hibernate.cache.HashtableCacheProvider#hibernate.cache.provider_class org.hibernate.cache.TreeCacheProvider#hibernate.cache.provider_class org.hibernate.cache.OSCacheProvider#hibernate.cache.provider_class org.hibernate.cache.SwarmCacheProvider## choose a custom query cache implementation#hibernate.cache.query_cache_factory


Here is just some common configuration how detailed configuration information please find: hibernate-distribution-3.3.1.GA ----> project ----> etc ----> hibernate. properties file!


If you do not have this file, please reply to your mailbox and send it to you!


Note: Please indicate the source for reprinting !!


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.