1024programmer Blog Several ways to connect dot net to Sybase database_postfxj’s blog

Several ways to connect dot net to Sybase database_postfxj’s blog

How dot net connect to Sybase database

I recently worked on a project for a power grid company. Because their database is Sybase12.5.1, they simply learned about the Sybase database. But I found that there is very little information about it on the Internet. It took me a lot of effort to get the Sybase database connection and garbled characters done. To sum up

1. Several connection methods and configurations for Net to connect to Sybase12.5.1 database

1. ODBC method

Use a connection string when connecting to .Net such as “Driver={Sybase System 11};Srvr=xqc;database=DBData;uid=DB;pwd=11;”

Configure ODBC driver steps:

a. Confirm that the Sybase12.5.1 client has installed the ODBC driver.

b. Click the ODBC data source manager to select the system DSN, and then add the Sybase ASE ODBC Driver in the pop-up dialog box. Click Finish, and the Sybase ODBC detailed configuration window will pop up.

c. Input Data Source Name, NetWork Address, and Database Name in the Sybase ODBC detailed configuration window; among them, Data Source Name is used by Srvr in the connection string, and the format of NetWork Address is “Sybase database server IP, port Number”, Database Name is the name of the database you want to access.

d. After setting, you can first test whether it is connected, click Test Connect, then enter the user name and password, and report “connection successful!”

2. OLEDB method

Use the connection string when connecting to .Net such as “Provider=Sybase.ASEOLEDBProvider.2;Data Source=xqc;

User ID=DB;Password=11;charset=eucgb; Server Name=10.195.60.143; ”

Configure OLEDB driver steps:

a. Confirm that the Sybase12.5.1 client has installed the OLEDB driver.

b. Enter Sybase Configuration Manager to add an OLEDB data source. Enter the Data Source Name and select the Sybase ASE OLEDB Provider driver. Data Source Name This is used by the Data Source in the connection string

c. Configure Server Name and Database Name in the detailed setting window of Sybase ASE OLEDB Provider; the format of Server Name is “Sybase database server IP, port number”, and Database Name is the name of the database you want to access.

d. After setting, you can first test whether it is connected, click Test Connect, then enter the user name and password, and report “connection successful!”

3. Connect with Sybase.Data.AseClient

Use a connection string when connecting to .Net such as “Data Source=10.195.49.47;charset=eucgb;Port=5100;UID=DB;PWD=11”

Download AseClient to the local, copy the three files Sybase.Data.AseClient.dll sybdrvado11.dll sybdrvssl.dll to the project bin folder, and reference Sybase.Data.AseClient.dll in the project, it can be used now up.

Example:

AseConnection con=new AseConnection(“Data Source=10.195.49.47;charset=eucgb;Port=5100;UID=DB;PWD=11” );
AseDataAdapter da=new AseDataAdapter(“select id,name from Tablename”,con);
DataSet ds=new DataSet();
da.Fill(ds);

This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/several-ways-to-connect-dot-net-to-sybase-database_postfxjs-blog/

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索