Using Sybase Drivers in .Net without installing Sybase ASE Developer Tools

16 Mar 2016

Tutorial Database

This is a very short post that will help any developers that need to work with Sybase in .Net. We are currently working on a project that needs to connect to a Sybase database. But we want to connect to Sybase without having to install the big mammoth installation!

PLEASE NOTE: this blog uses Sybase v15.02

For my example, we’re not using the most recent version of Sybase; In order for this to work, you’ll need to get hold of the following assemblies. In my case, I installed the mammoth Sybase installation on a VM and then extracted the assemblies I needed.

You need the following assemblies:

Sybase.AdoNet2.AseClient.dll
sybdrvado20.dll

Add these assemblies to you project (Include in project).

Assemblies

Next, select the sybdrvado20.dll in the project and set the output property to copy to output.

Properties

Finally, add a reference to the Sybase.AdoNet2.AseClient.dll in the project references.

using Sybase.Data.AseClient;
using Dapper;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            using (var connection = new AseConnection("CONNECTION STRING"))
            {
                connection.Open();
                var obj = connection.Query("select * from [Table]");
            }
        }
    }
}