Page 1 of 1

No connection postgresql database machine actively refused:(

Posted: Fri 30 Oct 2009 15:00
by gurbuz_ksk
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();

This Error

Posted: Fri 30 Oct 2009 15:04
by gurbuz_ksk
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

Posted: Fri 30 Oct 2009 15:53
by Shalex
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.

Posted: Fri 30 Oct 2009 16:00
by gurbuz_ksk
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

Posted: Fri 30 Oct 2009 17:42
by Shalex
Have you made a synchronization of your mobile device and a desktop machine (see my post above)?

Posted: Sat 31 Oct 2009 07:19
by gurbuz_ksk
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...

Posted: Sat 31 Oct 2009 10:18
by gurbuz_ksk
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...