您好,可以参考下面创建UDB数据源的代码
UGDataSource* pDatasource = UGDataSourceManager::CreateDataSource(UGC::/*UGEngineType::*/UDB);;
UGDsConnection& cn = pDatasource->GetConnectionInfo();
cn.m_strServer = ugUDBpath;
cn.m_nType = UGC::/*UGEngineType::*/UDB;
cn.m_strAlias = ugName;
cn.m_bReadOnly = false;
bool isCreated = pDatasource->Create();
if (isCreated)
{
m_pUGWorkspace->m_DataSources.Insert(ugName, pDatasource); // 将新建数据源和工作空间关联,以便保存到文件。
}
else
{
delete pDatasource;
pDatasource = NULL;
}