I'm using mono framework on *Windows*.
I'd created simple console program (targeting .NET 4) to test connection :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Npgsql;
using System.Data.SqlClient;

namespace postgretest {
        class Program {
                static void Main(string[] args)
                {
                        string connString = 
"Server=127.0.0.1;Database=unitydb;User
Id=admin;Password=admin;";
                        NpgsqlConnection conn = new 
NpgsqlConnection(connString);
                        conn.Open();
                        if (conn.State == System.Data.ConnectionState.Open)
                                Console.WriteLine("Success open postgreSQL 
connection.");

                        conn.Close();

                        Console.WriteLine("end program.");
                        Console.ReadLine();
                }
        }
}

The program run fine on Mono version 2.8 build 9. But, it throw exception on
Mono version 2.10.2 build 5.

This is the exception message :

Unhandled Exception: Npgsql.NpgsqlException:
Failed to establish a connection to '127.0.0.1'.
  at Npgsql.NpgsqlClosedState.Open (Npgsql.NpgsqlConnector context)
[0x00000] in <filename unknown>:0
  at Npgsql.NpgsqlConnector.Open () [0x00000] in <filename unknown>:0
  at Npgsql.NpgsqlConnectorPool.GetPooledConnector (Npgsql.NpgsqlConnection
Connection) [0x00000] in <filename unknown>:0

Any idea what caused this and how to fix it ?


--
View this message in context: 
http://mono.1490590.n4.nabble.com/Problem-open-connection-npgsql-on-mono-2-10-Windows-tp3621423p3621423.html
Sent from the Mono - General mailing list archive at Nabble.com.
_______________________________________________
Mono-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to