[Mono-list] on connecting to Sybase

wzfg wzfg@singtel.com.sg
Fri, 17 Jan 2003 11:08:53 +0800


Hi,
After I changed port=5510 in Mono.Data.TdsClient.TdsConnection.cs and
Mono.Data.SybaseClient.SybaseConnection.cs,
and changed mcs\nant\makefile as following:
>>>>>>>
all: nant.exe
linux: nant.exe
 -cp src/NAnt.exe nant.exe
windows: nant.exe

nant.exe: NAnt.exe

NAnt.exe: makefile src/*.cs src/Attributes/*.cs src/Tasks/*.cs src/Util/*.cs
 cd src
 csc /out:NAnt.exe /recurse:*.cs
 cd ../

NAnt_mono.exe: makefile
 csc /out:NAnt_mono.exe /nostdlib /noconfig /recurse:*.cs /lib:../class/lib
/r:corlib.dll /r:System.Xml.dll /r:System.dll /nowarn:1595

clean:
 rm -f NAnt_mono.exe
<<<<<<
then it works.
Thanks a lot.

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


> I'll try now.
> Thanks a lot.
>
> ----- Original Message -----
> From: "Daniel Morgan" <danmorg@sc.rr.com>
> To: "wzfg" <wzfg@singtel.com.sg>; "Rodrigo Moya" <rodrigo@ximian.com>
> Cc: <mono-list@ximian.com>
> Sent: Friday, January 17, 2003 8:43 AM
> Subject: RE: [Mono-list] on connecting to Sybase
>
>
> Did you try setting the port to be different?
>
> You were orginally trying to set the port to 5510, but the SybaseClient
> provider defaults to 1533.  Either set it to listen to 1533 on the server,
> or modify the SybaseClient source code to set the port to 5510.
>
> This is the nice thing about open source software; you don't have to wait
> and depend on a vendor to come out with the next release (if they do fix
> your problem in the next release).
>
> -----Original Message-----
> From: wzfg [mailto:wzfg@singtel.com.sg]
> Sent: Thursday, January 16, 2003 7:37 PM
> To: Daniel Morgan; Rodrigo Moya
> Cc: mono-list@ximian.com
> Subject: Re: [Mono-list] on connecting to Sybase
>
>
> After I changed to:
>
> string constr =
>     "server=10.34.7.41;"
>     +"user id=rbsdbo;"
>     +"password=rbsdbo;"
>     +"database=ccb;";
>
> Then I got different exception  as following:
>
> D:\exdir\mono>monooledb
>
> Unhandled Exception: System.Net.Sockets.SocketException: No connection
could
> be
> 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,
> Int32
> packetSize, Int32 timeout, TdsVersion tdsVersion)
>    at Mono.Data.Tds.Protocol.Tds..ctor(String dataSource, Int32 port,
Int32
> pack
> etSize, Int32 timeout, TdsVersion tdsVersion)
>    at Mono.Data.Tds.Protocol.Tds50..ctor(String server, Int32 port, Int32
> packet
> 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 =
>     "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
>