Problem in opening a connection to database using dbc_IFactory_Open. Error Code 551316302 | developer.brewmp.com Problem in opening a connection to database using dbc_IFactory_Open. Error Code 551316302 | developer.brewmp.com

Developer

Problem in opening a connection to database using dbc_IFactory_Open. Error Code 551316302

Forums:

Hi All,

I'm trying to create a database using dbc_IFactory_Open. But it's returning me false with an error code "551316302". It says unable to open database file.

Here is my piece of code.

int iResult;
IEnv* pIEnv = NULL;
dbc_IFactory* pdbc_IFactory = NULL;
dbc_IConnection* pdbc_IConnection = NULL;

if ((iResult = iResult = ISHELL_CreateInstance(pMe->pIShell, AEECLSID_Env , (void**)&pIEnv)) != SUCCESS )
{
return FALSE;
}

//Returns Success.

if ((iResult = IEnv_CreateInstance(pIEnv, dbc_AEECLSID_Factory, (void**)&pdbc_IFactory)) != SUCCESS )
{
return FALSE;
}

//Returns Success.

if ((iResult = dbc_IFactory_Open(pdbc_IFactory, "databasefile.txt", dbc_CFLG_RWC, &pdbc_IConnection)) != SUCCESS )
{
return FALSE;
}

//Returns Error Code 551316302. Unable to open database file.

I have all the privileges set in the .mif file. Also I have checked with all the flags available for opening a databse file. Namely dbc_CFLG_RO, dbc_CFLG_RW, dbc_CFLG_RWC, dbc_CFLG_WIDE .

kindly help. If anyone can provide a sample code it would be of great help.

Thanks,
Ambarish.

Hi Ambarish
I hope you need to specify AEECLSID_Factory dependency in your mif file.
Steps
1) Open your mif in mif editor
2) Go to Dependencies tab
3) Your External Class Directory radio button should be selected
4) In the text box, below that , the path should be C:\Program Files\Qualcomm\Brew MP 1.0 SDK rev 2.1.788486\platform\databases\inc
5) Press Refresh button
6) You will see a list of Class ID and Class Name in the list above Refresh button
7) Select 0x0106c36d DBC_AEECLSID_FACTORY and click Add.
8) Save your mif.
9) Run application.
I hope this should work
GM

Hi Ambarish
I hope you need to specify AEECLSID_Factory dependency in your mif file.
Steps
1) Open your mif in mif editor
2) Go to Dependencies tab
3) Your External Class Directory radio button should be selected
4) In the text box, below that , the path should be C:\Program Files\Qualcomm\Brew MP 1.0 SDK rev 2.1.788486\platform\databases\inc
5) Press Refresh button
6) You will see a list of Class ID and Class Name in the list above Refresh button
7) Select 0x0106c36d DBC_AEECLSID_FACTORY and click Add.
8) Save your mif.
9) Run application.
I hope this should work
GM

Hi GM,
Thanks for the info.
But it's still returning the same error code.
I zeroed in on one issue. As in the 3.x architecture we used to specify privilege of file for database connections. Here we do not get to modify .mif file when creating the application instead it's created at the compile time according the to .cif file. Now when I cross checked my .mif file, it does not have the privilege of file. When I manually specify and save it, again at the compile time it loads the default by compiling the .cif file. Same is happening when I'm specifying the dependency of DBC_AEECLSID_FACTORY. After compiling it is changing the .mif file and removing the dependency.
I think I need to modify the .cif file. But it is not opening in the cif editor. I have got stuck.
Any pointers in this direction.
Thanks again,
Ambarish

Hi GM,
Thanks for the info.
But it's still returning the same error code.
I zeroed in on one issue. As in the 3.x architecture we used to specify privilege of file for database connections. Here we do not get to modify .mif file when creating the application instead it's created at the compile time according the to .cif file. Now when I cross checked my .mif file, it does not have the privilege of file. When I manually specify and save it, again at the compile time it loads the default by compiling the .cif file. Same is happening when I'm specifying the dependency of DBC_AEECLSID_FACTORY. After compiling it is changing the .mif file and removing the dependency.
I think I need to modify the .cif file. But it is not opening in the cif editor. I have got stuck.
Any pointers in this direction.
Thanks again,
Ambarish

