-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Load a database from the server Failed Error: file is encrypted or is not a database #185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Maybe test.db is encrypted or is not a database? ;)
2 января 2017 г. 16:02:32 GMT+01:00, wuxingjun <[email protected]> пишет:
…Load a database from the server Failed Error: file is encrypted or is
not a database
Here are my codes. test.db is in the root directory of my website
var xhr = new XMLHttpRequest();
xhr.open('GET', 'test.db', true);
xhr.responseType = 'arraybuffer';
xhr.onload = function(e) {
var uInt8Array = new Uint8Array(this.response);
var db = new SQL.Database(uInt8Array);
var contents = db.exec("SELECT * FROM testtable");
};
xhr.send();
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kripken/sql.js/issues/185
--
Простите за краткость, создано в K-9 Mail.
|
I ensure test.db is a database and not encrypted. I can get data by upload sqlite file,but not from server
|
What is this code you are giving ? I think the problem is simply with how you fetch the DB file ? Can you give the full URL of your html file and the one of your database file ? |
This is not what I asked you. What are the URLs of your files? Display index.html in your browser and give me the url. Open the database in your browser and give me the url.
3 января 2017 г. 3:26:34 GMT+01:00, wuxingjun <[email protected]> пишет:
…
Here are my test codes and DB file

index.html


--
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
https://github.com/kripken/sql.js/issues/185#issuecomment-270043209
--
Простите за краткость, создано в K-9 Mail.
|
I've found the reason.Permission Issue |
That means Anyone can download the db file from website,right? |
Of course. If you want to read the database from the browser, then the database has to be accessible from the browser.
5 января 2017 г. 2:29:23 GMT+01:00, wuxingjun <[email protected]> пишет:
…That means Anyone can download the db file from website,right?
--
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
https://github.com/kripken/sql.js/issues/185#issuecomment-270538688
--
Простите за краткость, создано в K-9 Mail.
|
how to solve this problem? |
Load a database from the server Failed Error: file is encrypted or is not a database
Here are my codes. test.db is in the root directory of my website
var xhr = new XMLHttpRequest();
xhr.open('GET', 'test.db', true);
xhr.responseType = 'arraybuffer';
xhr.onload = function(e) {
var uInt8Array = new Uint8Array(this.response);
var db = new SQL.Database(uInt8Array);
var contents = db.exec("SELECT * FROM testtable");
};
xhr.send();
The text was updated successfully, but these errors were encountered: