Subject | RE: [firebird-support] Error during database backup - Another request for help - now I have java test case too. |
---|---|
Author | Ryan Baldwin |
Post date | 2003-10-21T18:32:11Z |
Doh - and I forgot the test case
public class BadBlobTest
{
public static void main(String[] args)
{
try
{
if( new File("C:\\TESTDB.FDB").exists() == false )
{
FBManager fbManager = new FBManager();
fbManager.start();
fbManager.createDatabase("C:\\TESTDB.FDB", "SYSDBA",
"masterkey");
fbManager.stop();
}
final FBWrappingDataSource datasource = new
FBWrappingDataSource();
datasource.setDatabase("//localhost/C:\\TESTDB.FDB");
datasource.setUserName("SYSDBA");
datasource.setPassword("masterkey");
datasource.setIdleTimeoutMinutes(30);
datasource.setPooling(true);
datasource.setMinSize(1);
datasource.setMaxSize(30);
datasource.setLoginTimeout(10);
createBadBlobTable(datasource);
}
catch (SQLException e)
{
e.printStackTrace(); //To change body of catch statement
use Options | File Templates.
}
catch (Exception e)
{
e.printStackTrace(); //To change body of catch statement
use Options | File Templates.
}
}
private static void createBadBlobTable(FBWrappingDataSource datasource)
throws SQLException
{
final Connection connection = datasource.getConnection();
try
{
createTable(connection);
writeBlob(connection);
}
finally
{
connection.close();
}
}
private static void writeBlob(Connection connection) throws SQLException
{
final PreparedStatement statement =
connection.prepareStatement("INSERT INTO BADBLOB(BADBLOB) VALUES (?)");
try
{
statement.setBytes(1, getTestBytes());
statement.executeUpdate();
}
finally
{
statement.close();
}
}
private static byte[] getTestBytes()
{
final byte[] returnValue = new byte[128 * 1024];
for( int i = 0, n = returnValue.length; i<n; i++ )
returnValue[i] = (byte)i;
return returnValue;
}
private static void createTable(Connection connection) throws
SQLException
{
final Statement statement = connection.createStatement();
try
{
statement.execute( "CREATE TABLE BADBLOB ( BADBLOB BLOB )" );
}
finally
{
statement.close();
}
}
}
-----Original Message-----
From: Ryan Baldwin [mailto:ryan.baldwin@...]
Sent: 20 October 2003 18:27
To: firebird-support@yahoogroups.com
Subject: RE: [firebird-support] Error during database backup - Another
request for help - now I have java test case too.
Hi,
Sorry - but also -
I have tested this against FB1.5RC6 on Windows XP only.
Ryan
-----Original Message-----
From: Ryan Baldwin [mailto:ryan.baldwin@...]
Sent: 20 October 2003 18:21
To: firebird-support@yahoogroups.com
Subject: [firebird-support] Error during database backup - Another
request for help - now I have java test case too.
Hi All,
I have a problem with backing up firebird database. I have posted regarding
this a couple of times. At the end of this post is a test case that when run
against jaybird from the latest CVS will produce a database that cannot be
backed up. It fails with the following error:
gbak: ERROR: segment buffer length shorter than expected
gbak: ERROR: gds_$get_segment failed
gbak: Exiting before completion due to errors
I find this problem quite frustrating - In my opinion if the server allows a
database to be created and filled in in a particular way without error -
sureley it should then be able to back up the database ! So in my opinion
this should be considered a bug somewhere in Firebird.
The main difference between Jaybird 1.0.1 and Jaybird CVS HEAD is that
jaybird CVS HEAD makes use of streamed blobs and Jaybird 1.0.1 makes use of
segmented blobs.
A simple piece of java code that can create a database that cannot be backed
up is at the end of this post. This needs to be run against Jaybird CVS HEAD
to reproduce the problem. I can supply binaries of this Jaybird version if
this will help anyone - or I can supply the database produced. I can explain
and supply code snippets showing how Jaybird CVS HEAD is using the Firebird
API to create the blob.
Any infomation, clues or help would be very much appreciated. Maybe I am
just overlooking somthing obvious in which case I appologise.
Thanks
Ryan
To unsubscribe from this group, send an email to:
firebird-support-unsubscribe@yahoogroups.com
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
To unsubscribe from this group, send an email to:
firebird-support-unsubscribe@yahoogroups.com
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
public class BadBlobTest
{
public static void main(String[] args)
{
try
{
if( new File("C:\\TESTDB.FDB").exists() == false )
{
FBManager fbManager = new FBManager();
fbManager.start();
fbManager.createDatabase("C:\\TESTDB.FDB", "SYSDBA",
"masterkey");
fbManager.stop();
}
final FBWrappingDataSource datasource = new
FBWrappingDataSource();
datasource.setDatabase("//localhost/C:\\TESTDB.FDB");
datasource.setUserName("SYSDBA");
datasource.setPassword("masterkey");
datasource.setIdleTimeoutMinutes(30);
datasource.setPooling(true);
datasource.setMinSize(1);
datasource.setMaxSize(30);
datasource.setLoginTimeout(10);
createBadBlobTable(datasource);
}
catch (SQLException e)
{
e.printStackTrace(); //To change body of catch statement
use Options | File Templates.
}
catch (Exception e)
{
e.printStackTrace(); //To change body of catch statement
use Options | File Templates.
}
}
private static void createBadBlobTable(FBWrappingDataSource datasource)
throws SQLException
{
final Connection connection = datasource.getConnection();
try
{
createTable(connection);
writeBlob(connection);
}
finally
{
connection.close();
}
}
private static void writeBlob(Connection connection) throws SQLException
{
final PreparedStatement statement =
connection.prepareStatement("INSERT INTO BADBLOB(BADBLOB) VALUES (?)");
try
{
statement.setBytes(1, getTestBytes());
statement.executeUpdate();
}
finally
{
statement.close();
}
}
private static byte[] getTestBytes()
{
final byte[] returnValue = new byte[128 * 1024];
for( int i = 0, n = returnValue.length; i<n; i++ )
returnValue[i] = (byte)i;
return returnValue;
}
private static void createTable(Connection connection) throws
SQLException
{
final Statement statement = connection.createStatement();
try
{
statement.execute( "CREATE TABLE BADBLOB ( BADBLOB BLOB )" );
}
finally
{
statement.close();
}
}
}
-----Original Message-----
From: Ryan Baldwin [mailto:ryan.baldwin@...]
Sent: 20 October 2003 18:27
To: firebird-support@yahoogroups.com
Subject: RE: [firebird-support] Error during database backup - Another
request for help - now I have java test case too.
Hi,
Sorry - but also -
I have tested this against FB1.5RC6 on Windows XP only.
Ryan
-----Original Message-----
From: Ryan Baldwin [mailto:ryan.baldwin@...]
Sent: 20 October 2003 18:21
To: firebird-support@yahoogroups.com
Subject: [firebird-support] Error during database backup - Another
request for help - now I have java test case too.
Hi All,
I have a problem with backing up firebird database. I have posted regarding
this a couple of times. At the end of this post is a test case that when run
against jaybird from the latest CVS will produce a database that cannot be
backed up. It fails with the following error:
gbak: ERROR: segment buffer length shorter than expected
gbak: ERROR: gds_$get_segment failed
gbak: Exiting before completion due to errors
I find this problem quite frustrating - In my opinion if the server allows a
database to be created and filled in in a particular way without error -
sureley it should then be able to back up the database ! So in my opinion
this should be considered a bug somewhere in Firebird.
The main difference between Jaybird 1.0.1 and Jaybird CVS HEAD is that
jaybird CVS HEAD makes use of streamed blobs and Jaybird 1.0.1 makes use of
segmented blobs.
A simple piece of java code that can create a database that cannot be backed
up is at the end of this post. This needs to be run against Jaybird CVS HEAD
to reproduce the problem. I can supply binaries of this Jaybird version if
this will help anyone - or I can supply the database produced. I can explain
and supply code snippets showing how Jaybird CVS HEAD is using the Firebird
API to create the blob.
Any infomation, clues or help would be very much appreciated. Maybe I am
just overlooking somthing obvious in which case I appologise.
Thanks
Ryan
To unsubscribe from this group, send an email to:
firebird-support-unsubscribe@yahoogroups.com
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
To unsubscribe from this group, send an email to:
firebird-support-unsubscribe@yahoogroups.com
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/