sqlite DllNotFoundException - my bad

I made a really stupid mistake, so I’m posting it here in case anyone else is fool enough to do the same.

Lots of people have problems getting sqlite to work and play nice with Unity. In particular, there are many, many threads about the DllNotFoundException, and the myriad of things you can try. This is a deep rabbit hole, and this post is here because I went down it completely unnecessarily.

Ready for my bonehead move, and the (even more ridiculous) consequence?

If you try to execute a command on a SqliteConnection that is not open you will get a DllNotFoundException. Note that if you do the same with a sane db provider like, say, SqlServer, you’ll get an InvalidOperationException, with an even more helpful message saying “ExecuteReader requires an open and available Connection. The connection’s current state is closed.”

But Mono.Data.SqliteClient? Not a chance. Killed hours trying to figure out if I had the wrong version of dlls, or had them in the wrong place, and why in tarnation did it work in one project, but not the other. Clearly, the error was mine, but you’d think the the wrapper would have the decency to at least not send me on a wild goose chase.

/rant

Cool rant - I used sqlite3 and had no real problems. The command Query was a little different than expected but once I figured it out it was smooth like butter.

So for now I’m placing the .sqdb in the folders of the build, and was wondering if you have found a way to get it inside the encrypted section of the build or if you are just encrypting the file yourself in a third party app?

Sorry, I’m new to Unity and haven’t gotten that far yet. If you’re using Pro, I think you can put it in an AssetBundle:

http://docs.unity3d.com/Documentation/Manual/protectingcontent.html

But if you’re using Indie, like me, I think 3rd-party is the only way. But like I said, it’s all new to me. If you figure something out, post a followup.