MySQL standalone issues
sl at trackandfieldnews.com
Tue Mar 20 19:32:24 EDT 2012
I investigated further. I found something strange. I copied the simple script below from lessons.runrev.com and put it in a button on a brand new stack. Saved as a standalone and it worked as designed.
Next I copied the button containing the working script to my existing app and saved that as a standalone. This time it didn't open the database. Instead it returned the answer error "Unable to connect to the database. revdberr, invalid database type."
What could possibly cause the same button to work in a brand new stack but not work in an old one once it's saved as a standalone? Any suggestions for what to do short of recreating a stack that has many buttons and fields?
Here is the script in the button in question.
-- use a global variable to hold the connection ID so other scripts can use it
-- set up the connection parameters - edit these to suit your database
put "fake.com" into tDatabaseAddress
put "fake_stats" into tDatabaseName
put "fake_username" into tDatabaseUser
put "fakepassword" into tDatabasePassword
-- connect to the database
put revOpenDatabase("MySQL", tDatabaseAddress, tDatabaseName, tDatabaseUser, tDatabasePassword) into tResult
-- check if it worked and display an error message if it didn't
-- & set the connection ID global
if tResult is a number then
put tResult into gConnectionID
answer info "Connected to the database." & cr & "Connection ID = " & gConnectionID
put empty into gConnectionID
answer error "Unable to connect to the database:" & cr & tResult
On Mar 20, 2012, at 1:20 PM, Pete wrote:
> Hi Sieg,
> I don't know of such an article but people on this list can probably help
> if you give use a bit more detail about what the queries are and what error
> messages you are getting.
> There shouldn't be any SQL reasons for things not working in a standalone
> if they worked in the IDE so I suspect it's some LC related issue. The
> favorite candidate for things like this is usually relying on data being
> saved somewhere in the standalone, which can't be done.
> On Tue, Mar 20, 2012 at 12:00 PM, Sieg Lindstrom
> <sl at trackandfieldnews.com>wrote:
>> Can anyone point me to an article or tutorial that walks thru all the
>> considerations for making MySQL database functionality work in a standalone?
>> I have created several apps that query a MySQL database. They work fine in
>> the IDE but I have never been able to get them to run as standalones, from
>> which they return a variety of error messages depending on the specific
>> query involved.
>> Thanks in advance,
>> Sieg Lindstrom
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
> Molly's Revenge <http://www.mollysrevenge.com>
More information about the Use-livecode