New topic: 

Problem to read with 2 mac from a RealSQLdatabase

<http://forums.realsoftware.com/viewtopic.php?t=45582>

         Page 1 of 1
   [ 4 posts ]                 Previous topic | Next topic          Author  
Message        ChrisBlanc          Post subject: Problem to read with 2 mac 
from a RealSQLdatabasePosted: Thu Oct 11, 2012 11:08 am                         
Joined: Wed Aug 10, 2011 2:41 pm
Posts: 25                Hi,

I wrote a small app using a RealSQLdatabase. It is working fine when only one 
computer connect to the database. But it's not possible to read from more than 
one computer on the database.
Here is my code :
rs=db.SQLSelect("select * from ARTICLES")
if rs = NIL then
  MsgBox("rs=0")
  return
else
  Do Until rs.EOF
  LBListing.AddRow rs.IdxField(1).StringValue //display first column
  
  For i as Integer = 2 to rs.FieldCount
  LBListing.Cell(LBListing.LastIndex, i - 1) = rs.IdxField(i).StringValue
  
  Next
  rs.MoveNext
  Loop
end


I get "rs=0" every time someone is already using the database

Thanks

Chris   
                             Top                DaveS          Post subject: 
Re: Problem to read with 2 mac from a RealSQLdatabasePosted: Thu Oct 11, 2012 
11:10 am                                 
Joined: Sun Aug 05, 2007 10:46 am
Posts: 4174
Location: San Diego, CA                SQLlist (ie. RSDatabase) is a single 
user database.

Add some error checking to your code, and it will probably indicate the table 
is LOCKED by another operation      
_________________
Dave Sisemore
MacPro, OSX Lion 10.7.4 RB2012r1
Note : I am not  interested in any solutions that involve custom Plug-ins of 
any kind  
                             Top                ChrisBlanc          Post 
subject: Re: Problem to read with 2 mac from a RealSQLdatabasePosted: Thu Oct 
11, 2012 3:36 pm                         
Joined: Wed Aug 10, 2011 2:41 pm
Posts: 25                You are right, I get "database is locked"
But all I do is in the code on my first post to load datas and when I close my 
app I register them again in the database.
What do you think can lock the data base?
Did I forget some code to avoid locking the database?

Thanks   
                             Top                DaveS          Post subject: 
Re: Problem to read with 2 mac from a RealSQLdatabasePosted: Thu Oct 11, 2012 
3:41 pm                                 
Joined: Sun Aug 05, 2007 10:46 am
Posts: 4174
Location: San Diego, CA                The computer that opens the database 
first..locks it.
until you close the database connection.....


So attempt to open..... loop until error goes away...... get the data you 
want..... .release the database.      
_________________
Dave Sisemore
MacPro, OSX Lion 10.7.4 RB2012r1
Note : I am not  interested in any solutions that involve custom Plug-ins of 
any kind  
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 4 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to