We have a Sybase 17 ASA server and want to connect using an ODBC driver. Our goal is to use the full .NET Core 2.1 and above, not .NET Standard or .NET Framework 4.x.
How can I connect with Sybase 17 ASA in .NET Core, using ODBC?
2.9k Views Asked by MeanGreen At
3
There are 3 best solutions below
0
On
Create a linked server to the IQ and do the simple: insert into remoteserver.database.dbo.table_name select * from dbo.table_name;
This is how data is often transfered between ASE and IQ anyway.
0
On
There is now a .NET Core 3.1 library iAnywhere.Data.SQLAnywhere.NETCore
https://www.nuget.org/packages/iAnywhere.Data.SQLAnywhere.NETCore/
So far, this has provided the results I've needed to query data and using native libraries rather than ODBC or the old 4.6 libraries.
Edit to add, I believe it is still Windows only, so doesn't open up Unix hosting sadly - but is a massive improvement to using the old .NET libraries.
1. Prerequisites
Let's assume you've already installed SQL Anywhere 17 on the machine, including the required drivers.
2. Application setup
3. C# code
Add the following namespaces:
using System.Data;
using System.Data.Odbc;
Setup the connectionstring:
DRIVER={SQL Anywhere 17};server=srv_name;Database=db_name; Uid=user;pwd=pass;LINKs=tcpip(host=aaa.bbb.ccc.ddd)
Retrieve some data to confirm it works: