<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"><channel><category>pcsoft.us.windev</category><copyright>Copyright 2026, PC SOFT</copyright><lastBuildDate>6 Nov 2014 14:51:00 Z</lastBuildDate><pubDate>5 Nov 2014 14:25:00 Z</pubDate><description>Hi,&#13;
&#13;
I have a program (Windows Service) that runs 24/7 to sync/convert some data between 2 MS SQL 2008R2 servers. Program is running fine most of the time, but sometimes I get the error:&#13;
&#13;
Error:OLE DB access error.&#13;
Error Number = 170129&#13;
&#13;
Failure opening file.&#13;
&#13;
System Error Details:&#13;
Description = Connection failure&#13;
Source = Microsoft OLE DB Provider for SQL Server&#13;
SQL State = 08S01&#13;
Error Number = -2147467259 (0x80004005)&#13;
&#13;
I think it's triggerred by a network/Internet glitch (VPN connection to datacenter) or when there is a problem with the remote or local SQL. Sometimes the remote SQL is rebooted for updates etc... but wil always be back online after that.&#13;
&#13;
Most of the time once this error has occurred, the program does not recover by its self. When I am restarting my Windows service, everything works again without further actions. So it seems that the database connection somehow hangs ?&#13;
&#13;
In my code I use the following to make or reinit my connection. At every start of a new sync cycle this is (for the database) the first call "InitDBConnection".&#13;
&#13;
PROCEDURE InitDBConnection() Result1,Result2 are strings IF NOT ValidSettings THEN // gclLogger("Invalid settings, do nothing") RESULT "Invalid settings, do nothing" END WHEN EXCEPTION IN SQLDisconnect() HCloseConnection(gclSettings.DAServerConnection) gclSettings.DAServerConnection..Server = gclSettings.sDAServer gclSettings.DAServerConnection..User = gclSettings.sDAUser gclSettings.DAServerConnection..Password = gclSettings.sDAPw gclSettings.DAServerConnection..Database = gclSettings.sDADB gclSettings.DAServerConnection..Provider = hOledbSQLServer IF NOT HOpenConnection(gclSettings.DAServerConnection) THEN IF InServiceMode() THEN gclLogger.Add("Error connecting to DB: "+ ErrorInfo()) ELSE ErrorWithTimeout(1000,ErrorInfo()) END RESULT "Geen verbinding" ELSE HChangeConnection("*",gclSettings.DAServerConnection) Result1 = gclSettings.sDAUser + "@" + gclSettings.sDAServer + "/" + gclSettings.sDADB END HCloseConnection(gclSettings.NAVServerConnection) gclSettings.NAVServerConnection..Server = gclSettings.sNAVServer gclSettings.NAVServerConnection..User = gclSettings.sNAVUser gclSettings.NAVServerConnection..Password = gclSettings.sNAVPw gclSettings.NAVServerConnection..Database = gclSettings.sNAVDB gclSettings.NAVServerConnection..ExtendedInfo = "WD Connection Timeout=60; WD Command Timeout=60" // 60 seconds connection timeout, 60 seconds Command timeout, default this is 30 sec. gclSettings.NAVServerConnection..Provider = hOledbSQLServer IF NOT HOpenConnection(gclSettings.NAVServerConnection) THEN IF InServiceMode() THEN gclLogger.Add("Error connecting to DB: "+ ErrorInfo()) ELSE ErrorWithTimeout(1000,ErrorInfo()) END RESULT "Geen verbinding" ELSE HChangeConnection("*",gclSettings.NAVServerConnection) Result2 = gclSettings.sNAVUser + "@" + gclSettings.sNAVServer + "/" + "NAV" END DO gclLogger.Add("Exception connecting to DB: "+ ExceptionInfo()) IF NOT InServiceMode() THEN ErrorWithTimeout(1000,ExceptionInfo()) END RESULT "Geen verbinding" END RESULT Result1 + " | " + Result2&#13;
So before the synchronisation I (re)connect to the DB and after the sync I close the connection.&#13;
&#13;
The error occurres after the init on the first HExecuteSQLQuery that is run on the remote server.&#13;
&#13;
Is there something I can add or change to my code to be able to automatically recover from this error ?&#13;
This error occurres only once or twice each month, but there is no patern in when it fails. I do have some E-mail alerts to notify me of the problem, but this thing should be running 24/7 without this kind of error, it should auto recover from it !&#13;
&#13;
Thanks&#13;
Danny</description><ttl>30</ttl><generator>WEBDEV</generator><language>en_US</language><link>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/48782-wd19-connection-error/read.awp</link><title>[WD19] DB connection error ?</title><managingEditor>moderateur@pcsoft.fr (El moderador)</managingEditor><webMaster>webmaster@pcsoft.fr (El webmaster)</webMaster><item><author>guest</author><category>pcsoft.us.windev</category><comments>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/48782-wd19-connection-error-48818/read.awp</comments><pubDate>6 Nov 2014 14:51:00 Z</pubDate><description>Danny&#13;
&#13;
Whooze you're right I do have native from pcSoft but&#13;
can you download Sql Server Native Client 11.0 / 10.0 from m/s an…</description><guid isPermaLink="true">https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/48782-wd19-connection-error-48818/read.awp</guid><link>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/48782-wd19-connection-error-48818/read.awp</link><source url="https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/48782-wd19-connection-error/read.awp">[WD19] DB connection error ?</source><title>Re: [WD19] DB connection error ?</title></item><item><author>guest</author><category>pcsoft.us.windev</category><comments>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/48782-wd19-connection-error-48811/read.awp</comments><pubDate>6 Nov 2014 10:13:00 Z</pubDate><description>Paulo,&#13;
&#13;
If no other solutions are available I will indeed need to auto restart the service.&#13;
&#13;
Have you ever tried if the func…</description><guid isPermaLink="true">https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/48782-wd19-connection-error-48811/read.awp</guid><link>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/48782-wd19-connection-error-48811/read.awp</link><source url="https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/48782-wd19-connection-error/read.awp">[WD19] DB connection error ?</source><title>Re: [WD19] DB connection error ?</title></item><item><author>guest</author><category>pcsoft.us.windev</category><comments>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/48782-wd19-connection-error-48808/read.awp</comments><pubDate>6 Nov 2014 09:54:00 Z</pubDate><description>Hi King,&#13;
&#13;
You are using the optional MS SQL Native Access ? I don't have the native access, so I guess I cannot use the hNativ…</description><guid isPermaLink="true">https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/48782-wd19-connection-error-48808/read.awp</guid><link>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/48782-wd19-connection-error-48808/read.awp</link><source url="https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/48782-wd19-connection-error/read.awp">[WD19] DB connection error ?</source><title>Re: [WD19] DB connection error ?</title></item><item><author>guest</author><category>pcsoft.us.windev</category><comments>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/48782-wd19-connection-error-48804/read.awp</comments><pubDate>6 Nov 2014 04:57:00 Z</pubDate><description>Hi&#13;
&#13;
Why using SqlDisconnect() and HOpenConnection()?&#13;
I use codes as below with sqlNative Client in 2012&#13;
&#13;
sDS is Data Source…</description><guid isPermaLink="true">https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/48782-wd19-connection-error-48804/read.awp</guid><link>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/48782-wd19-connection-error-48804/read.awp</link><source url="https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/48782-wd19-connection-error/read.awp">[WD19] DB connection error ?</source><title>Re: [WD19] DB connection error ?</title></item><item><author>guest</author><category>pcsoft.us.windev</category><comments>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/48782-wd19-connection-error-48784/read.awp</comments><pubDate>5 Nov 2014 15:14:00 Z</pubDate><description>I have the same problem when there are erros in the connections, the only way i can recover is to restart the service.&#13;
&#13;
In my …</description><guid isPermaLink="true">https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/48782-wd19-connection-error-48784/read.awp</guid><link>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/48782-wd19-connection-error-48784/read.awp</link><source url="https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/48782-wd19-connection-error/read.awp">[WD19] DB connection error ?</source><title>Re: [WD19] DB connection error ?</title></item></channel></rss>
