No connection postgresql database machine actively refused:(

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
gurbuz_ksk
Posts: 5
Joined: Fri 30 Oct 2009 14:53

No connection postgresql database machine actively refused:(

Post by gurbuz_ksk » Fri 30 Oct 2009 15:00

Can not connect to the database, I do not know what's wrong

Waiting for your help friends ...

Error : No connection could be made because the target machine actively refused it

....
using CoreLab.PostgreSql;

PgSqlConnection oPgSqlConn = new PgSqlConnection();
oPgSqlConn.ConnectionString = "User ID=test_db;" +
"Password=12345;" +
"Host=127.0.0.1;" +
"Port=5432;" +
"Database=test";
oPgSqlConn.Open(); <------- Error line
oPgSqlConn.Close();

gurbuz_ksk
Posts: 5
Joined: Fri 30 Oct 2009 14:53

This Error

Post by gurbuz_ksk » Fri 30 Oct 2009 15:04

No connection could be made because the target machine actively refused it

Mobile Smart Device Application

Vs 2008
Pocket Pc 2003 Second Edition


pg_hba.conf

# TYPE DATABASE USER CIDR-ADDRESS METHOD

# IPv4 local connections:
host all all 127.0.0.1/32 md5

# IPv6 local connections:
host all all ::1/128 md5

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Fri 30 Oct 2009 15:53

If you set 'localhost' or '127.0.0.1' as a host, your application deployed to a mobile device will try to connect to itself (not to your desktop machine). So please set the IP address of your machine with the PostgreSQL database in the connection string.

Please note, some synchronization tool (e.g., Microsoft ActiveSync) should be used even if you work with some emulator (e.g., USA Windows mobile 5.0 Pocket PC R2 Emulator). Before deployment make cradle to the emulator you want to use via Device Emulator Manager (the Tools menu in Visual Studio). After cradle the ActiveSync icon in the tray should become green (indication that synchronization is successful).

If the problem persists, please tell us the version of your dotConnect for PostgreSQL Mobile. You can see the version in the Tools | PostgreSQL Mobile | About menu of Visual Studio.

gurbuz_ksk
Posts: 5
Joined: Fri 30 Oct 2009 14:53

Post by gurbuz_ksk » Fri 30 Oct 2009 16:00

firstly thank you for the answer,
When will connect to the remote database

PgSqlConnection oPgSqlConn = new PgSqlConnection();
oPgSqlConn.ConnectionString = "User ID=test_db;" +
"Password=12345;" +
"Host=192.168.1.11;" + <------- remote database ip
"Port=5432;" +
"Database=test";
oPgSqlConn.Open(); <----- This error
oPgSqlConn.Close();

this error : A socket operation was attempted to an unreachable host

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Fri 30 Oct 2009 17:42

Have you made a synchronization of your mobile device and a desktop machine (see my post above)?

gurbuz_ksk
Posts: 5
Joined: Fri 30 Oct 2009 14:53

Post by gurbuz_ksk » Sat 31 Oct 2009 07:19

only vs 2008 pocket pc 2003 second edition emulator( desktop machine ) and a remote desktop machine( Host=192.168.1.11 )

pocket pc 2003 second edition emulator connect to remote destop machine ( Host=192.168.1.11 )

Error : A socket operation was attempted to an unreachable host...

gurbuz_ksk
Posts: 5
Joined: Fri 30 Oct 2009 14:53

Post by gurbuz_ksk » Sat 31 Oct 2009 10:18

Thank you I've corrected the problem :)

This Solution : Widows Mobile device center download and Pocket Pc 2003 emulator Connection Setting Com1 and Visual Studio Tools Device Emulator Maganer ---> your Emulator Rigth Click Cradle.

Good Day...

Post Reply