jaybird
jaybird copied to clipboard
Setting RoleName to emtpy string throws errors [JDBC455]
Submitted by: Tomasz Kujalow (tkujalow)
1) When I set property RoleName to "" (empty string) I get error: GDS Exception. 335544382. Invalid clumplet buffer structure: buffer end before end of clumplet - clumplet too long
2) When I test this value by .getRoleName() I get value: true (String "true").
3) When I set null (ROLE=null) or "RDB$ADMIN" (ROLE="RDB$ADMIN") there is no error.
4) When comment out: <//dbDriver.setMinPoolSize>(3); I get error: org.firebirdsql.jdbc.FBSQLException: Could not obtain connection during blocking timeout (5000 ms)
The test program showing the error:
package com.progpol.test.firebird;
import java.sql.SQLException;
import org.firebirdsql.jdbc.FirebirdConnection; import org.firebirdsql.pool.FBWrappingDataSource;
public class BufferEndException {
//GDS Exception\. 335544382\. Invalid clumplet buffer structure: buffer end before end of clumplet \- clumplet too long
private static FBWrappingDataSource dbDriver;
private static FirebirdConnection conn;
private static java\.sql\.Statement st;
private static java\.sql\.ResultSet rs;
public static void main\(String\[\] args\) \{
final String ROLE="";
dbDriver=new FBWrappingDataSource\(\);
dbDriver\.setType\("TYPE4"\);
dbDriver\.setSqlDialect\("3"\);
dbDriver\.setCharSet\("UTF\-8"\);
dbDriver\.setEncoding\("UTF8"\);
dbDriver\.setRoleName\(ROLE\);
System\.out\.println\("set ROLE=\|"\+ROLE\+"\|"\);
System\.out\.println\("get ROLE=\|"\+dbDriver\.getRoleName\(\)\+"\|"\);
dbDriver\.setConnectTimeout\(1\);
dbDriver\.setTimestampUsesLocalTimezone\(false\);
dbDriver\.setKeepStatements\(false\);
dbDriver\.setStatementPooling\(false\);
dbDriver\.setPooling\(true\);
dbDriver\.setLoginTimeout\(5\);
dbDriver\.setMaxIdleTime\(5000\);
dbDriver\.setMinPoolSize\(3\);
dbDriver\.setMaxPoolSize\(6\);
StringBuilder database=new StringBuilder\(\);
database\.append\("127\.0\.0\.1"\);
database\.append\("/"\+3050\);
database\.append\(":"\+"d:\\\\database\\\\database\.gdb"\);
dbDriver\.setDatabase\(database\.toString\(\)\);
try \{
FirebirdConnection conn=\(FirebirdConnection\)dbDriver\.getConnection\("SYSDBA","masterkey"\);
conn\.setAutoCommit\(false\);
String sql = "SELECT count\(\*\) AS FIELD\_CNT FROM RDB$FIELDS";
st = conn\.createStatement\(\);
rs = st\.executeQuery\(sql\);
if\(rs\.next\(\)\)\{
int cnt=rs\.getInt\(1\);
System\.out\.println\("return="\+cnt\);
\};
conn\.commit\(\);
conn\.close\(\);
\} catch \(SQLException e\) \{
e\.printStackTrace\(\);
\}
\}
}
Commented by: @mrotteveel
As a workaround: don't set the rolename if it is empty.
Also note that FBWrappingDataSource is deprecated and will be removed in Jaybird 3, see http://www.firebirdsql.org/file/documentation/drivers_documentation/java/2.2.11/release_notes.html#removal-of-deprecated-classes-packages-and-interface-methods
Added tests to verify this doesn't happen anymore.
NOTE: The "cannot reproduce" label was added to reflect that this behaviour no longer occurs.