1. 2016-09-11 - NonStop SQL MX with IntelliJ or DataGrip; Tags: NonStop SQL MX with IntelliJ or DataGrip
    Loading...

    NonStop SQL MX with IntelliJ or DataGrip

    NonStop SQL is a commercial relational database management system that is designed for fault tolerance and scalability for the HP NonStop. The latest version of the product is SQL MX 3.2.1 which was released in February 2013. This post describes how to setup IntelliJ or respective DataGrip to work with SQL MX.

    General

    Basic steps:

    • Create NonStop SQL MX driver setup
    • Configure Connection

    Create NonStop SQL MX driver

    First we need to create a driver within IntelliJ since the HP NonStop is rather exotic in the common Java development. To do this, we need the JDBC driver for SQL MX from HP itself. In the below screenshot you see the default settings. intellij-add-driver-data_sources_and_drivers

    Configure connection

    After you have successfully create the driver definition for the HP NonStop SQL MX, you can setup the data source. Take into consideration, that data on HP NonStop is highly critical and therefore avoid accidental changes, use a read only connection. The scope for the data source is also important. You can assign the scope to the project or the IDE, i.e. the data source is available in any project. Below you can see the default settings. Replace the user and password with your user. intellij-database-settings-data_sources_and_drivers

    Query resultset

    If you query some tables and the alias is set, column names are displayed in the output. datagrip-hpns_resultset_with_column_headers If the alias for a column isn’t set, DataGrip/IntelliJ displays anonymous. datagrip-hpns_resultset_without_column_headers As workaround you can execute the invoke statement (which shows the table definition). datagrip-hpns_invoke

  2. 2015-07-06 - Show SQL statements in JBoss; Tags: Show SQL statements in JBoss
    Loading...

    Show SQL statements in JBoss

    Enable property in persistence.xml

    <persistence -unit name="myPU">
        <jta-data-source>java:/oracledb</jta-data-source>
    <properties>
    <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"></property>
    <property name="showSql" value="true"></property>
        </properties>
    </persistence>

    Set level debug in logback.xml or logback-test.xml.

    <logger name="org.hibernate.SQL" level="DEBUG"></logger>
    

    If you have another logging framework, you might adapt it there. Commands for the JBoss cli

    /subsystem=logging/logger=org.hibernate.SQL:add
    /subsystem=logging/logger=org.hibernate.SQL:write-attribute(name="level", value="DEBUG")
    /subsystem=logging/root-logger=ROOT:write-attribute(name="level", value="DEBUG")
    

    Steps explained:

    • Add logger for subsystem logging
    • Set (write) log level for above logger
    • Set root log level to debug (not mandatory)