public static byte [ ] getImageData ( IHMConnection connection , long imageDataId ) throws Exception { String sql = "select " + // ImageDataTableFields . COLUMN_IMAGE . getFieldName ( ) + // " from " + TABLE_IMAGE_DATA + " where " + // ImageDataTableFields . COLUMN_ID . getFieldName ( ) + " = " + imageDataId ; try ( IHMStatement statement = connection . createStatement ( ) ; IHMResultSet rs = statement . executeQuery ( sql ) ; ) { statement . setQueryTimeout ( 30 ) ; // set timeout to 30 sec. if ( rs . next ( ) ) { byte [ ] bytes = rs . getBytes ( 1 ) ; return bytes ; } } return null ; }
Get Image data from data id .