[Mono-list] MSSQL from Linux using Mono - Error

Carl Olsen carl at carl-olsen.com
Fri Jun 24 08:34:53 EDT 2005


It looks like a timeout.  I assume you MySQL is local and the MSSQL Server
is remote.  Do you have remote connections enabled for MSSQL?

-----Original Message-----
From: mono-list-bounces at lists.ximian.com
[mailto:mono-list-bounces at lists.ximian.com] On Behalf Of Daniel Waterbly
Sent: Friday, June 24, 2005 3:24 AM
To: mono-list at lists.ximian.com
Subject: [Mono-list] MSSQL from Linux using Mono - Error

Hello,

    I have been trying all day and night to connect to a MS SQL Server
database from my redhat linux box.  I can connect just fine to a MySQL
database, but it just won't fly with a MSSQL database.  Here is the code I
am using:

using System;
using System.Data;
using System.Data.SqlClient;

 public class sql
 {
    public static void Main(string[] args)
    {
                string connectionString = 
"server=<SERVER'SIP>;database=<DATABASE>;uid=<USER>;password=<PASSWORD>;";
                string commandString = "select * from SUBSCRIBERS";
                SqlDataAdapter dataAdapter = new
                SqlDataAdapter(commandString, connectionString);
                DataSet dataSet = new DataSet();
                dataAdapter.Fill(dataSet, "SUB");

                int i;

                for (i = 0; i < dataSet.Tables[0].Rows.Count; i++)
                {
                        System.Console.WriteLine("ROW: " +
                            dataSet.Tables[0].Rows[i]["house_number"] + " " 
+
                            dataSet.Tables[0].Rows[i]["street"]);
                }
    }
}

Everything compiles fine and it runs just grand from my Windows XP box, but
when I try mono sql.exe I get this:

Unhandled Exception: System.Net.Sockets.SocketException: Invalid arguments
in <0x00208> System.Net.Sockets.Socket:Connect (System.Net.EndPoint
remote_end)
in <0x0014c> Mono.Data.Tds.Protocol.TdsComm:.ctor (System.String dataSource,
Int32 port, Int32 packetSize, Int32 timeout, TdsVersion tdsVersion)
in <0x000f0> Mono.Data.Tds.Protocol.Tds:.ctor (System.String dataSource,
Int32 port, Int32 packetSize, Int32 timeout, TdsVersion tdsVersion)
in <0x00018> Mono.Data.Tds.Protocol.Tds70:.ctor (System.String server, Int32
port, Int32 packetSize, Int32 timeout)
in (wrapper remoting-invoke-with-check) Mono.Data.Tds.Protocol.Tds70:.ctor
(string,int,int,int)
in <0x000ae>
Mono.Data.Tds.Protocol.TdsConnectionPoolManager:CreateConnection
(Mono.Data.Tds.Protocol.TdsConnectionInfo info)
in <0x0001d> Mono.Data.Tds.Protocol.TdsConnectionPool:CreateConnection ()
in <0x0020c> Mono.Data.Tds.Protocol.TdsConnectionPool:GetConnection ()
in <0x00200> System.Data.SqlClient.SqlConnection:Open ()
in <0x0007b> System.Data.Common.DbDataAdapter:Fill (System.Data.DataSet
dataSet, Int32 startRecord, Int32 maxRecords, System.String srcTable,
IDbCommand command, CommandBehavior behavior)
in <0x00036> System.Data.Common.DbDataAdapter:Fill (System.Data.DataSet
dataSet, System.String srcTable)
in (wrapper remoting-invoke-with-check)
System.Data.Common.DbDataAdapter:Fill (System.Data.DataSet,string)
in <0x00080> sql:Main (System.String[] args)

Can you please help me out here? It's driving me nutty!

Thanks,
Dan Waterbly 
_______________________________________________
Mono-list maillist  -  Mono-list at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list





More information about the Mono-list mailing list