List of usage examples for java.sql DatabaseMetaData getSQLStateType
int getSQLStateType() throws SQLException;
SQLException.getSQLState
is X/Open (now known as Open Group) SQL CLI or SQL:2003. From source file:it.emacro.extractor.db.ConnectionPool.java
public void inspect() throws SQLException { Connection conn = getConnection(); try {//w w w. ja v a 2s . c o m DatabaseMetaData dmd = conn.getMetaData(); sqlStateType = dmd.getSQLStateType(); // dumpDBMDInfo(); } finally { closeConnection(conn); } }
From source file:org.apache.hadoop.hive.jdbc.TestJdbcDriver.java
public void testDatabaseMetaData() throws SQLException { DatabaseMetaData meta = con.getMetaData(); assertEquals("Hive", meta.getDatabaseProductName()); assertEquals("1", meta.getDatabaseProductVersion()); assertEquals(DatabaseMetaData.sqlStateSQL99, meta.getSQLStateType()); assertNull(meta.getProcedures(null, null, null)); assertFalse(meta.supportsCatalogsInTableDefinitions()); assertFalse(meta.supportsSchemasInTableDefinitions()); assertFalse(meta.supportsSchemasInDataManipulation()); assertFalse(meta.supportsMultipleResultSets()); assertFalse(meta.supportsStoredProcedures()); assertTrue(meta.supportsAlterTableWithAddColumn()); }
From source file:org.apache.hive.jdbc.TestJdbcDriver2.java
@Test public void testDatabaseMetaData() throws SQLException { DatabaseMetaData meta = con.getMetaData(); assertEquals("Apache Hive", meta.getDatabaseProductName()); assertEquals(HiveVersionInfo.getVersion(), meta.getDatabaseProductVersion()); assertEquals(System.getProperty("hive.version"), meta.getDatabaseProductVersion()); assertTrue("verifying hive version pattern. got " + meta.getDatabaseProductVersion(), Pattern.matches("\\d+\\.\\d+\\.\\d+.*", meta.getDatabaseProductVersion())); assertEquals(DatabaseMetaData.sqlStateSQL99, meta.getSQLStateType()); assertFalse(meta.supportsCatalogsInTableDefinitions()); assertTrue(meta.supportsSchemasInTableDefinitions()); assertTrue(meta.supportsSchemasInDataManipulation()); assertFalse(meta.supportsMultipleResultSets()); assertFalse(meta.supportsStoredProcedures()); assertTrue(meta.supportsAlterTableWithAddColumn()); //-1 indicates malformed version. assertTrue(meta.getDatabaseMajorVersion() > -1); assertTrue(meta.getDatabaseMinorVersion() > -1); }