I am using SQL Anywhere 10. I have two applications, one of them is a service which gets accessed by other applications, a second one is a normal program. When launched, either will try to start a database engine with the same options (same name, same database name, using shared memory). My problem is that either application blocks the other from accessing the database. Whichever application i launch first will work well, but the second will try to start a second instance of the engine and crash. If i launch the service application normally (from the console), then i can use both applications concurrently. Of course, it is desirable that the service does actually run as a service in Windows. So the question is, is there a way to start the service so that it does not block my other application.

asked 07 Dec '11, 12:35

Sergio's gravatar image

Sergio
460151820
accept rate: 0%

edited 14 Aug '12, 08:45

Volker%20Barth's gravatar image

Volker Barth
30.8k308456665


You could create a SQL Anywhere service (using the dbsvc utility or Sybase Central) that starts automatically, and then create your service so that it depends on the SA service. The second service won't start until the server is up and running, and any other applications that run after that can connect to the service as well. Not only does this eliminate the race conditions with multiple applications trying to spawn servers, but it makes connection time much faster since a connection attempt doesn't need to spawn the server first.

permanent link

answered 07 Dec '11, 12:59

Graeme%20Perrow's gravatar image

Graeme Perrow
8.5k371109
accept rate: 52%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×114

question asked: 07 Dec '11, 12:35

question was seen: 606 times

last updated: 14 Aug '12, 08:45