0
\$\begingroup\$

I have downloaded SQLite C/C++ interface to work with Cocos2d-x. Created a database by Firefox SQLite plugin. Then tried the following code

    // sqlite implementation
    sqlite3 *db;

    if(sqlite3_open("testdb.sqlite",&db) == SQLITE_OK){
        NSLog(@"Opened db Successfully");
    } else {
        NSLog(@"Failed to open");
    }

Output is # Failed to open

How to solve the issue?

\$\endgroup\$
1
\$\begingroup\$

Well, you should start by checking the error code returned by sqlite3_open. Different codes are there for a reason to suggest what the error might be.

I for one guess that the file was not found. Very often the current directory is not what you expect, and is oftent different on different platforms.

\$\endgroup\$
0
\$\begingroup\$

I have written a blog on how to integrate sqlite in your cocos2d-x game in xcode step by step. You can visit http://sqlite-integration-in-cocos2d-x.blogspot.in/

\$\endgroup\$
  • \$\begingroup\$ Welcome! If at all possible, could you try to include the most relevant information from your blog post? It helps ensure you have the best possible answer just in case your blog goes offline for any reason. \$\endgroup\$ – Mike Cluck Mar 24 '14 at 21:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.