I am having SYBASE 12.5 install on my server as well as my PC, I am unable to get the correct connection string.
I have used the connectionstrings.com but unable to get the correct one.
After runnig and making the connection
Driver={Sybase ASE ODBC Driver};srvr=server_name;database=database_name;UID=user_name;PWD=pass;
and some other combination of thic connection string
I am getting the Dat开发者_高级运维asource ="" Driver ="" DataBase="" ServerVersion = Invalid Operation. Connection is closed
What am I suppose to correct in that.
Please help.
Thanks
I've not worked with Sybase, but I think this page at connectionstring.com can surely help you.
I do not see a port declared in your connection string so I wonder if that is the problem. Regardless, a trick you might try if you are using Windows is:
- Create a text file on your desktop (e.g. Foo.txt)
- Rename the file with a
udl
extension (e.g. Foo.udl). - Double-click the file. This should open the ODBC properties page (aka Data Link Properties) where you can build your connection string and test the connection. Since the file is still at its heart a text file, you can then open the file in a text editor and it will provide the connection string for you.
I realize this is an old question. Maybe this will help someone else trying to solve their Sybase issues.
That said, when building a .Net app, generally you should use the native .Net objects for database access, if available. Sybase does have them available, although they appear to be somewhat difficult to come by. If your organization is using a Sybase database, someone should have access to download the appropriate tools for you from the SAP/Sybase portal. Note this referenced link is the "developer" edition, which may not be suitable for your requirements.
When using a Sybase.Data.AseClient.AseConnection, your connection string might look like this:
Server=MyServer; Port=MyPort; Database=MyDatabase; User ID=MyUserID; Password=MyPassword
Note that you may also need to explicitly set the charset and codepage in your connection string as well:
Charset=ClientDefault;CodePageType=other;clientCharset=iso_1;
See here for details on the charset/codepage.
The above connection string works for me. I had to add the charset part to get it to work outside of my development machine.
Also note the .Net4 object may have memory leak issues. A simple a SQL statement regularly triggered a "Attempted to read or write protected memory" exception for me. Once I switched to the .Net2 object, that error went away. See here.
Unfortunately the overall quality of Sybase drivers appears to be low. I was able to get the ODBC version working on a prior version of the drivers (15.03 I believe), however the .Net2 connection object would always throw what appeared to be a DLL error on instantiation. Now I'm using 15.70, and I have the above memory leak issue with the .Net4 object, but at the moment the .Net2 object is working fine.
精彩评论