Firebird SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesFirebird SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 31st, 2004, 07:51 AM
Kodl Kodl is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 4 Kodl User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
FB embedded and multihreading

Is it possible to use FB embedded on Win32 platform in a multithreaded application? Currently our server that relies on FB embedded keeps crashing in the FBCLIENT.DLL if the calls are made from different threads simultaneously. Serializing the requests hurts performance noticeably especially if there are any active update operations that take long time. Hence my questions:
  • is it possible to call FB embedded engine from multiple threads at all?
  • if not, is it possible to at least perform simultaneous queries (read-only)?
  • and is there any way how to open a separate connection for SELECT and for UPDATE?
Thanks for any replies

Best regards

Karel Obluk

Reply With Quote
  #2  
Old June 1st, 2004, 01:41 AM
upscene upscene is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 223 upscene User rank is Corporal (100 - 500 Reputation Level)upscene User rank is Corporal (100 - 500 Reputation Level)upscene User rank is Corporal (100 - 500 Reputation Level)upscene User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 7 h 14 m 50 sec
Reputation Power: 8
Hi,

Firebird isn't thread safe if you let multiple threads use the same connection. With Fb Embedded, you can have only a single connection to a database, therefor: not threadsafe.

--
Martijn Tonies
Database Workbench: works with Firebird, MySQL, InterBase and MSSQL Server
Upscene Productions
http://www.upscene.com
__________________
Martijn Tonies
Database Workbench: developer IDE for Firebird, MySQL, InterBase, MSSQL Server and Oracle
Upscene Productions
http://www.upscene.com

Reply With Quote
  #3  
Old June 11th, 2004, 01:17 AM
Kodl Kodl is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 4 Kodl User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
OK, thanx for explanation.
Now, from your answer I assume that if using the standalone version, it should be possible to create multiple connections and use them from more than one thread. Is that so? Also, is it possible to pass the connection in between threads (i.e. re-using a connection)? In my app I have a huge number of short-live threads and I would like to use some kind of "connection pool". Is that possible?
Thank you very much for your help!
Karel

Reply With Quote
  #4  
Old June 11th, 2004, 01:49 AM
upscene upscene is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 223 upscene User rank is Corporal (100 - 500 Reputation Level)upscene User rank is Corporal (100 - 500 Reputation Level)upscene User rank is Corporal (100 - 500 Reputation Level)upscene User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 7 h 14 m 50 sec
Reputation Power: 8
Hi,

I'm unsure if you can have multiple connections with Embedded to the same database. Give it a try, I would say, but I don't think so.

Yes, you can pass connections between threads -- but only ONE thread should be using the connection at any time.

Anyway, threads are easier with the full server and a remote connection.


--
Martijn Tonies
Database Workbench: works with Firebird, MySQL, InterBase and MSSQL Server
Upscene Productions
http://www.upscene.com

Reply With Quote
  #5  
Old June 11th, 2004, 01:51 AM
Kodl Kodl is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 4 Kodl User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I understand that it is not possible to use multiple connections with the embedded version. What I was asking now was if multiple connections from multiple threads can be used with the standalone version (remote connection). If yes, this would solve my problem.
Thank you

Reply With Quote
  #6  
Old June 11th, 2004, 01:55 AM
upscene upscene is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 223 upscene User rank is Corporal (100 - 500 Reputation Level)upscene User rank is Corporal (100 - 500 Reputation Level)upscene User rank is Corporal (100 - 500 Reputation Level)upscene User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 7 h 14 m 50 sec
Reputation Power: 8
Hi,

As I said, that's possible. But only 1 thread should use 1 connection at any time.

And you have to use a "remote" connection (if it's on the same machine, use "localhost" as the server name).

--
Martijn Tonies
Database Workbench: works with Firebird, MySQL, InterBase and MSSQL Server
Upscene Productions
http://www.upscene.com

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesFirebird SQL Development > FB embedded and multihreading


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway