PocketPC + WLAN => ErrorCode 08006

PocketPC + WLAN => ErrorCode 08006

Postby NDS » Thu 06 Oct 2005 18:04

Hi,

i have a big Problem with Reconnecting my PPC after WLAN Module was shut down and then reactivated.

I used the Method Dispose() on my PgSqlConnection Object and created a new one after i detected an Connection Error when i reactivated my WLAN Module on my PPC.

So, every time when WLAN was reactivated, a new Connection Object was created and OPENED. The State Property is shown "OPEN".

Now when i try to query my Database over WLAN, i get an Error Message that (its German, i try to translate): "Unable to write into the Transfer Connection", the ErrorCode was 08006. I really dont know whats happening, i already told that i create a totally new Connection Object and use the Open() Method to open that new Connection, SUCCESFULLY.

But this Error Message still appears. I hope CoreLab can tell me what ErrorCode 08006 really means.

Just imagine: Connection is open, then WLAN is shut down, then reactive, then new Connection Object created, opened and then tried to query, after these steps, ErrorMessage 08006 appears.

So whats wrong?

Best Regards and Thank You for this Great Product :D
NDS
 

Postby SecureGen » Fri 07 Oct 2005 08:54

You should turn off connection pooling in the connection string or call connection.ClearAllPools() before Open new connection.
Turn off connection pooling approach is preferable. You can do it by adding "pooling=false" to the connection string.
SecureGen
Devart Team
 
Posts: 133
Joined: Thu 08 Sep 2005 06:27

Best solution

Postby NDS » Tue 25 Oct 2005 13:56

Hi,
It has worked, Thanks :D

I have this code :

while(conn.connectionstate != open)
{
conn.open();
Thread.sleep(50);
}

But the connection state doesn't updated. it always show open.
what is the best way to check it ?

I have tried to do it like this :
try
{
PgsqlDataAdapter da = new PgSqlDataAdapter("select * from x",conn);
da.fill(ds);
cond = true;
}
catch
{
cond = false;
}

while(!cond)
{
conn.open();
Thread.sleep(50);
try
{
PgsqlDataAdapter da = new PgSqlDataAdapter("select * from x",conn);
da.fill(ds);
cond = true;
}
catch
{
cond = false;
}
}

But it doesn't make sense to write such a code right ;)
NDS
 

Postby SecureGen » Wed 26 Oct 2005 11:41

If you will set "pooling=false" in Connection string property connection state will change on open:
PgSqlConnection conn = new PgSqlConnection(";pooling = false");
conn.Open();
in such case you do not need additional checks on connection.
If you need some code to ping the existing opened connection you can use something like this:
bool Ping(PgSqlConnection conn) {
PgSqlCommand cmd = new PgSqlCommand("select 1", conn);
try {
cmd.ExecuteNonQuery();
return true;
}
catch{
return false;
}
}
SecureGen
Devart Team
 
Posts: 133
Joined: Thu 08 Sep 2005 06:27


Return to dotConnect for PostgreSQL