lost connection

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Samuele
Posts: 282
Joined: Mon Oct 11, 2021 7:05 pm
Location: Italy

lost connection

Post by Samuele » Mon Nov 29, 2021 1:07 pm

hi, in my stack i connect automatically when open a card named "database" to a database, but after a little time the connection is lost, any ideas on how to not lose the connection as long as the user is in the card "database" ?
thanks!
Samuele.

prometheus
Posts: 40
Joined: Sun Dec 13, 2015 6:05 pm

Re: lost connection

Post by prometheus » Sat Jan 15, 2022 12:20 am

This can be caused by aggressive server handling of socket timeout, to workaround this you could call this command each time you call database related functions:

Code: Select all

local sDatabaseID

command ensureDatabseConnection
   local tOpenDatabases
   put  revOpenDatabases() into tOpenDatabases
   if sDatabaseID is among the items of tOpenDatabases and sDatabaseID>0 then
      exit ensureDatabseConnection
   end if
   put  revOpenDatabase("mysql", "hostAddress", "yourDatabaseName", "YourUserName","YourPassWord",,,0, true) into sDatabaseID
end ensureDatabseConnection

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”