beautypg.com

Specifying the driver class for sql/mx database – HP Integrity NonStop J-Series User Manual

Page 107

background image

Configuring the JDBC Type 2 or Type 4 Driver for SQL/MX Database

In a typical Hibernate application, you can configure the JDBC Type 2 or Type 4 driver for the
SQL/MX database by configuring either the hibernate.cfg.xml file or the
hibernate.properties

file.

“Configuring the JDBC Type 2 or Type 4 Driver for the SQL/MX Database using
hibernate.cfg.xml

” (page 107)

“Configuring JDBC Type 2 or Type 4 Driver for SQL/MX Database using
hibernate.properties

” (page 109)

Configuring the JDBC Type 2 or Type 4 Driver for the SQL/MX Database using hibernate.cfg.xml

The advantage of using this approach is the externalization of mapping file names to the
configuration. The following steps are involved to complete the database operation in a Hibernate
application using the JDBC Type 2 or Type 4 driver for the SQL/MX database:

1.

“Specifying the Driver Class for SQL/MX Database” (page 107)

2.

“Defining the Connection URL” (page 108)

3.

“Establishing the Connection” (page 108)

4.

“Defining the Hibernate Dialect for SQL/MX Database” (page 108)

5.

“Specifying the Mapping Resources” (page 108)

6.

“Opening a Session for Database Operation” (page 109)

7.

“Closing the Session” (page 109)

Specifying the Driver Class for SQL/MX Database

For Type 2 Driver:

Specify the JDBC Type 2 driver class as com.tandem.sqlmx.SQLMXDriver for the SQL/MX
database under the <session-factory> tag as shown:


"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">



com.tandem.sqlmx.SQLMXDriver
...
...
...
...

One of the advantages of using the JDBC driver is that the SQL/MX database server does not
require any changes. Instead, the JDBC Type 2 driver translates calls written in Java to the specific
format required by the database server.

For Type 4 Driver:

Specify the JDBC Type 4 driver class as com.tandem.t4jdbc.SQLMXDriver for the SQL/MX
database under the <session-factory> tag as shown:


"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">



com.tandem.t4jdbc.SQLMXDriver
...
...

Configuring Hibernate Applications on NonStop Systems 107

This manual is related to the following products: