[Mono-list] on connecting to Sybase

Daniel Morgan danmorg@sc.rr.com
Thu, 16 Jan 2003 13:06:19 -0500


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 =
    "server=10.34.7.41;"
    +"user id=rbsdbo;"
    +"password=rbsdbo;"
    +"database=ccb;";

-----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=10.34.7.41:5510;Trusted_Connection=true;"
>         +"user id=rbsdbo;"
>         +"password=rbsdbo;"
>         +"database=ccb;"
>         +"Provider=ADO.NET Provider;"    //I don't know the provider's
name.
>         ;
>     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.

cheers
--
Rodrigo Moya <rodrigo@ximian.com>


_______________________________________________
Mono-list maillist  -  Mono-list@ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list