Java JDBC Database Metadata getDriverSpecificSettings(Connection connection, String defaultUnionColumnValue)

Here you can find the source of getDriverSpecificSettings(Connection connection, String defaultUnionColumnValue)

Description

get Driver Specific Settings

License

Open Source License

Declaration

public static void getDriverSpecificSettings(Connection connection, String defaultUnionColumnValue)
            throws SQLException 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.sql.Connection;
import java.sql.DatabaseMetaData;

import java.sql.SQLException;

public class Main {
    public static void getDriverSpecificSettings(Connection connection, String defaultUnionColumnValue)
            throws SQLException {
        /*/*from   www. j a v a  2 s .  com*/
         * Check the type of database that we running the SQL against - this
         * dictates the value we will use for defaulting columns in the "union"
         * that are not specified in the "xmlselect"...
         */
        if (connection != null) {
            DatabaseMetaData metadata = connection.getMetaData();
            String dbproduct = metadata.getDatabaseProductName();
            int dbmajorversion = metadata.getDriverMajorVersion();
            int dbminorversion = metadata.getDriverMinorVersion();

            defaultUnionColumnValue = "null";
            if (dbproduct.startsWith("Microsoft SQL Server")) {
                defaultUnionColumnValue = "null";
            }
            if (dbproduct.startsWith("MySQL") && dbmajorversion >= 5) {
                defaultUnionColumnValue = "null";
            }
            //log.debug("Database: " + dbproduct + ", version " + dbmajorversion + "." + dbminorversion);
        }
    }
}

Related

  1. getDBMSName(Connection conn)
  2. getDBProduct(Connection conn)
  3. getDBTables(DatabaseMetaData metaData, String dataBase, String user)
  4. getDbType(Connection connection)
  5. getDBUsers(DatabaseMetaData metaData)
  6. getForeignKeyDeferrability(int code)
  7. getJDBCMajorVersion(Connection conn)
  8. getNullableDescription(int type)
  9. getOnly1PrimaryKey(Connection conn, String tableName)