Sybase AseConnection Internal Error 30016

A windows service I developed – which uses Sybase ADO.NET drivers  to connect to a Sybase database – suddenly stopped working yesterday. The log files showed a sybase exception described as Internal error 30016.  We had a contingency server on which a copy of the main database is loaded daily, so I tried connecting to this one and the error did not show up. This led me to believe that something had been changed, and I asked the local Sybase DBA if something had changed. He was clueless.

Restarting the service did not help, so I started googling “sybase error 30016”.  I found the solution on stackoverflow: it had something to do with the default network packet size setting on the server.  I looked up the connection string setting for “packet size” from Sybase Infocenter and then i added it to my application’s app.config, setting it to 2096 like the below (scrubbed, of course)

<connectionStrings>
<add name="aequinox" providerName="Sybase.Data.AseClient" connectionString="Data Source=xx.xxx.xxx.xxx,xxxx;Initial Catalog=staging;User Id=xxxxx;Password=xxxxx;PacketSize=2096;CharSet='iso_1'" />
</connectionStrings>

I restarted the service again and the problem went away. I still don’t know why it worked, and I don’t really want to know. I hate working with Sybase.

Update:

The error came back the very next day! After going over all the  changes made to each component of the system, we discovered a ‘tweak’ made by one of the database developers on the main stored procedure used by the application. In this ‘tweak’, a table was being dropped and recreated using a “select into”  statement at each call of the stored procedure, like so:

delete csa_cc_tc
go
insert into csa_cc_tc
select charge_code ,effective_dt,status,empl_id,create_dt,1 ,description
from ad_gb_cc
union all
select tran_code ,effective_dt,status,empl_id,create_dt,debit_credit,description
from ad_gb_tc

Strange, I know. Blame the Sybase database developer, the code wasn’t commented and I have no idea why he’s doing that. I read from this blog that

another condition that raises this error is if your query outputs a column that is SMALLDATETIME NOT NULL.

and that

… Sybase tech support … advised us to upgrade the .NET PC Client to the latest EBF (ebf13008). This magically solved all these internal error problems.

Incidentally, this drop-table-create-table routine does select a non-null smalldatetime field. Getting the latest EBF was not an option, and I couldn’t alter the table DDL. Instead, I moved the statement block into another stored procedure which is not called by my application, but is guaranteed to execute before my application starts up anyway.

Now the problem is gone  – for real this time.

Related Posts

Unresolved Assembly Reference when Merging Precompiled ASP.NET Assemblies

If you need to merge the output DLLs generated after precompiling an ASP.NET website from Visual Studio 2008 and later, you need to use the ASP.NET merge tool. The location of this tool is a bit tricky, though. The version in the default location is actually the wrong one!

Accessing the VMware BIOS Screen at startup

Fortunately, there is a configuration setting that will give you more time to enter the BIOS screen at startup. It will make the POST screen delay for the specified number of milliseconds.

Reading a Binary XML stream in WCF

If you don’t provide a dictionary to read the XML stream with, you will get a weird and unhelpful exception that says “the input source is not correctly formatted”, and googling around will only bring you to posts telling you that “your client/server endpoints are not matched” or “you need to use the basicHttpBinding”. This is not a binding issue – it’s a deserialization issue that comes up when i make an attempt to inspect the soap messages coming in to (or going out of) my WCF service.

Specifing the bridging network adapter in vmware player 4

For those of you using VMware Player 4 on linux hosts, if you’re not happy with the autobridging for the vmnet0 network, you can choose a specific…

How TestDisk and the GParted LiveCD saved my deleted partitions

I was messing around with Vmware converter (in windows XP, running from a dual-boot partition), and then I kept getting the following message: “FAILED: Unable to find…

Reset Forgotten Local Administrator Password on Windows

Where angels fear to tread, fools rush in. I happily removed my computer from the domain and restarted Windows 7. When the computer came back up, I couldn’t login with my domain user account – which was not surprising. However, I could not log in with the local admin account either! I had reset the password like 6 months ago and forgotten about it. Now I couldn’t log in to the computer, and no one could help me remotely.