1. there is sql server 2005 express edition which is free, user can download from: http://msdn.microsoft.com/zh-cn/express/bb410792.aspx 2. download jdbc driver from micorsoft, choose the proper driver version from the following website: http://www.microsoft.com/downloads/results.aspx?pocId=&freetext=JDBC&DisplayLang=en 3. download hibernate3 from http://hibernate.org 4. add the jdbc driver and all the hibernate related jar files (not only hibernate3.jar) to the build path 5. configue the for sql server port, by defualt, the connection by TCP/IP to database server is forbidden, In database configuration Manager, you should first enable it and also, for the connection, config the port, for IPAll connection, set the port to 1433; If not set the port, when connection, there will be exception like: connection refuesed, TCP/IP connection failed. the step: SQL Server Configuration Manager--> SQL Server 2005 Network configuration --> Network Protocol --> TCP/IP, 6. In the hibernate configuration file, configure like the following code:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <property name="hibernate.connection.driver_class">com.microsoft.sqlserver.jdbc.SQLServerDriver</property> <property name="hibernate.connection.url">jdbc:sqlserver://localhost:1433;DatabaseName=hibernate</property> <property name="hibernate.connection.username">sa</property> <property name="hibernate.connection.password">sa</property> <property name="hibernate.connection.pool.size">20</property> <property name="hibernate.connection.show_sql">true</property> <property name="jdbc.fetch_size">50</property> <property name="jdbc.batch_size">25</property> <property name="jdbc.use_scrollable_resultset">false</property> <property name="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</property> <mapping resource="home/stronger/hibernate/CoreCitizen.hbm.xml"/> </session-factory> </hibernate-configuration>