Creating odbc plugin
-
Hi, I am trying to connect a MS Sql server to my application using the ODBC driver. The problem I have is I do not know what I am doing!
Could you please tell me step by step, what I need to do to connect. I have read the documentation but it is not exactly clear. Please forgive my ignorance :)
thanks
-
Hi Thanks for replying....
I am using a host for my database and I have set an ODBC connection. The problem is how to get connected to the database. I have very little experience with QT and have read the docs about creating a plugin etc. If this is enabled by default, what do I need to do in my application to connect. When I use the addDatabase function, I get an error 'collect2: Id returned 1 exit status. I was assuming this was because the ODBC driver is not installed. What header files should I be using etc?
Thanks agian
-
You only need to include the header files for the classes that you use directly at the place where you use it. That is, you will probably need to include these at some point (not necessarily all at the same place):
@
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QSqlError>
//and perhaps also:
#include <QSqlRecord>
#include <QSqlField>
@ -
Where can I find info about the connection string format. All I have found at the moment is a little about using the DNS connection and setting the following:
@
QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
db.setHostName( <What goes here? > );
db.setDatabaseName( < what goes here?> );
db.setUserName("xxxx");
db.setPassword("xxx");
@Is this the right way to connect? Can I use a DNS-less connection string instead and if so how?
I have set up a ODBC source on my remote server but have no idea how to connect to it....
I wont lol again, not yet anyway!