Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9177353
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:18:25+00:00 2026-06-17T17:18:25+00:00

I wrote a .Net Windows service to copy data from a 4D database (v12)

  • 0

I wrote a .Net Windows service to copy data from a 4D database (v12) to a SQL Server database every 4 hours. It is running on Windows 7 32-bit and running as Local System. I am using version 12.02 of the 4D ODBC driver.

When the service 1st runs everything works OK. On its second run the connection to SQL Server still works, but the ODBC connection to 4D gets the following error:

System.Data.Odbc.OdbcException (0x80131937): ERROR [08001] Client
unable to establish connection: Is the SQL Se at
System.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle,
RetCode retcode) at
System.Data.Odbc.OdbcConnectionHandle..ctor(OdbcConnection connection,
OdbcConnectionString constr, OdbcEnvironmentHandle environmentHandle)
at System.Data.Odbc.OdbcConnectionOpen..ctor(OdbcConnection
outerConnection, OdbcConnectionString connectionOptions) at
System.Data.Odbc.OdbcConnectionFactory.CreateConnection(DbConnectionOptions
options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo,
DbConnectionPool pool, DbConnection owningObject) at
System.Data.ProviderBase.DbConnectionFactory.CreateConnection(DbConnectionOptions
options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo,
DbConnectionPool pool, DbConnection owningConnection,
DbConnectionOptions userOptions) at
System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection
owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions
userOptions) at
System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection
owningConnection, TaskCompletionSource1 retry, DbConnectionOptions
userOptions, DbConnectionInternal& connection) at
System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection
outerConnection, DbConnectionFactory connectionFactory,
TaskCompletionSource
1 retry, DbConnectionOptions userOptions) at
System.Data.ProviderBase.DbConnectionInternal.OpenConnection(DbConnection
outerConnection, DbConnectionFactory connectionFactory) at
System.Data.Odbc.OdbcConnection.Open() at
DataWarehouseLoader.DAL.DWGenerator.Run() at
DataWarehouseSvc.DataWarehouseSvc.OnTimerElapsed(Object sender,
ElapsedEventArgs e)

The code is careful to dispose of the connection to both SQL Server and 4D after each run in the following way:

using (_connSQL = new SqlConnection(DataWarehouseCS))
{
   _connSQL.Open();

   using (_conn4D = new OdbcConnection(4DCS))
   {
      _conn4D.Open();
      Load4DTables();
   }   
}

Once the error occurs the ODBC connection never works again until I stop/start the service. This will allow it to work again one time. I have tried connecting with a System DSN as well as a DSN-less connection, but the results are the same. I believe if I have the service run more frequently, say once every 10 minutes, it will work more than once, but something must happen when enough time goes by that stops it from working.

I’m very confused about what the problem is. I’d greatly appreciate any help or suggestions to try.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T17:18:26+00:00Added an answer on June 17, 2026 at 5:18 pm

    I’ve not been able to find what’s wrong. I believe this is a bug in the 4D ODBC driver. My work around is to create a separate console app to handle the 4D part.

    I can launch this console app as a new process from the service when needed. This way when it finishes the console app that was connected to 4D unloads from memory but the service can remain running.

    Unloading the program from memory seems to clean up whatever the connection problem is w/ 4D and allows subsequent runs to still work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wrote a .NET 4.0 web service that sends back data from an applications
I wrote a windows service using VB that read some legacy data from Visual
I wrote a C# server application (windows service) that serves data through REST with
I've got a WCF service running on a Windows 2003 Server, which I wrote
One of my coworkers wrote a .NET windows service that converts .doc to .docx
I have a VB.NET Windows Service that I wrote and it works fine. In
I have a asp.net webservice running in windows server 2003, i want it read/write
I have a multithreaded .NET Windows Service that hangs intermittently -- maybe once every
I'm trying to write a small Windows Service in .NET 3.5, that check every
We have a current WinForm/Windows Service running in .NET 1.1 out on various customer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.