Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access sqlite from a remote server

Tags:

sqlite

qt

I am wondering how i can access an sqlite database that is sitting a remote server.I have read threads discouraging it but i need to do it if its possible.

     /*
QUrlOperator xc("http://example.com");
xc.get("testdatabase.db");
*/

QSqlDatabase db = QSqlDatabase::addDatabase( "QSQLITE" );

  db.setDatabaseName(xc.get("testdatabase.db"));
  //idea

  if( !db.open() )
  {
    qDebug() << db.lastError();
    qFatal( "Failed to connect." );
  }
like image 640
Gandalf Avatar asked Dec 02 '11 14:12

Gandalf


People also ask

How do I view SQLite database online?

Drag and drop your SQLite file directly into the SQLite editor or click on "Database file > Open DB file" to open your SQLite database. Show and manipulate a table: You can select a table in order to display and manipulate its content (1). Click on refresh button (2) in order to update tables list.

Can SQLite connect to server?

You can use the Microsoft SQL Server Management Studio to connect your SQLite data to an SQL Server instance. Linked Server is a tool of MS SQL Server that allows to execute distributed queries to refer tables stored on non-SQL Server datbase in a single query.

Can you Access SQLite remotely?

SQLite can still be made to work in many remote database situations, but a client/server solution will usually work better in that scenario.


1 Answers

SQLite isn't a network database, so it doesn't have any network connection ability built into it.

You would need to either:

  • Make the SQLite DB available on a network-accessible shared drive OR
  • Write/find an existing network server/web service for it

A web application is essentially a web service. If you happen to be running a web application on top of this DB, just expose certain levels of DB access to admins-only.

It's not recommended you do this because multiple threads/clients/etc. accessing a SQLite DB simultaneously may lead to concurrency problems very quickly.

like image 138
jefflunt Avatar answered Oct 07 '22 18:10

jefflunt