Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6969861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:38:07+00:00 2026-05-27T16:38:07+00:00

The documentation for Firebird implies that you can write large (> 60K) strings to

  • 0

The documentation for Firebird implies that you can write large (> 60K) strings to a blob value in a table. So if you have this:

CREATE TABLE MyBlobTable (
theId int PRIMARY KEY NOT NULL,
theBlob BLOB SUB_TYPE 1
)

Then this should work:

insert into MyBlobTable (theId, theBlob) values (1, '[60K characters in a string]')

(example inspired by http://web.firebirdsql.org/dotnetfirebird/blob-sub_type-1-reading-example-csharp.html)

But I’ve found that neither C# drivers nor FlameRobin can write this value. You get ‘Unexpected end of command’ (pointing to a spot about 32K into the string, which is a little suspicious)

I figure there is a special way to quote or escape the data values, or maybe a C# equivalent of this Java code (http://www.firebirdfaq.org/faq372/) where a binary file is read directly into the statement. I’m not doing anything fancy with the text data so I’m open to storing it as a binary blob if needed.

Thanks!

Update: “parameterized queries” is the phrase that I was looking for. What I’m doing:

FbParameter param = new FbParameter("@blobVal", FbDbType.Text);
param.Value = myLargeString;
String query = "insert into MyBlobTable (theId, theBlob) values (1, @blobVal)";
using (FbConnection conn = [something from my pool]) {
    using (FbCommand cmd = new FbCommand(query, conn)) {
        cmd.Parameters.Add(param);
        cmd.ExecuteNonQuery();
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T16:38:07+00:00Added an answer on May 27, 2026 at 4:38 pm

    You are adding text inline in the query. Then there are limits: first query text in Firebird 2.5 and earlier is limited to 64 KB, in Firebird 3.0 this was increased to 10 MB, but some tools may still use the API in a way that limits it to 64KB. There is also a limit to the string literal size: 32KB, or since Firebird 3.0 64KB if it is a literal for a blob value.

    If you want to add more data to a blob, you need to stream it to the blob using parametrized queries. See this example:

    public static void Main(string[] args) {
        // Set the ServerType to 1 for connect to the embedded server
        string connectionString =
            "User=SYSDBA;" +
            "Password=masterkey;" +
            "Database=SampleDatabase.fdb;" +
            "DataSource=localhost;" +
            "Port=3050;" +
            "Dialect=3;" +
            "Charset=NONE;" +
            "Role=;" +
            "Connection lifetime=15;" +
            "Pooling=true;" +
            "Packet Size=8192;" +
            "ServerType=0";
        
        FbConnection myConnection = new FbConnection(connectionString);
        myConnection.Open();
        
        FbTransaction myTransaction = myConnection.BeginTransaction();
        
        FbCommand myCommand = new FbCommand();
        
        myCommand.CommandText =
            "UPDATE TEST_TABLE_01 SET CLOB_FIELD = @CLOB_FIELD WHERE INT_FIELD = @INT_FIELD";
        myCommand.Connection = myConnection;
        myCommand.Transaction = myTransaction;
        
        myCommand.Parameters.Add("@INT_FIELD", FbType.Integer, "INT_FIELD");
        myCommand.Parameters.Add("@CLOB_FIELD", FbType.Text, "CLOB_FIELD");
        
        myCommand.Parameters[0].Value = 1;
        myCommand.Parameters[1].Value = GetFileContents(@"GDS.CS");
        
        // Execute Update
        myCommand.ExecuteNonQuery();
        
        // Commit changes
        myTransaction.Commit();
        
        // Free command resources in Firebird Server
        myCommand.Dispose();
        
        // Close connection
        myConnection.Close(); 
    }
    
    public static string GetFileContents(string fileName) {
        StreamReader reader = new StreamReader(new FileStream(fileName, FileMode.Open));
        string contents = reader.ReadToEnd();
        reader.Close();
        return contents; 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The documentation for Google Documents List API , seems to say that you can
The documentation says, that core data properties can only store NSString, NSNumber and NSDate
AS3 documentation says that Strings in AS3 are in UTF-16 format. There is a
Documentation states that interface delegation is available for Win32 only. Currently I can't test
The documentation , implies that the connection is always remotely available, but since I
The documentation says there's a limit to the number of regions that can be
Documentation says that waypoints limit is 8 points. But I have to draw a
According to the official Firebird documentation , columns containing Unicode strings (what SQL Server
The documentation for Access.BackingField() indicates that this: Sets the access-strategy to use the backing-field
Documentation can be found here It says in the example: onDrop: Called whenever a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.