Solved Database Connect Problem, Out Of Memory
-
Hello all.
db = QSqlDatabase::addDatabase("QSQLITE"); db.setDatabaseName("C:/Users/User/Desktop/newdata.db"); if(db.open()){ qDebug() << "db opened"; }else qDebug() << db.lastError() << db.databaseName();
QSqlError("-1", "Error opening database", "out of memory") "\u202AC:/Users/User/Desktop/newdata.db" QSqlQuery::prepare: database not open
-
@Taz742
Does the user who starts the program have write access to the desktop of the userUser
?---- edit
Do you have any idea where the LTR byte comes from when you read back and debug the database name? Have you set any left-to-right somewhere in the code?
-
@the_
Yes, I have all access.
I noticed nothing, had previously worked on the same project, But now I can not get what happened. -
@the_
Now I reload my program and everything is corrected.
Unfortunately I could not find the error. -
Hi,
There's something fishy in your database name. It looks likes there's an invisible character before the
C:
. You should erase and rewrite that line completely. -
@SGaist
I do not understand where to delete.
When I did a new database, i got to do the same Error. -
@Taz742 In
db.setDatabaseName("C:/Users/User/Desktop/newdata.db");
delete "C:/Users/User/Desktop/newdata.db" and enter it again...
-
@Taz742
Also do not use Copy&Paste, ctrl+c /ctrl+v, type it! -
@jsulm
So?delete "C:/Users/tleladze/Desktop/valuta/dbbb.sqlite"; db.setDatabaseName("C:/Users/tleladze/Desktop/valuta/dbbb.sqlite"); if(db.open()){ qDebug() << "db opened"; }else qDebug() << db.lastError();
So do not work anyway.
-
This post is deleted! -
@Taz742
this problem not solved. i randomly select correct answer. -
@Taz742 I've moved it back to unsolved state. Good luck :-)
-
Do you still have an error similar to
QSqlError("-1", "Error opening database", "out of memory") "\u202AC:/Users/User/Desktop/newdata.db"
?The
\u202A
is important here. It's likely the source of your problem since with it, the path points to an invalid location. So what was suggested was to delete the line of code containing thesetDatabaseName
call and rewrite it completely (i.e. without copy/paste) to ensure there's no funky character in it. -
@Taz742 "So do not work anyway" - what is the error message now?
-
@jsulm
The same error -
@Taz742
Hi
Could you perhaps open the DB in
http://sqlitebrowser.org/
and see what it says ?If its not the ""\u202A" char that gives this, then it could be great to see if other sqllite
program loads it without any errors. -
@Taz742
Yes same error.
When I saw this problem for the first time, it happened while I was server (the server I'm working on a project RDP) I copied down the entire project on my computer. After "QSqlError (" - 1 "," Error opening database "," out of memory ")" \ u202AC: /Users/User/Desktop/newdata.db ", this problem has emerged in both the server and my computer, when an application started . -
@mrjj
I have not seen any hacking \ u202A problem. :/ -
@Taz742
and what did SQLBrowser say?Update:
This error can come from things NOT related to memory at all. it seems
http://servalpaul.blogspot.dk/2011/12/misleading-out-of-memory-error-in.html -
@mrjj
In most cases it has to do with write permissions. Had the same error when trying to create a sqlite database in a location with no write access for the user.