Author Topic: Database problem  (Read 5253 times)


  • Guest
Database problem
« on: December 01, 2005, 12:28:28 pm »
If this topic is not in the ritght place, please tell me where can I find some info on this subject.
I started my wx & CB experience a month ago and it goes really nice. But I have this problem with connecting to a postgreSQL database. I used ODBC, I defined a DSN for a database, but it doesnt want to connect.
I will attach the sourcecode, if any1 can help me.
Thank you!

    wxDbConnectInf *DbConnectInf;
    DbConnectInf = new wxDbConnectInf(NULL, "PostgreSQL", "admin", "admin", "");

    if (!DbConnectInf->AllocHenv())
        wxMessageBox("Unable to allocate an ODBC environment handle",
                     "DB CONNECTION ERROR", wxOK | wxICON_EXCLAMATION);

    wxDb *sampleDB = new wxDb(DbConnectInf->GetHenv());
    if (sampleDB->Open("PostgreSQL","admin","admin"))

    if (sampleDB->IsOpen())
        wxMessageBox("Hooray! database is open!");
        wxMessageBox("Still wrong...");

    delete DbConnectInf;

I only have "still wrong" message! :(