views:

34

answers:

1

I am working on ASP.NET application. I try to connect to database in Adaptive Server Enterprise using Sybase.Data.AseClient dll. Connection string that I am using is 'Data Source='host';Port='5000';UID='user';PWD='password';Database='database';'. When Application tries to connect to database exception is thrown. 'Client can not establish connection'.

I tried connecting to database by trying to create ODBC Data Source. When I try to create DSN using ASE driver. DSN creation also fails.

What should I check ? Do I need to do some settings in database server? I am using all developer editions and my database and application are on the same machine.

I can connect to database Using Sybase Central. I can run queries on same database using Interactive SQL tool.

A: 

Check if the problem is not with you connection string. I have this in my config

<add name="Staging" connectionString="Data Source='ash-pc';Port='9100';UID='foo';PWD='bar';Database=db_name" providerName="System.Data.AseClient" />

Verify this with the sybase center browser's host and port number. Check UID and Password and spelling of your Database name.

Let me know if it still does not work . Also why dont you try loggin the error . To be it looks like you can see the message but have not seen the complete error. That might be useful For example I have named the database in my app.config to FOO. Now this DB does not exist. So the Exception is "Client Cannot establish Connection" but my full error is


ERROR 2010-08-31 16:07:32,321 500ms SybaseDBHelper ingStoredProcedure - Error Inserting Data into Database Sybase.Data.AseClient.AseException: Attempt to locate entry in sysdatabases for database 'foo' by name failed - no entry found under that name. Make sure that name is entered properly.

at Sybase.Data.AseClient.AseConnectionPool.GetConnection(AseConnection conn) at Sybase.Data.AseClient.AseConnectionPoolManager.GetConnection(String connectionString, AseConnection conn) at Sybase.Data.AseClient.AseConnection.Open() at LiabilitiesMI.Common.Database.SybaseDBHelper.InsertDataUsingStoredProcedure(String storedProcedureName, DatabaseEnum dbName, List`1 parameters) in C:\Documents and Settings\c001334\My Documents\Visual Studio 2008\Projects\text\Test.Common\Database\SybaseDBHelper.cs:line 73

Ashwani Roy
Thank you for the reply.I checked the sql.ini file.The services used host name that was alias for the host Eg. 'my-notebook'. I changed to it too 127.0.0.1. I also made the same change in my connection string now I can connect without any problem.
Cipher