Re: ODBC access (closing connections)
Roger wrote: First of all, when I need database tips, I search the list for Sarah Reichelt because well... SHE'S AWESOME! I have been using the above 3 lines very successfully in Rev 3.0 for accessing a Microsoft SQL database via ODBC. I remember having to keep up with a connection id in the past, and closing the database when done. Is that still required when using the above method to retrieve a record? What happens if connections are left open? Sarah wrote: I always store the connection ID in a global or a custom property as I generally want to make one than one query after opening a database. Then when my app is closing, or I am finished with the database, I use that connection ID to close the database. Alternatively, you can just close all connections when the app is quitting, using something like this: put revOpenDatabases() into connectList repeat for each item c in connectList revCloseDatabase c end repeat I'm not sure what happens if you quit without closing any connections. The database library might close them automatically, or the server might have to time you out, but I think it is better to close the connections yourself when you no longer need them. Cheers, Sarah As usual, this was exactly what I was looking for. Thanks again Sarah! :-) Roger Eller roger.e.el...@sealedair.com ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: ODBC access (closing connections)
On Mon, Mar 23, 2009 at 9:43 PM, roger.e.el...@sealedair.com wrote: What happens if connections are left open? Sarah wrote: I always store the connection ID in a global or a custom property as I generally want to make one than one query after opening a database. All I can tell you is connections stay open for a while - I imagine there is a setting somewhere but the default in mySQL is long enough. I would suggest testing for open databases before EVERY use of revOpenDatabase Once, whilst developing a stack that carried out multiple queries on opening, my system slowed to a crawl.I eventually tracked it down to hundreds of open connections!! The reason, I kept typing openStack into the message box which ran a script that opened a DB connection, but my breakpoints and debugging never allowed the script to run to the point where the DB connection was closed! Now I always test first before using revOpenDatabase, even if I know there's no way there could be an open connection. HTH ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: ODBC access (closing connections)
I think I checked that once. I am almost certain that if you quit Revolution it closes the database connection for you. Easy way to tell would be to quit revolution and then start it up and use the previous database connection. But if you crash to desktop (or force quit) then of course the results will be unpredictable. Bob Sneidar IT Manager Logos Management Calvary Chapel CM On Mar 19, 2009, at 5:58 PM, Sarah Reichelt wrote: I'm not sure what happens if you quit without closing any connections. The database library might close them automatically, or the server might have to time you out, but I think it is better to close the connections yourself when you no longer need them. Cheers, Sarah ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
ODBC access (closing connections)
On Mon, 24 Mar 2008 01:53:27 -0700, Sarah Reichelt wrote: Check out the docs for the revDataFromQuery function which I think will do what you want in a lot less code. I think your script can be condensed to: put revOpenDatabase(ODBC,testdb,,,) into myDB put SELECT Item Id, Item Title from Item into tSQL revDataFromQuery(tab,return,myDB,tSQL) into fld Item List Cheers, Sarah Source: http://www.mail-archive.com/use-revolution@lists.runrev.com/msg104599.html First of all, when I need database tips, I search the list for Sarah Reichelt because well... SHE'S AWESOME! I have been using the above 3 lines very successfully in Rev 3.0 for accessing a Microsoft SQL database via ODBC. I remember having to keep up with a connection id in the past, and closing the database when done. Is that still required when using the above method to retrieve a record? What happens if connections are left open? Roger Eller roger.e.el...@sealedair.com ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: ODBC access (closing connections)
Roger.E.Eller wrote: First of all, when I need database tips, I search the list for Sarah Reichelt because well... SHE'S AWESOME! Indeed she is. For newcomers here who haven't yet joined the Sarah Fan Club, we posted an interview with her some time ago at revJournal.com where she discusses her work at Genesearch and shares a bit of her background: http://www.revjournal.com/interviews/rev-sarah-interview1.html -- Richard Gaskin Fourth World Revolution training and consulting: http://www.fourthworld.com Webzine for Rev developers: http://www.revjournal.com ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: ODBC access (closing connections)
Eventually the connection will time out and close. At least that is my experience with MySQL. I have had to write a function that checks to see if the database is open, traps for errors, opens it if it isn't open, and stores the database id in a global in any event. I call it every time I access the database (at least the first time in any script session). You never know how long a user is going to leave the app running idle. BTW for multi-user apps, I also keep a table with the name of every table in the database and a number field associated with it. Whenever I update a table I increment it's number. That way I can check if a table I need has been updated since the last time I queried it, and if so I requery the whole dataset. Bob Sneidar IT Manager Logos Management Calvary Chapel CM On Mar 19, 2009, at 6:41 AM, roger.e.el...@sealedair.com wrote: On Mon, 24 Mar 2008 01:53:27 -0700, Sarah Reichelt wrote: Check out the docs for the revDataFromQuery function which I think will do what you want in a lot less code. I think your script can be condensed to: put revOpenDatabase(ODBC,testdb,,,) into myDB put SELECT Item Id, Item Title from Item into tSQL revDataFromQuery(tab,return,myDB,tSQL) into fld Item List Cheers, Sarah Source: http://www.mail-archive.com/use-revolution@lists.runrev.com/msg104599.html First of all, when I need database tips, I search the list for Sarah Reichelt because well... SHE'S AWESOME! I have been using the above 3 lines very successfully in Rev 3.0 for accessing a Microsoft SQL database via ODBC. I remember having to keep up with a connection id in the past, and closing the database when done. Is that still required when using the above method to retrieve a record? What happens if connections are left open? Roger Eller roger.e.el...@sealedair.com ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: ODBC access (closing connections)
On Fri, Mar 20, 2009 at 1:14 AM, Richard Gaskin ambassa...@fourthworld.com wrote: Roger.E.Eller wrote: First of all, when I need database tips, I search the list for Sarah Reichelt because well... SHE'S AWESOME! Indeed she is. For newcomers here who haven't yet joined the Sarah Fan Club, we posted an interview with her some time ago at revJournal.com where she discusses her work at Genesearch and shares a bit of her background: http://www.revjournal.com/interviews/rev-sarah-interview1.html *** blush *** Thank you guys ;-D Cheers, Sarah ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: ODBC access (closing connections)
Check out the docs for the revDataFromQuery function which I think will do what you want in a lot less code. I think your script can be condensed to: put revOpenDatabase(ODBC,testdb,,,) into myDB put SELECT Item Id, Item Title from Item into tSQL revDataFromQuery(tab,return,myDB,tSQL) into fld Item List First of all, when I need database tips, I search the list for Sarah Reichelt because well... SHE'S AWESOME! I have been using the above 3 lines very successfully in Rev 3.0 for accessing a Microsoft SQL database via ODBC. I remember having to keep up with a connection id in the past, and closing the database when done. Is that still required when using the above method to retrieve a record? What happens if connections are left open? I always store the connection ID in a global or a custom property as I generally want to make one than one query after opening a database. Then when my app is closing, or I am finished with the database, I use that connection ID to close the database. Alternatively, you can just close all connections when the app is quitting, using something like this: put revOpenDatabases() into connectList repeat for each item c in connectList revCloseDatabase c end repeat I'm not sure what happens if you quit without closing any connections. The database library might close them automatically, or the server might have to time you out, but I think it is better to close the connections yourself when you no longer need them. Cheers, Sarah ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution