DB fails in Standalone even with settings selected

Creating desktop or client-server database solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
xeir
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 35
Joined: Thu Jul 03, 2008 5:54 am

DB fails in Standalone even with settings selected

Post by xeir » Mon Aug 18, 2008 11:17 pm

I seem to be having a build issue. The standalone does not connect to the mysql db when compiled even though it does in the Dev environment.

Platform: OSX
Rev v 2.9.0b610

Under 'Standalone App Settings'
Database is selected under 'Script Libraries'.
Database Support box is checked and MySQL is selected.

I've tried various other combinations to no avail.

Connecting to port: 8889 (MAMP)
Not using the Query Builder whatsoever.

I've narrowed it down to the revOpenDatabase statement as the standalone will show the first message but never the second.

Code: Select all

answer "Connect to DB - Enter"
put revOpenDatabase("mysql","127.0.0.1:8889","dbname","dbuser","dbpass", false) into dbID
answer "Connect to DB - Exit"
I have another smaller app with just basic connectivity for testing, and I did have the same issue as with this app, however it resolved itself after compiling and changing settings enough times, i.e- randomly started working in standalone and has been ever since using the same connection info.

I've made sure the settings match in both apps, so I'm at a loss for now.

Any insight would be appreciated. Thanks ..

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Tue Aug 19, 2008 8:57 pm

Hi Xeir,

I know that this can happen. It has happened before. With a little bit of hacking around, you might find out that the error, which is not reported by Revolution, is a "revExternalLibrary" error. I believe, a handler could not be found in the script of stack revExternalLibrary. This error as such doesn't make any sense.

If i understand you correctly, the script works in the IDE but not in a standalone. You are te fifth or sixth person to report this problem to this forum or directly to me in slightly more than a year.

You might want to read this first. It won't help you much, but it tells you what has been discussed and tried already.

Have you tried downloading and using the legacy drivers?

If you can provide any information in addition to the other thread, I'll be happy to help searching for a solution.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

xeir
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 35
Joined: Thu Jul 03, 2008 5:54 am

Post by xeir » Wed Aug 20, 2008 4:13 am

Mark, I appreciate the info and I'll take a look at the other thread and see what I can add to the equation.

I haven't tried the legacy drivers as yet.

As mentioned, I have successfully compiled a smaller test db app, did that first so I understood how Rev handled before I dug too deep into the project I'm working on. I just rebuilt that test stack as I type to verify, and it still works.

So I wouldn't think that using the legacy drivers would make a difference, but I will try them just for grins.

I am also using the 3.0.0 tc1 beta and having same results in it.

Btw, just tried something else .. I've a menu as follows to open/close the db directly. it works fine in the dev environment as expected, but here's something else I noticed. It does not even display the 'answer' window when I select 'Close DB' in the standalone.

Menu code:

Code: Select all

on menuPick pWhich
  answer "Menu"
   switch pWhich
      case "Close DB"
         --Insert script for Close DB menu item here
         sqlCloseDB
      break
      case "Open DB"
         --Insert script for Open DB menu item here
         sqlConnectDB
      break
   end switch
end menuPick
Result:
Dev Environ:
- Pops up 'Menu' in a window
Standalone :
- Nothing occurs

If I choose 'Open DB' ..

Open DB code:

Code: Select all

on sqlConnectDB
   answer "Open DB"
   put revOpenDatabase("mysql","127.0.0.1:8889","db","user","pw", false) into dbID
   answer "Open DB - Result: " & dbID
   if dbID is a number then
      put "CONNECTED: " & dbID into fld fldDBConnect
      set textColor of fld fldDBConnect to green
   else
      put "DISCONNECTED" into fld fldDBConnect
      set textColor of fld fldDBConnect to red
      answer dbID
      exit to top
   end if  
end sqlConnectDB
Result:
Dev Environ:
- Pops up 'Open DB' in a window
- Pops up 'Open DB - Result: ' & result # in a window
- Field fldDBConnect changes to 'CONNECTED'
Standalone :
- Pops up 'Open DB' in a window
- Nothing elseoccurs

If I choose 'Close DB' ..

Close DB code:

Code: Select all

on sqlCloseDB
   answer "Close DBs: [" & revOpenDatabases() & "]"
   put revOpenDatabases() into connectList
   repeat for each item c in connectList
      revCloseDatabase c
   end repeat
   answer "Verify DBs Closed: [" & revOpenDatabases() & "]"
   put empty into dbID
   put "DISCONNECTED" into fld fldDBConnect
   set textColor of fld fldDBConnect to red
   clrFields 'All'
end sqlCloseDB
Result:
Dev Environ:
- Pops up 'Close DBs: [' open db #'s ]' in a window
- Pops up 'Verify DBs Closed: []' in a window
- Field fldDBConnect changes to 'DISCONNECTED'
Standalone :
- Nothing occurs

The results are making me think that my stack may be corrupt in such a way as to affect the build only on this stack.