Hi all,
As discussed in my previous post, now I have been able to modify the .cif file to reflect all the privileges and dependencies in the .mif file still I'm unable to create a database file. It's giving me the same error code. 20DC6B4E i.e. from the API reerence
dbc_CANTOPEN 0x20dc6b4e Unable to open the database file.
I'm providing all the privileges and dependency of DBC_AEECLSID_FACTORY through the .cif file which is being reflected in my .mif file.
I'm again providing my code. If anybody could come up with any pointers, that will be appreciated.
int iResult;
IEnv* pIEnv = NULL;
dbc_IFactory* pdbc_IFactory = NULL;
dbc_IConnection* pdbc_IConnection = NULL;
char szPath[] = "databasefile.txt";
if ((iResult = iResult = ISHELL_CreateInstance(pMe->pIShell, AEECLSID_Env , (void**)&pIEnv)) != SUCCESS )
{
return FALSE;
}
if ((iResult = IEnv_CreateInstance(pIEnv, dbc_AEECLSID_Factory, (void**)&pdbc_IFactory)) != SUCCESS )
{
return FALSE;
}
if ((iResult = dbc_IFactory_Open(pdbc_IFactory, (const char*)szPath, dbc_CFLG_RWC, &pdbc_IConnection)) != SUCCESS )
{
return FALSE;
}
//Returning error code in the above case.
Thanks again,
Ambarish.

Hi all,
As discussed in my previous post, now I have been able to modify the .cif file to reflect all the privileges and dependencies in the .mif file still I'm unable to create a database file. It's giving me the same error code. 20DC6B4E i.e. from the API reerence
dbc_CANTOPEN 0x20dc6b4e Unable to open the database file.
I'm providing all the privileges and dependency of DBC_AEECLSID_FACTORY through the .cif file which is being reflected in my .mif file.
I'm again providing my code. If anybody could come up with any pointers, that will be appreciated.
int iResult;
IEnv* pIEnv = NULL;
dbc_IFactory* pdbc_IFactory = NULL;
dbc_IConnection* pdbc_IConnection = NULL;
char szPath[] = "databasefile.txt";
if ((iResult = iResult = ISHELL_CreateInstance(pMe->pIShell, AEECLSID_Env , (void**)&pIEnv)) != SUCCESS )
{
return FALSE;
}
if ((iResult = IEnv_CreateInstance(pIEnv, dbc_AEECLSID_Factory, (void**)&pdbc_IFactory)) != SUCCESS )
{
return FALSE;
}
if ((iResult = dbc_IFactory_Open(pdbc_IFactory, (const char*)szPath, dbc_CFLG_RWC, &pdbc_IConnection)) != SUCCESS )
{
return FALSE;
}
//Returning error code in the above case.
Thanks again,
Ambarish.

One simple solution is,just remove the .cif file from your vc++ solution/project so the vc++ editor will not compilie .cif file. Then you change your .cif or mif file (as i specified in my prev post) and it will remain unchanged when you complie your project in vc++ editor.
[b]GM

One simple solution is,just remove the .cif file from your vc++ solution/project so the vc++ editor will not compilie .cif file. Then you change your .cif or mif file (as i specified in my prev post) and it will remain unchanged when you complie your project in vc++ editor.
[b]GM

Hi GM,
Thanks for the reply.
I have been able to modify the .cif file to reflect changes after compilation in the .mif file.
I presume that is not an issue now.
Still it's giving me error.
Thanks again,
Ambarish

Hi GM,
Thanks for the reply.
I have been able to modify the .cif file to reflect changes after compilation in the .mif file.
I presume that is not an issue now.
Still it's giving me error.
Thanks again,
Ambarish

one more point.
When I'm using dbc_IFactory_Observe API to create a database, it's returning me success but I'm not able to see the file being created. I have tried by giving both the complete file system path as well as relative path.
Any pointers on this unusual behavior.
Thanks,
Ambarish.

one more point.
When I'm using dbc_IFactory_Observe API to create a database, it's returning me success but I'm not able to see the file being created. I have tried by giving both the complete file system path as well as relative path.
Any pointers on this unusual behavior.
Thanks,
Ambarish.

Hi ambarish,
I think the problem is related to the path to the file. The pathname has to be a NULL-terminated string representation of a fully qualified filesystem path. Could you try a fully qualified path to the database file? For example, fs:/~0x0106c234/test.db. Replace the hex value with the class ID of your app.
Regards,
Jason

Hi ambarish,
I think the problem is related to the path to the file. The pathname has to be a NULL-terminated string representation of a fully qualified filesystem path. Could you try a fully qualified path to the database file? For example, fs:/~0x0106c234/test.db. Replace the hex value with the class ID of your app.
Regards,
Jason