[Mono-list] on connecting to Sybase

Rodrigo Moya rodrigo@ximian.com
16 Jan 2003 15:24:47 +0100


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>