Defining the connection url, Establishing the connection, Defining the hibernate dialect for sql/mx database – HP Integrity NonStop J-Series User Manual

Page 110: Opening a session for database operation, Configuring sessionfactory in your java program

Advertising
background image

Specifying the JDBC Driver Class for SQL/MX Database

For Type 2 Driver:

Specify com.tandem.sqlmx.SQLMXDriver as the JDBC Type 2 driver class for the SQL/MX
database as shown:

hibernate.connection.driver_class_com.tandem.sqlmx.SQLMXDriver

For Type 4 Driver:

Specify com.tandem.t4jdbc.SQLMXDriver as the JDBC Type 4 driver class for the SQL/MX
database as shown:

hibernate.connection.driver_class com.tandem.t4jdbc.SQLMXDriver

Defining the Connection URL

After you have specified the JDBC driver, enter the location of the SQL/MX server. URLs referring
to SQL/MX use the jdbc: protocol embedded within the URL. Specify the connection URL as
follows:

For Type 2 Driver:

hibernate.connection.url jdbc:sqlmx://

For Type 4 Driver:

hibernate.connection.url jdbc:t4sqlmx://<HP NonStop System IP Address>:<Port No.>

Establishing the Connection

Add the properties for the username and password for your NonStop system as shown:

For Type 2 Driver:

hibernate.connection.username
hibernate.connection.password

Do not specify the username and password.

For Type 4 Driver:

Specify the username and password of your NonStop system as shown.

hibernate.connection.username <HP NonStop Username>
hibernate.connection.password <HP NonStop Password>

Defining the Hibernate Dialect for SQL/MX Database

Enter org.hibernate.dialect.SqlmxDialect as the class name of a Hibernate dialect file
in the hibernate.properties file as shown:

hibernate.dialect org.hibernate.dialect.SqlmxDialect

This dialect file allows Hibernate to generate SQL optimized for SQL/MX database.

Opening a Session for Database Operation

Opening a new session for database transaction involves:

1.

“Configuring SessionFactory in your Java Program” (page 110)

2.

“Creating a New Session from the SessionFactory in Java” (page 111)

Configuring SessionFactory in your Java Program

Add the following lines to your Java program to create Hibernate SessionFactory.

private SessionFactory factory;

...
...
...

110

Hibernate Framework

Advertising
This manual is related to the following products: