C # connect to sybase 15.5 through OleDb

Source: Internet
Author: User
Tags sybase sybase database

Take MySQL 15.5 as an example.

First download the sybase oledb15.5 driver, as shown below:

Http://download.csdn.net/detail/tg01/3608486

The data connection string is as follows:

Provider = ASEOLEDB; Data Source = ip: 5000; Catalog = database name; User Id = User name; Password = Password;

Appendix sybase database connection string

Http://www.connectionstrings.com/sybase-adaptive

Ase ado. NET Data ProviderTYPE. NET Framework Class Library
USAGE Sybase. Data. AseClient. AseConnection
MANUFACTURER Sybase
Set example values»

More about this class library» StandardData Source = 'myaseserver '; Port = 5000; Database = myDataBase; Uid = myUsername; Pwd = myPassword;

Read more! Adaptive Server Enterprise ADO. NET Data Document Sets

 

COPY Using the SQL. ini file

If the server isn' t aliased, you have to use the ip address and port number in the connection string, not ideal as these may change occassionally. installing sybase on a machine, you will have a "SQL. ini "file that maps an alias name to an ip address and a port. that file can be rolled out to all users, and the SQL. ini updated when necessary. use the following connection string to force the AseConnection object to use the interface file.

DSURL = 'file: // c: \ sybase \ ini \ SQL. ini? SQL _MIDOFF_OPC1 '; Database = myDataBase; UID = myUsername; PWD = myPassword; APP = myAppName; COPY Adaptive Server Anywhere OLE DB ProviderTYPE OLE DB Provider
USAGE Provider = ASAProv
MANUFACTURER Sybase
Set example values»

More about this provider» StandardProvider = ASAProv; Data source = myASA; copy tcp/IPProvider = ASAProv.90; Eng = server. database_name; Uid = myUsername; Pwd = myPassword; Links = tcpip (Host = servername );

Use this when connecting to a server located on the other side of a router. Without the Links = tcpip (Host = servername) the error "Server cocould not be found" can arise when connecting.

 

COPY Sybase ase ole db ProviderTYPE ole db Provider
USAGE Provider = ASEOLEDB
MANUFACTURER Sybase
Set example values»

More about this provider» With Data Source. IDS fileProvider = Sybase ase ole db Provider; Data source = myASE;

Note that you must create a Data Source. IDS file using the Sybase Data Administrator. These. IDS files resemble ODBC DSNs.

 

COPY Adaptive Server Enterprise (ASE) alternative 1 Provider = Sybase. ASEOLEDBProvider; Srvr = myASEserver, 5000; Catalog = myDataBase; User Id = myUsername; Password = myPassword;

Some reports on problem using the above one, try the following as an alternative.

 

COPY Adaptive Server Enterprise (ASE) alternative 2 Provider = Sybase. ASEOLEDBProvider; Server Name = myASEserver, 5000; Initial Catalog = myDataBase; User Id = myUsername; Password = myPassword;

Some other reports on problem using the above one, try the following as an alternative

 

COPY Adaptive Server Enterprise (ASE) 12.5 Provider = Sybase. ASEOLEDBProvider.2; Server Name = myASEserver; Server Port Address = 5000; Initial Catalog = myDataBase; User ID = myUsername; Password = myPassword;

This one works only from Open Client 12.5 where the server port number feature works, allowing fully qualified connection strings to be used without defining any. IDS Data Source files.

 

COPY Adaptive Server Enterprise (ASE) 15.0 Provider = ASEOLEDB; Data Source = myASEserver: 5000; Catalog = myDataBase; User Id = myUsername; Password = myPassword; COPY Adaptive Server Enterprise (ASE) 15.0 alternative

This one is wrongly ded because of reported problems with using the "Catalog" key which was solved by using the 12.5 syntax key "Initial Catalog" instead.

