怎样使用C#连接SYBASE数据库?

Alwin_Lee 2001-10-31 11:26:02
我想使用C#连接SYBASE数据库,但在MSDN里没有发现连接方法,在MSDN里有连接
SQLSERVER、ORACLE、ACESS数据库的方法,但就是没有SYBASE的,不知道为什么,
谁能告诉我吗?
...全文
230 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
leon_wwj_66 2010-06-12
  • 打赏
  • 举报
回复
http://topic.csdn.net/u/20100611/16/f0ef0159-ee93-47ee-be0a-3810b00aa47f.html#replyachor

请看这个帖子的讨论。
hdg_sy 2001-11-08
  • 打赏
  • 举报
回复
一篇有关这个问题的文章,网址记不住了
Quite a bit of confusion reigns out there today on what are the options for connecting to Sybase from Visual Basic using ADO. Most of the blame goes to Sybase which has a truly confusing marketing message and a completely useless website, full of marketing fluff. It seems that they rename the products and their goals at will. One minute a product is called Sybase Studio Anywhere, the next minute Sybase Lite or Adaptive Server Anywhere and then back. Adaptive Server Enterprise (the high end product) is on occasion called Sybase SQL Server. You get the picture. Same happens with the marketing priorities. Depending on when you talk to them, you'll hear a different song on where the company is headed. Sometimes they are all about replication with mobile devices, other times they are the database provider, then XML champions...
So there is no surprise that one of the most asked questions about Sybase on the newsgroups is the simplest one of all: how to connect with ADO. Well, there are several options. I've broken down information based on the version.

Sybase Adaptive Server Enterprise 12.x
Version 12.x ships with its own OLE DB Provider. It will show up in the list of drivers as Sybase ASE Provider. The performance is not too bad, definitely better than connecting to the ODBC driver through the OLEDB Provider for ODBC Drivers. There were a couple of lingering bugs, which should be stumped out by March 2001. The driver requires that OpenClient be installed on user's machine.
Second option for drivers is to request an unreleased, but solid, version of what is known as "TDS" (Tabular Data Stream) driver. It sheds the dependence on the OpenClient, thus offering better performance. Besides that's one less installation headache you have to deal with. As of writing (March 2001), you have to call their tech support and ask for it. They'll make you sign an agreement if you want to use it in a production environment. This driver will ship with Sybase 12.5 when it comes out in August 2001
The last option is to purchase drivers from Merant (formerly Intersolv). I would never purchase drivers because they should be provided for free with the database. However, with this one there is a catch. Sybase doesn't write its own drivers. They are outsourced to Merant. So Merant, sells, what I would call, either a value-added driver or a driver that is one version ahead. It is up to you to determine whether what they sell is worth your money.
Sybase Adaptive Server Enterprise 11.x
You are using Sybase 11.x on the backend, but there is no OLEDB provider for it. What do you do? One option is to use OLEDB Provider for ODBC Drivers. I know it is slower than other options, but it is usable. It slows down if you have a lot of queries returning little amounts of data. If you have few queries returning large amounts of data, you probably won't notice the difference. I've been using this method for a year now and the users are not complaining. There are actually several ODBC drivers for the 11.x series. There is one for 11.1.x, 11.5 and 11.9.x versions. The most widely used driver is from Sybase version 11.1.x. One drawback to this driver is that it is not thread-safe, thus it will refuse to connect in an MTS environment. In other words, if you are making a connection from a COM object that requires an MTS transaction, the ODBC driver will refuse to connect. If you must have an MTS transaction, upgrade to at least the ODBC driver for Sybase 11.5, which is thread-safe and thus able to participate in transactions.
Another alternative is to install OpenClient 12 on your users' machines (if in fact you have OpenClient 12, since it comes with Sybase ASE 12.x). This way you can use the OLEDB Provider for Sybase 12 with your Sybase 11.x backend. The provider is backwards compatible, just don't use any Sybase 12 specific commands (like dynamic execute) and you'll be fine.
Merant sells an OLEDB provider for ASE 11.x as well. Again, weigh your costs against the perceived performance improvement.
Last, but not least in my mind and definitely no performance slouch is to use the ODBC driver but bypass ADO's default mechanism for connecting to ODBC drivers. Basically if you connect with standard syntax ODBC syntax, like: "Driver={Sybase System 11};PWD=vbguru;UID=gelbro;DB=dictionary;servername=SYBPRD_DEV" and so on, you'll be speeding along.
Sybase Anywhere Studio 7.x
Just like ASE 12.x brethen, this product also comes with its own OLEDB Provider, which makes it a no-brainer to select your connection strategy. The provider has no requirement for OpenClient, but can work through it if necessary
Sybase Anywhere Studio 6.x
The only option here is to use the provided ODBC driver either through explicit ODBC connection syntax or through OLEDB Provider for ODBC driver. For this case, I recommend dumping ADO and using DAO's excellent ODBC Direct feature. The provided ODBC driver can also work either with or without the OpenClient.
Where to get all these drivers
If you ever looked to Sybase's website to download drivers or providers, you were probably frustrated. They are difficult to find. Below are the four ways, I gotten drivers:
Sybase expects you to get drivers from the product CD-ROM and that is the first place you should look. If you go to the Downloads section of their website, you will NOT find any driver downloads.
Another way to get a driver is through an EBF (emergency bug fix) - basically a variation on Microsoft's service pack, which is really a variation of a bug fix. Find the latest EBF for your product, read the manifest (it's sybase-speak for readme.txt), make sure it includes the drivers, then download and install.
Call Sybase tech support and ask for drivers. They are pretty friendly and will give you some FTP site to download from.
Download the NT evaluation of Sybase System 12. Keep in mind that the download is about 300 MB
Go to the beta download section of the Linux 11.9.2 version and download the Sybase PC Client (35MB). At the time of writing this download is directly available here.
If all else fails, go to Merant's web site and download their evaluation drivers.
Alwin_Lee 2001-11-07
  • 打赏
  • 举报
回复
现在看来,.NET并没有提供SYBASE的驱动,也许在正式版中能有.
zag 2001-11-07
  • 打赏
  • 举报
回复
我应该去试试!
yuanreid 2001-11-04
  • 打赏
  • 举报
回复
我也是,在VSudio的服务器资源中可以建立和Sybase的连接,但是在DateConnnection控件中可以连接上,但就是怎么也不让我用,说“错误的属性”kao
Alwin_Lee 2001-11-02
  • 打赏
  • 举报
回复
to westaf:
没有啊!要有的话早做出来了。
westaf 2001-11-01
  • 打赏
  • 举报
回复
sybase有oledb provider吗?有的话就可以做到,方法和Oracle的一样,用oledbclient,只是connection string有差别而已。
Alwin_Lee 2001-11-01
  • 打赏
  • 举报
回复
to antmen:
你,你,你......
怎么解决呀?
antmen 2001-11-01
  • 打赏
  • 举报
回复
关注!
antmen 2001-11-01
  • 打赏
  • 举报
回复
我关注!
Alwin_Lee 2001-10-31
  • 打赏
  • 举报
回复
没人知道吗?
Sniper 2001-10-31
  • 打赏
  • 举报
回复
关注

2,596

社区成员

发帖
与我相关
我的任务
社区描述
Sybase相关技术讨论区
社区管理员
  • Sybase社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