Hello Devart and users,
I use dotConnect Mobile in a VB.Net Project, running on WindowsMobile 6.5.3, with a connection to a PostgreSQL 8.3.8 database running on Win2003 Server.
I use a simple code for connection:
Public myConnstring As String = "host=192.168.178.66;User Id=admin;Password=123;Database=mydb;Port=5432;"
Public WithEvents myPgSqlConnection As Devart.Data.PostgreSql.PgSqlConnection
myPgSqlConnection = New Devart.Data.PostgreSql.PgSqlConnection
myPgSqlConnection.ConnectionString = myConnstring
myPgSqlConnection.ConnectionTimeout = 200
myPgSqlConnection.Open()
Everything works fine, if my Mobile-Device is directly connected to the Server over USB.
If I connect the Mobile-Device over WLAN I get the exception:
Devart.Data.PostgreSQL.PGSqlException: the requested address is not valid in its context
The WLAN-Connection works, I can ping the Server, connect to the internet and so on.
My Device has a IP-V4-Adress containing to the same Network.
Thanks a lot for your help!
requested address is not valid in its context
-
- Posts: 4
- Joined: Thu 21 Sep 2017 14:50
-
- Posts: 4
- Joined: Thu 21 Sep 2017 14:50
Re: requested address is not valid in its context
I now tested my connection with the sample-projects from Devart.
Maybee it's helpful that I get the following Exception with the DataTable-Sample:
PgSqlException: unable to read data from the transport connection; an existing connection was forcibly closed by remote host
What to do?
Thanks a lot for your help!
Maybee it's helpful that I get the following Exception with the DataTable-Sample:
PgSqlException: unable to read data from the transport connection; an existing connection was forcibly closed by remote host
What to do?
Thanks a lot for your help!
-
- Devart Team
- Posts: 2420
- Joined: Wed 02 Nov 2011 09:44
Re: requested address is not valid in its context
Please make sure that your device is in the same local network as the server. Please also ping your device from the server to find the device IP as seen by the server. Then add the corresponding record to the pg_hba.conf file. For more information, please refer to https://www.postgresql.org/docs/8.3/sta ... -conf.htmldeveloper123 wrote:Devart.Data.PostgreSQL.PGSqlException: the requested address is not valid in its context
Please also describe how you ping the server from your device.
Do you run the sample from your device or from a computer via Device Emulator?developer123 wrote:I now tested my connection with the sample-projects from Devart.
Maybe your device connects to the computer not via the local network but via the Internet, and it doesn't know the 192.168.178.66 IP address. Look through the following thread, maybe you will find something useful in it:
https://social.msdn.microsoft.com/Forum ... ?forum=wcf
-
- Posts: 4
- Joined: Thu 21 Sep 2017 14:50
Re: requested address is not valid in its context
Thank you for the answer.
The device is in the same subnet as the server. The server can also ping the device.
pg_hba.conf is configured so that all devices from this subnet have full access to the database.
I run the Devart Ping-Sample from the device with Windows Mobile 6.5.3. It works fine.
The device is in the same subnet as the server, so it knows the IP and does not connect via Internet.
The device is in the same subnet as the server. The server can also ping the device.
pg_hba.conf is configured so that all devices from this subnet have full access to the database.
I run the Devart Ping-Sample from the device with Windows Mobile 6.5.3. It works fine.
The device is in the same subnet as the server, so it knows the IP and does not connect via Internet.
Re: requested address is not valid in its context
1. Please add "protocol=2;" to your connection string. If the text of the error is different in this case, specify it.
2. Confirm that you are using the newest (7.9.980) build of dotConnect for PostgreSQL Mobile.
3. If possible, restart both a mobile device and a workstation with PostgreSQL Server. Does this make any difference?
2. Confirm that you are using the newest (7.9.980) build of dotConnect for PostgreSQL Mobile.
3. If possible, restart both a mobile device and a workstation with PostgreSQL Server. Does this make any difference?
-
- Posts: 4
- Joined: Thu 21 Sep 2017 14:50
Re: requested address is not valid in its context
Thank you very much for your effort.
You were right, there was a fault in the pg_hba.conf because of the used subnet!
Many thanks to all!
You were right, there was a fault in the pg_hba.conf because of the used subnet!
Many thanks to all!