Options

Problems with ConnectServerAndOpenDatabase in CFront

ErikAnErikAn Member Posts: 3
Hello!

I'm currently trying to connect to a native Navision database using .net and CFront (CFront.ocx). I have earlier managed to connect with and read data from a local database by OpenDatabase(), but when using ConnectServerAndOpenDatabase (in order to be able to use a login with name and password), I run into trouble.

I get the following error message:
"The TCP/IP-network returned the error code 10049"

The line I use for connecting is:
Call CF.ConnectServerAndOpenDatabase("NDBCN", False, "tcp", "n:\database.fdb", 10000, False, False, "myusername", "")

As I understand it, when you set the second parameter (server name) to false or 0, CFront will try to open my local database file instead of using a network connection.

Error 10049 seems to translate into "Cannot assign requested address", which looks like it's not using my local path when looking for the database.

Has anyone had similar problems? I've tried connecting using a real server address, but no luck there either.


//Erik



[/quote]

Comments

  • Options
    philippegirodphilippegirod Member Posts: 191
    Hello,
    Is it a path problem ? ..... the "n:\database.fdb" should be the path used by the server.
    My candle burns by both ends, it will not last the night,
    But oh my foes and oh my friends, it gives a lovely light
  • Options
    ErikAnErikAn Member Posts: 3
    Hi, and thanks for your answer

    I have tried different paths, the documentation mentioned "[if you] do not specify a server name, the application will search for the database file on your local computer". I took it as it would use a normal search path instead of a network one, but this is maybe wrong?

    Another thing I tried was:
    Call CF.ConnectServerAndOpenDatabase("NDBCN", "127.0.0.1", "tcp", "client\database.fdb", 10000, False, False, "myusername", "")
    
    The 'client' folder is shared on my computer, so it should be visible if you manage to get an connection to 127.0.0.1.
  • Options
    kinekine Member Posts: 12,562
    Trz to set the ServerName parameter to empty string. Parameter with database path is normal path where is the database accessible. Same as if you run the client and enter the database path. Try open the database with client and use the same path...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    dick11dick11 Member Posts: 60
    I have tried it on my PC. Everything works fine even with a shared drive. I use Nav 3.60 / Windows XP prof.

    But did you try
    Call CF.OpenDatabase("n:\database.fdb", 100000, False) ?
    Dick van der Sar

    www.dasautomatisering.nl
  • Options
    kinekine Member Posts: 12,562
    ErikAn wrote:
    Hi, and thanks for your answer

    Another thing I tried was:
    Call CF.ConnectServerAndOpenDatabase("NDBCN", "127.0.0.1", "tcp", "client\database.fdb", 10000, False, False, "myusername", "")
    
    The 'client' folder is shared on my computer, so it should be visible if you manage to get an connection to 127.0.0.1.

    This work only if Navision Database server is running on your computer and in this case you not fill the DBName.

    For Native DB server - ServerName is the host of the DB Server and DBName is empty

    For Native single user access (through file) - ServerName is empty and DBName is file path to .fdb file.

    For SQL - ServerName is the host of MS SQL, DBName is the name of database on MS SQL
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.