Connecting to a remote sqlite database

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: Klaus, FourthWorld, heatherlaine, kevinmiller

Post Reply
phaworth
Posts: 592
Joined: Thu Jun 11, 2009 9:51 pm

Connecting to a remote sqlite database

Post by phaworth »

Anyone have any experience with the above? Up to now, I've been using a db on my local Mac but now I want to access one on another Mac in my network.

I've set up a shared folder on the remote Mac and allowed read and write access to the login I use on that Mac. Then I connect to the remote Mac from my Mac using the logon I"ve set up. I know that's OK because I can happily copy files to and from my Mac to the shared folder on the remote Mac.

In my code, I prompt the user for the db to be opened, check if that file exists ( that check works OK), then call revOpenDatabase to open it. All I get is a useless error message "Unable to open database".

The logic is the same no matter whether the db is on my local Mac or the remote one and it works fine for dbs on my local Mac. The call to revOpenDatabase looks like this:

get revOpenDatabase(pdbType, tSQLiteDatabaseFile,,,,)

pdbtype is "sqlite"
tSQLiteDatabaseFile is "/Volumes/BandTrak/BandTrak.s3db" which is exactly what is returned from the answer file command

Got a feeling that I need to do something different to open a database on a remote computer but not sure what it is.

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

Re: Connecting to a remote sqlite database

Post by Mark »

Hi Pete,

You can use the command line version of sqlite3 over ssh or use cgi or php.

This puzzles me: "/Volumes/BandTrak/BandTrak.s3db". Probably, you have no permissions to write there. Shouldn't this be something like "/Volumes/Pete/Some Folder/BandTrak.s3db"?

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
phaworth
Posts: 592
Joined: Thu Jun 11, 2009 9:51 pm

Re: Connecting to a remote sqlite database

Post by phaworth »

Thanks Mark. You'e right, the filepath does look a little odd but it's exactly what is returned by the answer file command. Maybe I should look into that a bit further.
Pete
Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Connecting to a remote sqlite database

Post by Mark »

Hi Pete,

Please note: you should not look into the oddity of the file path but into the permissions you have when you connect to that directory from a remote client.

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