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();
No connection postgresql database machine actively refused:(
-
- Posts: 5
- Joined: Fri 30 Oct 2009 14:53
-
- Posts: 5
- Joined: Fri 30 Oct 2009 14:53
This Error
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
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
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.
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.
-
- Posts: 5
- Joined: Fri 30 Oct 2009 14:53
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
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
-
- Posts: 5
- Joined: Fri 30 Oct 2009 14:53
-
- Posts: 5
- Joined: Fri 30 Oct 2009 14:53