160929, each database connection configuration and MAVEN dependent installation

Source: Internet
Author: User

The most recent projects are Maven, and Maven is said to be a thing. Entrust everything that depends on the jar file to go spicy! Try to use the HA, the effect is also possible!

Today do a database configuration this piece, deliberately to summarize the relevant things out, in case of a rainy day.

Mysql

DB Driver maven Dependency

<dependency>   <groupId>mysql</groupId>   <artifactId>mysql-connector-java</artifactId>   <version>5.0.5</version>

</dependency>

 

Hibernate.properties

hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialecthibernate.connection.driver_class=com.mysql.jdbc.Driverhibernate.connection.url=jdbc:mysql://localhost/trails?createDatabaseIfNotExist=true&amp;useUnicode=true&amp;characterEncoding=utf-8hibernate.connection.username=roothibernate.connection.password=hibernate.hbm2ddl.auto=update
Oracle

DB Driver maven Dependency

<dependency>        <groupId>com.oracle</groupId>        <artifactId>ojdbc14</artifactId>        <version>10.2.0.2.0</version></dependency>

Hibernate.properties

hibernate.dialect=org.hibernate.dialect.Oracle9Dialecthibernate.connection.driver_class=oracle.jdbc.OracleDriverhibernate.connection.url=jdbc:oracle:thin:@localhost:1521:XEhibernate.connection.username=systemhibernate.connection.password=systemhibernate.hbm2ddl.auto=update# The Oracle JDBC driver doesn‘t like prepared statement caching very much.hibernate.statement_cache.size=0# or baching with BLOBs very much.hibernate.jdbc.batch_size=0# After a while, Oracle throws this exception: too many open cursors# Disable PreparedStatement caching for the connection pool too.# http://www.hibernate.org/120.html#A10hibernate.dbcp.ps.maxIdle = 0# Stoping hibernate from using the column-names in queries to retrieve data from the resultsets# More info in http://www.jroller.com/page/dashorst?entry=hibernate_3_1_something_performance1hibernate.jdbc.wrap_result_sets=true
SQL Server

DB Driver maven Dependency

<dependency>

        <groupId>net.sourceforge.jtds</groupId>

        <artifactId>jtds</artifactId>

        <version>1.2</version>

</dependency>

Hibernate.properties

Hibernate.dialect=org.hibernate.dialect.sqlserverdialect

Hibernate.connection.driver_class=net.sourceforge.jtds.jdbc.driver

Hibernate.connection.url=jdbc:jtds:sqlserver://localhost:1433/trails

Hibernate.connection.username=sa

hibernate.connection.password=

Hibernate.hbm2ddl.auto=update

Manually installing MAVEN dependency packages

For example, to install such a dependency to the MAVEN local repository:

1. Add this dependency to the project's Pom.xml

<dependency>

<groupId>com.microsoft.sqlserver</groupId>

<artifactId>sqljdbc4</artifactId>

<version>3.0</version>

</dependency>

2. Execute the install command on the command line

MVN install:install-file-dfile=sqljdbc4-3.0.jar-dgroupid=com.microsoft.sqlserver-dartifactid=sqljdbc4-dversion= 3.0-dpackaging=jar

3. Copy the Sqljdbc4-3.0.jar to this dependent installation directory

Copy the Sqljdbc4-3.0.jar to the X:\Documents and settings\%user%\.m2\repository\com\microsoft\sqlserver\sqljdbc4\3.0.

160929, each database connection configuration and MAVEN dependent installation

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.