Connecting tio Mysql with wxDBA

In this forum you can discuss database related issues which can be wxWidgets related, but also generic in nature.
Post Reply
c__chp
In need of some credit
In need of some credit
Posts: 1
Joined: Sat Apr 04, 2009 9:45 pm

Connecting tio Mysql with wxDBA

Post by c__chp » Sat Apr 04, 2009 9:50 pm

Is there someone who can give me with a small example which connect to mysql using wxDBA and map some fields.

Many regards
Nico Heiligers

pkuriakose
In need of some credit
In need of some credit
Posts: 5
Joined: Thu Aug 17, 2006 3:39 am
Location: Shelton,CT USA
Contact:

Re: Connecting tio Mysql with wxDBA

Post by pkuriakose » Mon Feb 27, 2012 6:54 pm

Hi Nico,

Did you get this working?

Thx

maxbld
Earned some good credits
Earned some good credits
Posts: 111
Joined: Wed Jan 30, 2013 10:49 pm

Re: Connecting tio Mysql with wxDBA

Post by maxbld » Fri Feb 08, 2013 11:55 am

Hi,

I've done that using the ODBC pluging:

Code: Select all

#include <dba/dba.h>
    try {
        dba::SQLArchive ar;
        ar.open("dbaodbc", "DSN=<your_DSN_name");
        std::string strval;
        int intval;
        std::auto_ptr<dba::DbResult> res(
            ar.getIStream().sendQuery(dba::SQL("SELECT ID, Type FROM Table").into(intval).into(strval))
        );
        while(res->fetchRow()) {
            itoa(intval, value, 10);
            Result += (std::string)value + " " + strval + "\r\n";
        };
        wxMessageBox(Result, "Results", wxOK, parent);
    } catch (const dba::SQLException& pEx) {
        wxMessageBox(pEx.what(), "SQL Error:", wxOK, parent);
    } catch (const dba::Exception& pEx) {
        wxMessageBox(pEx.what(), "Error:", wxOK, parent);
    };
I'm on Win7 64bits, but I'm expecting it to work the same on Linux with iODBC. I'm due to test that sooner or later, but please tell me should you test it on Linux.

BR,
Max.

Post Reply