Sybase(SAP)ASE ADO.NET连接因Blob插入而超时

我知道

我有一个只有一个表的新SAP ASE数据库,该表只有三列-两个varchar列和一个image列。

使用从SAP ASE数据库的开发人员版本中获取的纯ADO.NET提供程序,我只是尝试将带有文件内容的记录插入到该表中-我的第一个试用版使用3kb文件,它的工作原理很吸引人。然后,我获取了一个大约900kb(肯定小于1MB)的PDF,并且该应用程序给了我一个超时时间。那么丑陋的是,事实是,整个数据库都被阻塞了-我不得不重新启动该服务以使其再次运行。

因此,现在让我们开始编写代码-如果有人可以带领我朝正确的方向发展,我将非常感激。

static void Main(string[] args)
        {
            using (AseConnection aseConnection =
                    new AseConnection(
                        "data source=...;initial catalog=...;User ID=...;Password=...;Port=...;ConnectionIdleTimeout=600;CommandTimeOut=0;ConnectionTimeOut=0;Pooling=False;TextSize=10000000")
            )
            {
                aseConnection.Open();
                Console.WriteLine(aseConnection.State.ToString());

                AseCommand setTextSizeCommand = new AseCommand("SET TEXTSIZE 10000000", aseConnection);
                setTextSizeCommand.ExecuteNonQuery();

                byte[] fileContent = File.ReadAllBytes(@"d:\adonet.pdf");
                //byte[] fileContent = File.ReadAllBytes(@"d:\rack.txt");

                AseCommand aseCommand = new AseCommand("insert into xxx(web_id, doc_name, doc_file) values(?, ?, ?)", aseConnection);
                aseCommand.Parameters.Add(0, AseDbType.VarChar, 20).Value = "100";
                aseCommand.Parameters.Add(1, AseDbType.VarChar, 100).Value = "fisier";
                aseCommand.Parameters.Add(2, AseDbType.Image, fileContent.Length).Value = fileContent;
                aseCommand.NamedParameters = false;
                aseCommand.CommandTimeout = 65000;

                aseCommand.ExecuteNonQuery();
            }
        }

ASE客户端dll的版本为16.0.2.2。

非常感谢你!

我知道

为了解决此问题,我不得不从头开始创建一个新的数据库,但是这次我从一开始就为其提供了更多的空间(1GB而不是6MB-默认值)。

现在一切都像魅力一样运转。

谢谢

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章