Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connect to a remote sqlite3 database with Python

I am able to create a connection to a local sqlite3 database ( Using Mac OS X 10.5 and Python 2.5.1 ) with this:

conn = sqlite3.connect('/db/MyDb')

How can I connect to this database if it is located on a server ( for example on a server running Ubuntu 8.04 with an IP address of 10.7.1.71 ) , and is not stored locally?

e.g. this does not seem to work:

conn = sqlite3.connect('10.7.1.71./db/MyDb')
like image 454
cit Avatar asked Feb 23 '10 13:02

cit


1 Answers

SQLite is embedded-only. You'll need to mount the remote filesystem before you can access it. And don't try to have more than one machine accessing the SQLite database at a time; SQLite is not built for that. Use something like PostgreSQL instead if you need that.

like image 84
Ignacio Vazquez-Abrams Avatar answered Sep 30 '22 10:09

Ignacio Vazquez-Abrams