[Mono-list] on connecting to Sybase

wzfg wzfg@singtel.com.sg
Fri, 17 Jan 2003 08:37:00 +0800

After I changed to:

string constr =
    +"user id=rbsdbo;"

Then I got different exception  as following:


Unhandled Exception: System.Net.Sockets.SocketException: No connection could
made because the target machine actively refused it
   at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)
   at Mono.Data.Tds.Protocol.TdsComm..ctor(String dataSource, Int32 port,
packetSize, Int32 timeout, TdsVersion tdsVersion)
   at Mono.Data.Tds.Protocol.Tds..ctor(String dataSource, Int32 port, Int32
etSize, Int32 timeout, TdsVersion tdsVersion)
   at Mono.Data.Tds.Protocol.Tds50..ctor(String server, Int32 port, Int32
Size, Int32 timeout)
   at Mono.Data.SybaseClient.SybaseConnectionPool.AllocateConnection()
   at Mono.Data.SybaseClient.SybaseConnection.Open()
   at Sample.Main()

So I think I should wait the new release.
Thanks a lot.

----- Original Message -----
From: "Daniel Morgan" <danmorg@sc.rr.com>
To: "Rodrigo Moya" <rodrigo@ximian.com>; "wzfg" <wzfg@singtel.com.sg>
Cc: <mono-list@ximian.com>
Sent: Friday, January 17, 2003 2:06 AM
Subject: RE: [Mono-list] on connecting to Sybase

None of Mono's data providers has ability for trusted_connections.
So, the connection string is wrong.  The port defaults to 1533.  I couldn't
find a way to set the port.

Maybe, you can set up your Sybase server to listen on 1533.  Or, you could
modify Mono.Data.SybaseClient source file SybaseConnection.cs to set the
port.  I'm sure Tim will take patches.

Anyways, try this connection string:

string constr =
    +"user id=rbsdbo;"

-----Original Message-----
From: mono-list-admin@ximian.com [mailto:mono-list-admin@ximian.com]On
Behalf Of Rodrigo Moya
Sent: Thursday, January 16, 2003 9:25 AM
To: wzfg
Cc: mono-list@ximian.com
Subject: Re: [Mono-list] on connecting to Sybase

On Thu, 2003-01-16 at 08:53, wzfg wrote:
> Hi, Rodrigo Moya,
> I am sorry for bothering you again.
> I still can not connect the Sybase and hope your help.
> The scoure codes is as following:
> using System;
> using System.Data;
> using Mono.Data.SybaseClient;
> class Sample
> {
>   public static void Main()
>   {
>    string constr =
>         "server=;Trusted_Connection=true;"
>         +"user id=rbsdbo;"
>         +"password=rbsdbo;"
>         +"database=ccb;"
>         +"Provider=ADO.NET Provider;"    //I don't know the provider's
>         ;
>     SybaseConnection myConn = new SybaseConnection(constr);
>  SybaseCommand catCMD = new SybaseCommand("SELECT err_code,err_msg FROM
> my_errmsg ", myConn);
>     myConn.Open();
>  SybaseDataReader myReader = catCMD.ExecuteReader();
>  try{
>       while(myReader.Read()){
>          Console.WriteLine("\t{0}\t{1}", myReader.GetInt32(0),
> myReader.GetString(1));
>       }
>  }finally{
>       myReader.Close();
>       myConn.Close();
>      }
>   }
> }
> Then I compile as following(No errors, just have 1 warnings):
> C:\exdir\mono>mcs -lib:C:\mono-0.17\install\lib -debug+  -r:System.dll -r
> :System.Data.dll -r:Mono.Data.SybaseClient.dll -out:monooledb.exe
> monooledb.cs
> You can run mcs with 'monomcs' on .NET, instead of mono, too.
> ´╗┐Internal() warning CS-0018: Cannot find any symbol writer
> Compilation succeeded - 1 warning(s)
> Then run:
> C:\exdir\mono>monooledb
> Unhandled Exception: System.Net.Sockets.SocketException: No such host is
> known
>    at System.Net.Dns.GetHostByName(String hostName)
just guessing, but could it be that it is using the port number as part
of the hostname, and that's why it can't connect? I'm not sure if the
connection string is ok or not for the Sybase provider, so maybe Tim can
tell you if it's so or not.

Rodrigo Moya <rodrigo@ximian.com>

Mono-list maillist  -  Mono-list@ximian.com