I'm working on windows with a firebird database. It seems to work properly until it has a connection problem in other part of the app, not a connection problem with de database which is local DB.

the connection is made as follow:

db = QSqlDatabase::addDatabase( "QIBASE", kALIAS_GDB );
db.setHostName( getHostBD() );
db.setDatabaseName( fileBD );
db.setUserName( kUSER );
db.setPassword( kPWD );


in other part of the app, not related with the BD I create a socket to connect a server. When this connection fail I do a WSACleanup:

if( WSAStartup( MAKEWORD( 2, 2 ), &data ) != 0 )
{
WSACleanup();
return -1;
}
else
{
sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP );
if( sock == INVALID_SOCKET )
{
WSACleanup();
return -1;
}
}


When the socket fail I get an error in an operation against BD, for example with this:


QSqlQuery sql( db );
sql.prepare( "SELECT * FROM STOCK WHERE ID = :ID" );
sql.bindValue( ":ID", 1 );
sql.exec();


the error is:

Unable to complete network request to host "127.0.0.1". - Error writing data to the connection. - Either the application has not called WSAStartup, or WSAStartup failed. Could not start transaction

is the connection with the BD release after WSACleanup() ? is there a way to prevent it?

thanks in advance