New Posts New Posts RSS Feed: PersistenceServerException (occasional)
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

PersistenceServerException (occasional)

 Post Reply Post Reply
Author
yongbum75 View Drop Down
Newbie
Newbie


Joined: 21-Jul-2008
Posts: 17
Post Options Post Options   Quote yongbum75 Quote  Post ReplyReply Direct Link To This Post Topic: PersistenceServerException (occasional)
    Posted: 25-Aug-2011 at 3:43pm
Hi, we have a small .NET Windows app written a couple of years ago that uses DF Classic.  It pulls data from a remote SQL server in our branch office.  Occasionally I think there are blips and our interoffice VPN connections get lost.  Needless to say, when it happens the app looses connection to the remote SQL server and returns the following error.  Is there any way to check the connection state and programmatically reconnect like you can with the ADO.NET connection object?  I tried PM.IsConnected() and PM.Connect() but it doesn't seem to work the way I expect it to.  Any insight/help would be greatly appreciated!  Thanks.

IdeaBlade.Persistence.PersistenceServerException: [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied. ---> System.Data.OleDb.OleDbException: [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied.
  at IdeaBlade.Persistence.RemotingPersistenceServerProxy.CheckConnection(Exception pException)
  at IdeaBlade.Persistence.PersistenceServerProxy.Fetch(SessionBundle pBundle, IEntityQuery pQuery)
  at IdeaBlade.Persistence.PersistenceManager.XFetchDataSet(IEntityQuery pEntityQuery)
  --- End of inner exception stack trace ---
  at IdeaBlade.Persistence.PersistenceManager.HandlePersistenceServerException(Exception pException, Boolean pTryToHandle, PersistenceOperation pOperation)
  at IdeaBlade.Persistence.PersistenceManager.XFetchDataSet(IEntityQuery pEntityQuery)
  at IdeaBlade.Persistence.PersistenceManager.XFetch(IEntityFinder pEntityFinder, WorkState pWorkState)
  at IdeaBlade.Persistence.PersistenceManager.XFetch(IEntityQuery pEntityQuery, QueryStrategy pQueryStrategy, WorkState pWorkState)
  at IdeaBlade.Persistence.PersistenceManager.XGetEntities(IEntityQuery pEntityQuery, QueryStrategy pQueryStrategy, WorkState pWorkState)
  at IdeaBlade.Persistence.PersistenceManager.GetEntities[T](IEntityQuery pEntityQuery, QueryStrategy pQueryStrategy)
.....
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 25-Aug-2011 at 5:20pm
PM.Connect and PM.IsConnected are related to the PersistenceManager's connection to the PersistenceServer, so won't tell you anything about database connectivity.  If you're not using a BOS the PM is always considered "connected".
 
To check whether you can connect to the database you can use PM.CheckDataSourceKey(keyname), or if you already have the RdbKey, key.CheckConnection().  Both methods do the same thing, and will try to open a connection to the database.
 
DevForce creates a new connection for every query or save, so there's no way to "reconnect" per se.  If the datasource cannot be reached the above methods will return "false", but there's no automatic retry or reconnect logic. 
 
If you suspect the network connection has been lost, you can also use the NetworkChange and NetworkInterface classes in .NET to help monitor connectivity.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down