If I come across anything further, I'll post it.

Thanks
Last edited by xeir on Wed Aug 20, 2008 4:31 am, edited 2 times in total.

xeir
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 35
Joined: Thu Jul 03, 2008 5:54 am

Post by xeir » Wed Aug 20, 2008 4:26 am

Ok, just tried the legacy drivers and I get the following in the Dev Environment ..

Open DB - Result: Unknown MySQL server host '127.0.0.1:8889' (1)

And in Standalone, it doesn't go past the first 'Open DB' window as before.

xeir
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 35
Joined: Thu Jul 03, 2008 5:54 am

Post by xeir » Wed Aug 20, 2008 7:03 am

BINGO !! Got it to work, yet pretty sure there is still an issue.

Will post more tomorrow, very late and tired here.

xeir
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 35
Joined: Thu Jul 03, 2008 5:54 am

Post by xeir » Thu Aug 21, 2008 3:45 am

Ok, so here's what it came down to:

I tried deleting everything from the stack except the connect code for the db, still had an issue.

After nameless hours trying different things to find a solution, this is what at the very least got the DB to connect in the standalone

I fixed the problem by copying all my scripts from the card script to the stack script, re-built the project and it worked.

I don't see why this would cause a problem however, as my test apps had similar scripts on the card instead of the stack as well, and no issues.

So, I am at a loss on that aspect.

Granted, I'm also having some weird window size issues and drawerissues on that card/stack; drawer becomes detached, will grow to double size, will re-attach, didn't initially appear where it was supposed to, main stack card is larger then the stack itself, and keeps hiding the bottom line for some reason, can't seem to forcebly resize either, etc. But I'll probably make a new post for these issues.

If you need any other info, or would like a copy of the wacky stack, just let me know.

Regards

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Thu Aug 21, 2008 11:07 am

Hi Xeir,

I'm glad you got it to work. Congrats!

I'm quite curious about why exactly copying the scripts to stack level solved the problem. What made you think that this was going to solve your problem, or was it just a guess?

The drawers have never worked correctly in Revolution. I believe only the left drawer is affected. Right drawers work correctly. This has been reported to the QCC years ago, but RunRev hasn't fix it.

I believe there is a workaround. You might find more info on that in the archives of the Rev Use Mail List.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

xeir
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 35
Joined: Thu Jul 03, 2008 5:54 am

Post by xeir » Thu Aug 21, 2008 3:42 pm

Mark-

I honestly wish I had more insight as to 'why' that happened to work.

As to trying that out ..

After two decades or programming different languages under multiple OS's and the same amount of troubleshooting in general, I know that when it's no longer obvious, try the not so obvious. So that's what I did.

For a moment, I had wondered if it was my own doing by not initially putting the code in the stack script, then after checking the other test apps, realized that that shouldn't be an issue after all.

And as I'm not familiar enough with the workings of Rev yet to know what will and will not have an effect, I'm sure that I'm just as likely to break things as I am to create them, grin.

If you think that you can glean any insight from the workings of the stack as to why it's not functioning properly when the code is in the card script, I'll be happy to send you a copy of the stack.

Guess I should send it to the QCC as well seeing as it is an issue and should work in either case. Once, I post it, I'll put a link here as well.

Regards

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Thu Aug 21, 2008 4:06 pm

Hi Xeir,

I already looked into this problem a few times and I can't find the source. It never happened to my own stacks, but it did happen to stacks of clients of mine. Although we did find solutions eventually, the solution never revealed the source of the problem, just like in your case. I wouldn't mind to have a look at your stack, if it is a really small simple stack to facilitate the analysis, but currently I don't think I will be able to find the source of the problem.

When I'm working with MySQL again, I'll try putting the scripts at card level and see what happens.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

xeir
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 35
Joined: Thu Jul 03, 2008 5:54 am

Post by xeir » Fri Aug 22, 2008 12:39 am

Mark-

I've posted the issue in the QCC, Report: 6983

I've also included the stack file relating to this problem. Feel free to take a look if you are so inclined.

Even though I'm using MySQL currently, this stack may have the same effect even if you change the connection info so as to connect to a different SQL server type. I would be curious to know if that is the case.

It includes 2 other issues I ran across as well.

If you require anything further, let me know.

Regards

xeir
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 35
Joined: Thu Jul 03, 2008 5:54 am

Post by xeir » Fri Aug 22, 2008 3:15 pm

Just to followup in the thread, Oliver at the QCC responded regarding the DB failure.

It seems that there is indeed an issue, fortunately there is also a workaround.

The workaround at this time is to add 'pass startup' in the 'on startup' script to keep the message from being blocked.

And it was due to this that the DB failure occurred.

Learn something new everyday, grin.

Regards

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Fri Aug 22, 2008 4:00 pm

Hi Xeir!

Many thanks for the update. I'll discuss this with some other people and see if we can confirm this.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Post Reply

Return to “Databases”