Trying to connect to an *.fdb using NODBC and PHP

kazamaxkazamax Member Posts: 13
Hi! I´m very very novice with Navision, I have been using this program only 2 days :oops:

What I need to do: I have to use PHP to list data from a clients table from an *.fdb database.

My problem:
I use this php code:
<html>
<body>

<?

$conn = odbc_connect("test","","");

$query = "select dni, nombre, direccion from clientes";

$rs = odbc_exec($conexion, $query);

?>

</body>
</html>
And the result is:
Warning: odbc_connect(): SQL error: [Simba][SimbaEngine ODBC Driver][DRM File Library]The operating system cannot gain access to the file C:\Archivos de programa\Microsoft Business Solutions-Navision\Client\database.fdb .Please check that the file type and attributes are correct. Error: 5, SQL state S1000 in SQLConnect in c:\inetpub\wwwroot\index.php on line 6

Notice: Undefined variable: conexion in c:\inetpub\wwwroot\index.php on line 10

Warning: odbc_exec(): supplied argument is not a valid ODBC-Link resource in c:\inetpub\wwwroot\index.php on line 10

I think the configuration of the DSN System is correct...

Can anyone help me??

Sorry about my english and my low knowledge... :oops:

Answers

  • PoltergeistPoltergeist Member Posts: 200
    Error 5 means that you don't have sufficient rights to access the database. Are you sure you have to access the database directly (as opposed to through a native server program)?

    Make sure the file is both readable and writable (check the attributes), that it's not hidden, and that everyone has sufficient NTFS rights (assuming you do use an NTFS partition)
  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    Have a look at these threads (about ASP, PHP & ODBC):

    Viewing Navision data using ASP
    NAV 4.0, ASP and ODBC
    [SOLVED] Navision - PHP/SQL search
    [FIXED] Navision ODBC connection with PHP

    These topics could get you started.
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • kazamaxkazamax Member Posts: 13
    Thank you very much for your help guys!

    - Poltergeist: That´s exactly the problem!, when I changed the attributes from the file always was correct.

    - Luc Van Dyck: Thank you for your links, I´m sure that will be very helpfull for me ;)
Sign In or Register to comment.