Made loading of blobs from database more robust (#3895)

Signed-off-by: mpe85 <marco.perazzo85@gmail.com>
This commit is contained in:
mpe85 2019-07-29 06:33:40 +02:00 committed by Jan Bartel
parent a38ac923ac
commit bb639817a3
1 changed files with 11 additions and 2 deletions

View File

@ -27,6 +27,7 @@ import java.sql.Driver;
import java.sql.DriverManager; import java.sql.DriverManager;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.util.Locale; import java.util.Locale;
import javax.naming.InitialContext; import javax.naming.InitialContext;
import javax.naming.NamingException; import javax.naming.NamingException;
@ -164,9 +165,17 @@ public class DatabaseAdaptor
return new ByteArrayInputStream(bytes); return new ByteArrayInputStream(bytes);
} }
try
{
Blob blob = result.getBlob(columnName); Blob blob = result.getBlob(columnName);
return blob.getBinaryStream(); return blob.getBinaryStream();
} }
catch (SQLFeatureNotSupportedException ex)
{
byte[] bytes = result.getBytes(columnName);
return new ByteArrayInputStream(bytes);
}
}
public boolean isEmptyStringNull() public boolean isEmptyStringNull()
{ {