Page 1 of 1

Connecting to a remote sqlite database

Posted: Thu Jun 03, 2010 10:00 pm
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

Re: Connecting to a remote sqlite database

Posted: Fri Jun 04, 2010 2:43 pm
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

Re: Connecting to a remote sqlite database

Posted: Sat Jun 05, 2010 6:23 pm
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

Re: Connecting to a remote sqlite database

Posted: Sat Jun 05, 2010 6:36 pm
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