Java Code Examples for java.sql.DatabaseMetaData#sqlStateSQL99()

The following examples show how to use java.sql.DatabaseMetaData#sqlStateSQL99() . 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: DataSourceMetaData.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public int getSQLStateType( ) throws OdaException
{
	logger.logp( java.util.logging.Level.FINEST,
			DataSourceMetaData.class.getName( ),
			"getSQLStateType",
			"DataSourceMetaData.getSQLStateType( )" );
	if ( dbMetadata == null )
	{
		throw new JDBCException( ResourceConstants.DRIVER_NO_CONNECTION,
				ResourceConstants.ERROR_NO_CONNECTION );
	}
	try
	{
		if ( dbMetadata.getSQLStateType( ) == DatabaseMetaData.sqlStateSQL99 )
		{
			return sqlStateSQL99;
		}
		else
		{
			return sqlStateXOpen;
		}
	}
	catch ( SQLException e )
	{
		throw new JDBCException( ResourceConstants.SQLSTATE_TYPE_CANNOT_GET, e );
	}
}
 
Example 2
Source File: DataSourceMetaDataTest.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
@Test
   public void testGetSQLStateType( ) throws Exception
{
	/*
	 * when the Connection is not open, the dbMeta is null and should throw
	 * exception for the getSQLStateType.
	 */
	try
	{
		this.dbMeta2.getSQLStateType( );
		fail( "call getSQLStateType from DataSourceMetaData which is from the non-opened connection should throw exception." );
	}
	catch ( JDBCException e )
	{

	}

	java.sql.Connection jdbcConn = TestUtil.openJDBCConnection( );

	DatabaseMetaData dbMeta = jdbcConn.getMetaData( );

	if ( dbMeta.getSQLStateType( ) == DatabaseMetaData.sqlStateSQL99 )
	{
		assertEquals( this.dbMeta1.getSQLStateType( ),
				DataSourceMetaData.sqlStateSQL99 );

	}
	else
	{
		assertEquals( this.dbMeta1.getSQLStateType( ),
				DataSourceMetaData.sqlStateXOpen );

	}

}
 
Example 3
Source File: JdbcThinDatabaseMetadata.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override public int getSQLStateType() throws SQLException {
    return DatabaseMetaData.sqlStateSQL99;
}
 
Example 4
Source File: PhoenixDatabaseMetaData.java    From phoenix with Apache License 2.0 4 votes vote down vote up
@Override
public int getSQLStateType() throws SQLException {
    return DatabaseMetaData.sqlStateSQL99;
}
 
Example 5
Source File: PhoenixDatabaseMetaData.java    From phoenix with Apache License 2.0 4 votes vote down vote up
@Override
public int getSQLStateType() throws SQLException {
    return DatabaseMetaData.sqlStateSQL99;
}
 
Example 6
Source File: PhoenixDatabaseMetaData.java    From phoenix with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public int getSQLStateType() throws SQLException {
    return DatabaseMetaData.sqlStateSQL99;
}