[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mysql-odbc
Subject:    Re: SQLConfigDataSource
From:       Oystein Fledsberg <fledsbo () hotel ! ejournal ! no>
Date:       1999-05-07 6:33:38
[Download RAW message or body]


In message <02cb01be97e2$960278a0$1e60b0cc@patrick.coconet.com>, "Patrick Sherr
ill" writes:
>Could you provide a sample of your implementation?

Sure: (no guarantees...)

#include <sql.h>
#include <sqlext.h>
#include <odbcinst.h>

void createDSN(const char *database)
{
  if (!SQLSetConfigMode(ODBC_SYSTEM_DSN))
    throw GeneralException("Unable to set system dsn mode");
  if (!SQLWriteDSNToIni(database, "MySQL"))
    throw GeneralException(String("Unable to create DSN for ") + String(database));

  if (!SQLWritePrivateProfileString(database,
         "Description",
         "Created by eJournal RMS installer",
         "ODBC.INI"))
         throw GeneralException("Unable to set description variable");

  if (!SQLWritePrivateProfileString(database,
         "Database",
         database,
         "ODBC.INI"))
    throw GeneralException("Unable to set database variable");

  if (!SQLWritePrivateProfileString(database,
         "Server",
         "localhost",
         "ODBC.INI"))
    throw GeneralException("Unable to set server variable");

  if (!SQLWritePrivateProfileString(database,
         "Flag",
         "0",
         "ODBC.INI"))
  throw GeneralException("Unable to set flag variable");
}


Øystein

---------------------------------------------------------------------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail myodbc-thread215@lists.mysql.com

To unsubscribe, send a message to the address shown in the
List-Unsubscribe header of this message. If you cannot see it,
e-mail myodbc-unsubscribe@lists.mysql.com instead.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic