Java Code Examples for java.sql.DatabaseMetaData#getJDBCMajorVersion()
The following examples show how to use
java.sql.DatabaseMetaData#getJDBCMajorVersion() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DatabaseMetaDataTest.java From gemfirexd-oss with Apache License 2.0 | 4 votes |
/** * Methods that describe the version of the * driver and database. */ public void testVersionInfo() throws SQLException { DatabaseMetaData dmd = getDMD(); int databaseMajor = dmd.getDatabaseMajorVersion(); int databaseMinor = dmd.getDatabaseMinorVersion(); int driverMajor = dmd.getDriverMajorVersion(); int driverMinor = dmd.getDriverMinorVersion(); String databaseVersion = dmd.getDatabaseProductVersion(); String driverVersion = dmd.getDriverVersion(); if (usingEmbedded()) { // Database *is* the driver. assertEquals("Embedded Major version ", databaseMajor, driverMajor); assertEquals("Embedded Minor version ", databaseMinor, driverMinor); assertEquals("Embedded version", databaseVersion, driverVersion); } assertEquals("GemFireXD", dmd.getDatabaseProductName()); String driverName = dmd.getDriverName(); if (usingEmbedded()) { assertEquals("GemFireXD Embedded JDBC Driver", driverName); } else if (usingDerbyNetClient()) { assertEquals("GemFireXD Network Client JDBC Driver", driverName); } int jdbcMajor = dmd.getJDBCMajorVersion(); int jdbcMinor = dmd.getJDBCMinorVersion(); int expectedJDBCMajor = -1; if (JDBC.vmSupportsJDBC4()) { expectedJDBCMajor = 4; } else if (JDBC.vmSupportsJDBC3()) { expectedJDBCMajor = 3; } else if (JDBC.vmSupportsJSR169()) { // Not sure what is the correct output for JSR 169 expectedJDBCMajor = -1; } if (expectedJDBCMajor != -1) { assertEquals("JDBC Major version", expectedJDBCMajor, jdbcMajor); assertEquals("JDBC Minor version", 0, jdbcMinor); } }
Example 2
Source File: DatabaseMetaDataTest.java From gemfirexd-oss with Apache License 2.0 | 4 votes |
/** * Methods that describe the version of the * driver and database. */ public void testVersionInfo() throws SQLException { DatabaseMetaData dmd = getDMD(); int databaseMajor = dmd.getDatabaseMajorVersion(); int databaseMinor = dmd.getDatabaseMinorVersion(); int driverMajor = dmd.getDriverMajorVersion(); int driverMinor = dmd.getDriverMinorVersion(); String databaseVersion = dmd.getDatabaseProductVersion(); String driverVersion = dmd.getDriverVersion(); if (usingEmbedded()) { // Database *is* the driver. assertEquals("Embedded Major version ", databaseMajor, driverMajor); assertEquals("Embedded Minor version ", databaseMinor, driverMinor); assertEquals("Embedded version", databaseVersion, driverVersion); } assertEquals("GemFireXD", dmd.getDatabaseProductName()); String driverName = dmd.getDriverName(); if (usingEmbedded()) { assertEquals("GemFireXD Embedded JDBC Driver", driverName); } else if (usingDerbyNetClient()) { assertEquals("GemFireXD Network Client JDBC Driver", driverName); } int jdbcMajor = dmd.getJDBCMajorVersion(); int jdbcMinor = dmd.getJDBCMinorVersion(); int expectedJDBCMajor = -1; if (JDBC.vmSupportsJDBC4()) { expectedJDBCMajor = 4; } else if (JDBC.vmSupportsJDBC3()) { expectedJDBCMajor = 3; } else if (JDBC.vmSupportsJSR169()) { // Not sure what is the correct output for JSR 169 expectedJDBCMajor = -1; } if (expectedJDBCMajor != -1) { assertEquals("JDBC Major version", expectedJDBCMajor, jdbcMajor); assertEquals("JDBC Minor version", 0, jdbcMinor); } }