Skip to main content

Get Version Information

The following code sample illustrates how to get version information.


Code Sample

See the C++ environment settings for details on setting the project environment.


<cpp_admin_others_getversion.cpp>
/*****************************************************************************************
*
* cpp_admin_others_getversion.cpp
*
*
******************************************************************************************/

#include<string>
#include<iostream>
#include "teagent.h"
#include "teconnection.h"
#include "teexception.h"
#include "teauthuserctx.h"
#include "teobject.h"
#include "teadmin.h"

using namespace ERUCES;
using namespace std;

int main()
{
string strServer = "localhost";
long nPort = 8888;
string strAdminUser = "admin";
string strAdminPswd = "password1A";

try
{
// Connect to server
auto_ptr<TEConnection> conn = TEConnection::createInstance(TEConnection::SecureConnection);
conn->open( strServer, nPort, strAdminUser, strAdminPswd );
cout << "Connected to " << strServer << " as " << strAdminUser << endl;

TEAdmin admin;
admin.attachConnection(conn.operator->());

uint32_t nMajor, nMinor, nBuild, nEdition;
_TESTD string strVersion;
admin.getVersion(&nMajor, &nMinor, &nBuild, &nEdition, strVersion);
cout << "Version: " << nMajor << ":" << nMinor << ":" << nBuild << ":" << nEdition << endl;
cout << strVersion.c_str() << endl;

admin.detachConnection();

// Disconnect from server
conn->close();
cout << "Disconnected from " << strServer << endl;
}
catch (TEException &e)
{
cout << e.getAllMessages().c_str() << endl;
}
catch (...)
{
cout << "Unexpected error" << endl;
}

return 0;
}
Output
Connected to localhost as admin
Version: 5:0:2:40
Engine 5.3.0002 FPE_KS [ Sqlapi db2 ]
Disconnected from localhost