PDA

View Full Version : SQLLITE Support Needed but it is there by default? What am I missing?



theMac
1st May 2010, 09:40
I am using QT4.6 on a Mac running Leopard.

I am just finishing running through the examples. All of them run perfectly fine for me. So I decide to start with a new project from scratch and use some of the example code as a starting point. It compiles, but then I get an error that states "Unable to Establish database connection. This examples needs SQLite support. Please read the Qt SQL Driver documentation for information how to build it"

Now before you tell me that I need to build the plug-in, I am using the same connection.h file that is in the examples, and when I took out the call to createConnection in my main program and add a call to QSqlDatabase::drivers() to see which drivers are available I get back
Starting /Developer/CartelCode/CreatDatabase/CreateDB/CreateDB...
MIN
QSQLITE
QODBC3
QODBC
QPSQL7
QPSQL

It seems like there is something that is not set in the project, but I don't know where. Every time I search on this error it is because someone didn't build the DB....but SQLite is built and the program states that it is available.

I made sure I have all the same libraries loaded in my programs, the only thing I can think of at this point is that maybe my .pro file is not right, could this be it? Here is what mine looks like
QT += network \
opengl \
sql \
script \
svg \
webkit \
xml \
xmlpatterns \
phonon \
qt3support \
testlib \
dbus
TARGET = CreateDB
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
HEADERS += connection.h

Thanks in advance for any info any one can offer.

Lykurg
1st May 2010, 13:32
Show us some code and make sure you have set the right path to the database file.

theMac
1st May 2010, 14:23
Ok, as I was pasting code in I saw where that error is being generated....I'm an idiot.

You mentioning the path to the file made me check the part where I create the DB file and I realized I made a type-o in that path so the directory didn't exist, thus the error.

Thanks.