Powered by SmartDoc

The jdbc.data.profile option

A jdbc.data.profile option specifies a configuration for data access.

Parameters

The jdbc.data.profile option takes one of the following values, or a configuration file name, as a parameter.

sql92
Profile for standard SQL-92 databases.
postgresql
Profile for PostgreSQL.
mysql
Profile for MySQL.

The default configuration is sql92.

Artifact

The jdbc.data.profile option generates no additional classes. The jdbc.data.profile option just modified the behavior of Relaxer table objects.

The jdbc.data.profile option adds no additional methods to Relaxer objects.

Example

List 12.8.3.1[jdbcDataProfile.rng] is a sample schema for the jdbc.data.profile option.

jdbcDataProfile.rng
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
  <start>
    <ref name="account"/>
  </start>
  <define name="account">
    <element name="account">
      <attribute name="accountNo">
        <data type="token"/>
      </attribute>
      <element name="balance">
        <data type="int"/>
      </element>
      <element name="owner">
        <data type="token"/>
      </element>
      <ref name="address"/>
      <zeroOrMore>
        <ref name="phone"/>
      </zeroOrMore>
    </element>
  </define>
  <define name="address">
    <element name="address">
      <attribute name="zip">
        <data type="token"/>
      </attribute>
      <text/>
    </element>
  </define>
  <define name="phone">
    <element name="phone">
      <attribute name="area">
        <data type="token"/>
      </attribute>
      <data type="token"/>
    </element>
  </define>
</grammar>

MySQL

Execution of Relaxer with the jdbc.data.profile option is as follows:

$ relaxer -jdbc -jdbc.data.profile:mysql jdbcDataProfile.rng

List 12.8.3.1.1[account.ddl] is the DDL generated by this command.

account.ddl
CREATE TABLE "account" (
	"accountNo" VARCHAR(32) NOT NULL,
	"balance" INTEGER NOT NULL,
	"owner" VARCHAR(32) NOT NULL,
	"address" TEXT NOT NULL,
	"address_zip" VARCHAR(32) NOT NULL,
	"phone" TEXT
)

The DDL is tuned for MySQL with regard to the following issues:

In contrast of the jdbc.profile option, quotations are not tuned.