Run a hibernate instance

Source: Internet
Author: User

Run a hibernate instance in eclipse

(1) Basic Environment:
SQL Server 2000
Eclipse 3.0
Hibernate2.1.4

(2) My environment preparation:
1. SQL Server 2000
Account: SA, password: 123456
Create a database: hibernate

2. Decompress hibernate-2.1.4.zip
I decompress the package to E:/unzip oft/hibernate-2.1,hibernate-2.1.4.zip, which can be extracted at any location.
In the following article, I call E:/javasoft/hibernate-2.1: $ hibernate_home
The instance we want to run is in $ hibernate_home/EG.

3. SQL Server 2000 JDBC driver
My driver in location is: e:/unzip oft/j2sdk1.4.2 _ 04/JRE/lib/EXT/jtds-0.8-rc1.jar

(3) Below we start
1. Create a Java project: testhibernate in eclipse
2. Right-click testhibernate and choose "properties"> "Java build path"> "add external jars" from the menu"
The list of jar files to be added is as follows:
Jtds-0.8-rc1.jar E:/export oft/j2sdk1.4.2 _ 04/JRE/lib/EXT/jtds-0.8-rc1.jar
Hibernate2.jar $ hibernate_home/hibernate2.jar
Cglib-full-2.0.1.jar $ hibernate_home/lib/cglib-full-2.0.1.jar
Commons-collections-2.1.jar $ hibernate_home/lib/commons-collections-2.1.jar
Commons-logging-1.0.3.jar $ hibernate_home/lib/commons-logging-1.0.3.jar
Dom4j-1.4.jar $ hibernate_home/lib/dom4j-1.4.jar
Ehcache-0.7.jar $ hibernate_home/lib/ehcache-0.7.jar
JTA. Jar $ hibernate_home/lib/JTA. Jar
Log4j-1.2.8.jar $ hibernate_home/lib/log4j-1.2.8.jar
Odmg-3.0.jar hibernate_home/lib/odmg-3.0.jar

3. Import instance $ hibernate_home/EG to testhibernate/src

4. Import hibernate. properties and log4j. properties to testhibernate/src. The two files can be found under $ hibernate_home/src.

File structure

 

5. Configure hibernate. Properties
Hypersonicsql is the default database in hibernate. properties, and all of them are commented out,
As follows:
# Hibernate. dialect net. SF. hibernate. dialect. hsqldialect
# Hibernate. Connection. driver_class org. HSQLDB. jdbcdriver
# Hibernate. Connection. Username SA
# Hibernate. Connection. Password
# Hibernate. Connection. url JDBC: HSQLDB: hsql: // localhost
# Hibernate. Connection. url JDBC: HSQLDB: Test
# Hibernate. Connection. url JDBC: HSQLDB :.

Find
# Ms SQL Server

# Hibernate. dialect net. SF. 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

Change
# Ms SQL Server

Hibernate. dialect net. SF. hibernate. dialect. sqlserverdialect
Hibernate. Connection. Username SA
Hibernate. Connection. Password 123456

# Jsql driver
Hibernate. Connection. driver_class net. SourceForge. jtds. JDBC. Driver
Hibernate. Connection. url JDBC: jtds: sqlserver: // localhost: 1433/hibernate

6. Okay, you can run this instance.

 

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.