0

I have a SQLite DB hosted on my local network


I want to connect to these SQLite DB through python with the following code

import sqlite3

conn = sqlite3.connect('http://172.24.3.171:18080/db/SCdatabase.sq3')
cursor1 = conn.execute("select* from OlcConfig_Actual where LogReporterPointer = '1970-01-01T00:00:00Z'")

rows = cursor1.fetchall()
lista =[]

if len(rows) >= 1:
    for eachrow in rows:

        for eachcol in eachrow:
               lista.append(str(eachcol))

    print lista

print "Opened database successfully";

But I get an error that says:

OperationalError: unable to open database file

Can someone help me out with the error on the code?

1 Answer 1

1

SQlite does not communicate over HTTP, it requires a file on your local file system. If you can "reach" your file with ls (on *X) or dir (on Windows) then use the full path to the file in your connect statement.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.