[Mono-list] on connecting to Sybase
Daniel Morgan
danmorg@sc.rr.com
Thu, 16 Jan 2003 19:43:21 -0500
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