Options

.fdb not found

jksjks Member Posts: 277
Hi all,

I created a new database in navision and one company inside it.
But i am not able to find .fdb of that database.

e.g my company name is Test then Test.fdb is not there instead following three files are there.

Test_1_Data.ndf
Test_Data
Test_Log

I am using cfront inside C program in which i have to specify path of .fdb file. So how can i get .fdb of Test database

Please Help

Comments

  • Options
    HalMdyHalMdy Member Posts: 429
    It seems that you have created an SQL DB, not a native.

    .FDB is the database file for a native database.
  • Options
    jksjks Member Posts: 277
    Hi,

    I have created database in following way:
    Opened a navision and File->Database->New

    If it is a sql DB then how can i connect to that database using CFront from C++ program.

    Please Help.
  • Options
    2tje2tje Member Posts: 80
    use the c/side client, not the sql client (ie. fin.exe, not finsql.exe)
  • Options
    kinekine Member Posts: 12,562
    jks wrote:
    Hi,

    I have created database in following way:
    Opened a navision and File->Database->New

    If it is a sql DB then how can i connect to that database using CFront from C++ program.

    Please Help.

    Look for ConnectServerandOpenDatabase in C/Front help... it is best way how to connect under boths backends (Native and SQL)...

    If you are creating fdb, you are entering name nad path where to create the file... no company name is included in this name. The company is created within this file (does not change the name of the DB). The Native DB file can be named without .fdb (if you entered dot char in the name, the extension .fdb will be not appended).

    If you have files, as you write, the files are for MS SQL (MSDE) backend... (but can be not visible, because are not connected into the server...)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    jksjks Member Posts: 277
    Hi,

    I specified the path of .mdf file and as a driver name i have specified NDBCS.
    When i run my program it says that is can't find .mdf file there on my machine eventhough file is there.

    (FYI : file is there without .mdf extension e.g Test_Data as mentioned previously. I also tried to specify database name without .mdf extension but in that case also it gives the same erro).

    Please help.
  • Options
    kinekine Member Posts: 12,562
    rename the files to have

    Test_Data.mdf
    Test_Log.ldf

    But! This is not sufficient to use this files! You must attach this files into MS SQL server! (you never use this files directly...) You can use Enterprise Manager for this, or execute next command on the MS SQL server:
    EXEC sp_attach_db @dbname = 'Test', 
       @filename1 = N'<path to the files>\Test_1_Data.ndf', 
       @filename2 = N'<path to the files>\Test_Data.mdf', 
       @filename3 = N'<path to the files>\Test_Log.ldf'
    

    It will create Test DB under the server and attach it to this files.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    jksjks Member Posts: 277
    Hi Kine,

    I renamed the files. Then i opened Enterprise Manager. Then right clicked on Database-> All Tasks->Attach Database. But there these files appear as
    Test_Data.mdf.mdf and
    Test_Log.ldf.ldf

    This is so because when files do not have .mdf extension at that time also in Enterprise Manager i am able to them them with .mdf extensions.

    Please help.
  • Options
    jksjks Member Posts: 277
    When i see the property of Test_Data it shows me that it is a mdf file with
    Test_Data.mdf
  • Options
    kinekine Member Posts: 12,562
    Rename them back - you have hidden extensions enabled - please, go to the Explorer - Tools - Folder Options - Second tab (I do not know englis name) - And uncheck option "Hide extension of known type" or something like this.. then you will see names exactly as they are...

    Or use some 3rd party file manager (Norton, Total commander etc.)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    jksjks Member Posts: 277
    Hello Kine,

    I did so.Now i am able to see .mdf extension in my path (and correctly in Enterprise Manager as well).

    But still getting same run time error.( c:\program files\microsoft business solution -navision\Test_Data.mdf database does not exist on server my_server_name);

    Please help.

    Which solution is better to use .fdb or to use .mdf?
    (my requirement is in navision when i will press a button at that time this c++ file(exe of it) will be executed and inside this exe i want to retrieve some records).

    If i use .fdb then will i be able to use that .fdb in a client server environment?
  • Options
    kinekine Member Posts: 12,562
    Yes, if you run fin.exe and create new database, you can open it directly (one user environment) or connect it to Navision server and if you will connect to this server, you have Client-Server environment for many users...

    the mdf you must attach under MSDE or MS SQL, you are not able to use them directly...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    jksjks Member Posts: 277
    I have attached .mdf to MS SQL
    Still gettting the error.

    Please help.
  • Options
    kinekine Member Posts: 12,562
    Error from MS SQL or from C/Front? If C/Front, can you post the part of the code you are calling (with which params?)?
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    jksjks Member Posts: 277
    Following is my code:

    void main()
    {
    DBL_U8 *NDBCDriverName = (DBL_U8*)"NDBCS";
    DBL_U8 *ServerName = NULL;
    DBL_U8 *NetType = (DBL_U8*)"Named Pipes";
    DBL_U8 *DatabaseName = (DBL_U8*)"C:\\Program Files\\Microsoft Business Solutions-Navision\\Client\\Test_Data.mdf";

    DBL_S16 ExceptionHandlerTest = 0;
    DBL_U8 *NavisionPath = (DBL_U8*)"";
    DBL_HTABLE hMainTable;
    DBL_U8 *CompanyNamePtr;

    if (!stricmp(NDBCDriverName, "NDBCN"))
    {
    if (0 != SessionInit("cfront.dll"))
    {
    printf("Could not load the CFRONT dll");
    return;
    }
    }
    else if (!stricmp(NDBCDriverName, "NDBCS"))
    {
    if (0!=SessionInit("cfrontsql.dll"))
    {
    printf("Could not load the CFRONT dll");
    return;
    }
    }
    else
    {
    printf("Invalid NDBC Driver Name supplied: %s", NDBCDriverName);
    return;
    }

    if (*NavisionPath!='\0')
    DBL_SetNavisionPath(NavisionPath);

    /* Using NT Authentication */
    DBL_ConnectServerAndOpenDatabase(NDBCDriverName,ServerName,NetType,DatabaseName,0,0,1,0,0);
    .......
    }

    It gets compiled successfully. When i run it, it gives following error:
    The C:\Program Files\Microsoft Business Solutions-Navision\Client\Test_Data.mdf database does not exist on the 'My server name' server.
    Exception Handler called with error:52001

    and then program terminates.

    Please help.
  • Options
    kinekine Member Posts: 12,562
    database name is TEST, not the name of the file... the server know, that TEST database is saved in this files, it is why you need attach the files prior to use them...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    jksjks Member Posts: 277
    Thanks Kine.

    Now it works perfectly.
    Thanks for your such a great help.
Sign In or Register to comment.