Question:

Is there a way to copy user records (IDKit user) from one database to another?


Solution:

You have following options:


1) If you are using SQLite you can transfer whole database content if you copy the created SQLite3 database file, which you are using in IDKit connection string.


2) Create backup of source database and restore it on target database system. After that you can just connect to your target database. Please refer to your database Backup/Restore procedure documentation.


3) Transfer user records using IDKit PRO SDK, using multiple IDKit connections (usually two connections).


C++:

IEngine_InitClient("connection string to source database");          // source database connection
dstCon = IEngine_InitConnection();                                            // destination database connection
IEngine_SelectConnection(dstCon);                                            // destination connection selected
IEngine_Connect("connection string to destination database");    // destination connect

IENGINE_USER user=IEngine_InitUser();

for(int i = 0; i < usersCount; i++{
     IEngine_SelectConnection(NULL);                                          // source connection selected (default IDKit connection)
     IEngine_GetUser(user, i);                                                      // pulled user from source database
     IEngine_SelectConnection(dstCon);                                       // destination connection selected
     IEngine_RegisterUser(user, NULL);                                        // register user in destination database
}

 

Java / .NET:

IDKit src = IDKit.getInstance();                                                
src.initClient("connection string to source database");                // one instance will connect to src database
IDKit dst = new IDKit();
dst.connect("connection string to destination database");          // second instance will connect to dst databse

int userCount = src.getUserCount();
int[] userIDs = src.getUserIDs(userCount);

for(int i=0; i < userCount; i++)                                                // pull records from src database and register in dst databse
{
     User user = src.getUser(userIDs[i]);
     dst.registerUserAs(user, userIDs[i]);
     user.close();
}