Provider = ASEOLEDB; Data Source = myASEserver: 5000; Initial Catalog = myDataBase; User Id = myUsername; Password = myPassword; COPY. NET Framework Data Provider for ole dbtype. NET Framework Wrapper Class Library
USAGE System. Data. OleDb. OleDbConnection
MANUFACTURER Microsoft
Set example values»

More about this wrapper class library» Bridging to Adaptive Server Anywhere ole db Provider

This is just one connection string sample for the wrapping OleDbConnection class that callthe underlying OLEDB provider. See respective ole db provider for more connection strings to use with this class.

Provider = ASAProv; Data source = myASA; COPY Adaptive Server Enterprise ODBC driverTYPE ODBC Driver
USAGE Driver = {Adaptive Server Enterprise}
MANUFACTURER Sybase
Set example values»

More about this driver» Adaptive Server Enterprise 15.0 Driver = {Adaptive Server Enterprise}; app = myAppName; server = myServerAddress; port = myPortnumber; db = myDataBase; uid = myUsername; pwd = myPassword;

The key "app" is optional

 

COPY Standard Sybase System 12 Enterprise Open ClientDriver = {sybase ase odbc Driver}; Srvr = myServerAddress; Uid = myUsername; Pwd = myPassword; COPY Standard Sybase System 12.5 Enterprise Open ClientDriver = {sybase ase odbc Driver}; NA = Hostname, Portnumber; Uid = myUsername; Pwd = myPassword; copy tds based ODBC driver (from Sybase OCS 12.5) Driver = {Sybase ase odbc Driver}; NetworkAddress = myServerAddress, 5000; Db = myDataBase; Uid = myUsername; Pwd = myPassword; COPY Standard Sybase System 11 Driver = {sybase system 11}; Srvr = myServerAddress; Uid = myUsername; Pwd = myPassword; Database = myDataBase;

Check out the Adaptive Server Enterprise Document Sets

 

COPY Intersolv 3.60 type odbc Driver
USAGE Driver = {INTERSOLV 3.60 32-BIT Sybase}
MANUFACTURER DataDirect Technologies
Set example values»

More about this driver» StandardDriver = {INTERSOLV 3.60 32-BIT Sybase}; Srvr = myServerAddress; Database = myDataBase; Uid = myUsername; Pwd = myPassword; COPY Intersolv 3.10 type odbc Driver
USAGE Driver = {INTERSOLV 3.10 32-BIT Sybase}
MANUFACTURER DataDirect Technologies
Set example values»

More about this driver» Intersolv 3.10 Driver = {INTERSOLV 3.10 32-BIT Sybase}; Srvr = myServerAddress; Uid = myUsername; Pwd = myPassword; COPY Sybase SQL Anywhere (former Watcom SQL) ODBC driverTYPE ODBC Driver
Usage odbc; Driver = Sybase SQL Anywhere 5.0
MANUFACTURER Sybase
Set example values»

More about this driver» ODBC; Driver = Sybase SQL Anywhere 5.0; defadir dir = c: \ dbfolder \; Dbf = c: \ mydatabase. db; Uid = myUsername; Pwd = myPassword; Dsn = "";

Important note! <Br/> The quota "in the string needs to be escaped using your language specific escape syntax. <br/> c #, c ++ & nbsp; \ "<br/> VB6, VBScript & nbsp; "" <br/> xml (web. config etc) & nbsp; & amp; quot; <br/> or maybe use a single quota '.

The empty DSN parameter is indeed critical as not including it will result in error 7778.

 

COPY. NET Framework Data Provider for ODBCTYPE. NET Framework Wrapper Class Library
USAGE System. Data. Odbc. OdbcConnection
MANUFACTURER Microsoft
Set example values»

More about this wrapper class library» Bridging to Adaptive Server Enterprise ODBC driver

This is just one connection string sample for the wrapping OdbcConnection class that callthe underlying ODBC Driver. See respective ODBC driver for more connection strings to use with this class.

Driver = {Adaptive Server Enterprise}; server = myServerAddress; port = myPortnumber; db = myDataBase; uid = myUsername; pwd = myPassword; COPY

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.