Cisco Unified Communication Tools

ODBC .NET Wrapper Library

Version   3.0.3 
Last Update   1/8/2014
Statistics   Requires Visual Studio 2010 or later and the .NET 4.0 framework and a Connection server capable of serving up ODBC functionality. 
Compatibility   Unity Connection 7.0(1) or later.
Support   NOT TAC supported - support is through the developer forus, the links page has details.  Any tools created using ODBC are not going to be supported by TAC (i.e. they can't help you with your data schema problems or Informix driver questions - you need to go to the forum for that).

The ODBC .NET SDK wraps the ODBC access for Unity Connection and provides simple and helpful helper methods for doing everything you'd need to with Connection via ODBC.  This is the same version of the library used in many of the tools available on this site.

The SDK can now be included in your projects via NuGet.  Simply search on "Cisco.UnityConnection.OdbcSdk" and include it in your project!  In 60 seconds you can be up and attached to your Connection server and being productive.  Couldn't be easier. 

Developers Guide

HTML Version

PDF Version (this is nicer to use given the bookmarks can be used for content navigation more easily)

Training videos (Flash MP4s)

Coming soon...

Usage Samples

The following are some highlights of the types of things you can do with the ODBC wrapper library - the project code has more extensive examples in the CLI sample program and the unit tests included with it.

Logging into Connection

 //attach to Connection server via ODBC
UnityConnectionServerOdbcSdk server = new UnityConnectionServerOdbcSdk ("TestApplication");
var res= server.LoginDatabaseBlocking ("192.168.0.197", "dbdude", "labPw");
if (res.Successful == false)
{
    Console.WriteLine("Failed to log in:"+res);
    return;
}
Console.WriteLine("Logged into:" + server);

Using a DataReader

const string strSql = "SELECT Alias, ObjectId FROM vw_subscriber";
IfxDataReader oReader;
res = server.FillDataReaderInformix(strSql,out oReader);
if (res.Successful == false)
{
    Console.WriteLine("Fetch failed:"+res);
    return;
}
while (oReader.Read())
{
    Console.WriteLine("Alias="+oReader["alias"]);
}
oReader.Dispose();

Filling a DataTable

//fetch a single user's data to a table
DataTable oTable;
const string strSql = "SELECT Alias, ObjectId FROM vw_Subscriber WHERE " +
    "fn_tolower(city)=? AND isVmEnrolled=?";
res = server.FillDataTableBlocking(strSql, out oTable, false, "seattle",true);
if (!res.Successful)
{
    Console.WriteLine("Fetch failed:"+res);
    return;
}
Console.WriteLine("Seattle users:");
foreach (DataRow oRow in oTable.Rows)
{
    Console.WriteLine("Alias="+oRow["Alias"]);
}

Getting a Count

const string strSql = "SELECT COUNT(*) FROM vw_Subscriber WHERE ListInDirectory=?";
int iCount = server.GetCount(strSql,true);
Console.WriteLine("Directory list count="+iCount);

Executing a Stored Procedure

//create a new subscriber

_connectionServer.StartNewCommand("csp_SubscriberCreate");
_connectionServer.AddCommandParam("pTemplateAlias", IfxType.VarChar, "voicemailusertemplate");
_connectionServer.AddCommandParam("pAlias",IfxType.VarChar,"jsmith" );
_connectionServer.AddCommandParam("pDtmfAccessId", IfxType.VarChar, "1234");


//call the proc execute with an output string - this calls it as a "function" proc that
//expects a return.
string strNewObjectId;
DbFetchResult res = _connectionServer.ExecuteProc(out strNewObjectId,"pObjectId");
if (res.Successful == false)
{
    Logger.Log("(error) failed to create new subscriber:"+res);
    return;
}

Logger.Log("User created, new ObjectId=" + strNewObjectId);