Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

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.

share|improve this answer

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/

share|improve this answer
    
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. –  Mike C Mar 24 at 21:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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