Syntax for network paths lazarus / 16-Databases ---------------------------------------------------------------------- Balf · 2011-03-24 08:39 Hello, I am very new to Lazarus (and Ubuntu) but have been using Dbase2k for years.  It is my only connection to Windows and I am hoping Lazarus can replace it! In the TDbf what is the syntax for a network path eg '//PCname/sharedDocuments/' Thanks, Peter ---------------------------------------------------------------------- TurboRascal · 2011-03-25 17:24 I don't think Tdbf knows nor cares about path format... Anything which works for the OS in general should work. That means X:\dir and \\server\share should work in windows, and /path/to/whatever under unix-likes. Not sure if direct NFS paths (server:dir) work in the latter case ... ---------------------------------------------------------------------- marcov · 2011-03-26 12:38 Afaik applications can't open network paths at all under Linux. network paths need to be mount, either manually, or through some explorer equivalent ---------------------------------------------------------------------- Balf · 2011-03-27 11:25 So, How using Lazarus, can I get the data in \\pc\folder\table.dbf into a grid for example?  I have made a form with a grid and using Tdbf and Tdatasource and I can see the data from a table on my computer.  I would like to change the path to see the data from another computer on the network (windows).  I can't believe it can be this difficult - or am I approaching it from the wrong angle! ---------------------------------------------------------------------- TurboRascal · 2011-03-27 12:02 You should start with YourDbf.Active := False, pass it a string with the network path as YourDbf.FilePath := '\\pc\share\dir' and set the TableName property to filename. You may set the path either in code as above, either using a directory open dialog. ---------------------------------------------------------------------- Balf · 2011-03-27 12:29 Thanks for the reply.  The problem I have is that in the directory open dialog the network is not there.  If I type in my path "\\sylvia\documents\head" and then change to active it says the path does not exist.  I can see it in "Places" on my desktop and can access the files in that folder.  It's just in Lazarus that I can't access the network. ---------------------------------------------------------------------- TurboRascal · 2011-03-27 12:46 You can recheck if your path is entered correctly by browsing the same path from the Object Inspector. Also recheck if your file/table/name is correct... ---------------------------------------------------------------------- Balf · 2011-03-27 13:24 So, I start in the form1 and click on Tdbf.  I go to the object inspector and next to the path there are three dots - they take me to the 'Select a file' window.  On the left are all my places. I can see the hard and floppy drives and the dvd writer and my documents etc.  BUT no network - What am I doing wrong!!! ---------------------------------------------------------------------- TurboRascal · 2011-03-27 13:59 One way is, when you click three dots on FilePath, you should get a "Browse For Folder" dialog, and at the bottom of the listed stuff there should be "My Network Places". Then you select or type TableName. The other way, the one which you tried, is to click three dots next to the TableName property, then you get "Select a File" dialog which directly selects a *.dbf file. When you click the combobox at the top, you get another list containing "My Network Places" which you should select and then navigate under it further until you find your file... You should follow through the Entire Network under it if you don't find it at the top level; if you can't find the path, check your target network shares accessibility. ---------------------------------------------------------------------- Balf · 2011-03-27 15:53 Yes, but as I said "Network Places" is not listed in either of the ways you suggest. ---------------------------------------------------------------------- TurboRascal · 2011-03-28 06:46 With that, I cannot help you. There is some issue with your system you must discover before this could work. Start by checking if other applications get Network Places listed in the Open dialogs. In the meantime, you may retry manually entering the path; just check if the path can be accessed from Explorer first. ---------------------------------------------------------------------- Balf · 2011-03-28 07:30 Thanks for your help with this.  Unfortunately I am no further forward.  I can access the network with all the other programs on my computer.  I wonder now whether Tdbf is the right tool for accessing the tables on another PC.  Perhaps I should be using sqldb.  I would be very grateful if someone could point me in the right direction as to how to access my table. Thanks, Peter. ---------------------------------------------------------------------- TurboRascal · 2011-03-28 08:11 Quote from: Balf on March 28, 2011, 09:30:54 amI can access the network with all the other programs on my computer.  Neither "programs" nor Tdbf "access network". Windows OS accesses the network and exports it to the VFS so _any_ program can use it. Quote from: Balf on March 28, 2011, 09:30:54 amI wonder now whether Tdbf is the right tool for accessing the tables on another PC.  Perhaps I should be using sqldb.  You are mostly right. For remote access to the databases, especially if concurrent access is involved, using a SQL server is the way to go. I'd recommend you use PostgreSQL, Firebird or MySQL (depending on your needs). Quote from: Balf on March 28, 2011, 09:30:54 amI would be very grateful if someone could point me in the right direction as to how to access my table. I've already pointed, even walked you through the right direction! Just investigate what I told you, then report findings back here if you still don't understand the problem and someone _might_ find a solution (this is not a systems support forum after all.) ---------------------------------------------------------------------- Balf · 2011-03-28 08:35 I think Marcov had the answer in that it only works under Windows.  I shall have to investigate how to use MySql.  I have tried all your suggestions and have reported back the results.  Manual typing causes "path does not exist" error and open dialogs don't list the network.  Thank you for your patience with a complete novice. Quote from: marcov on March 26, 2011, 01:38:23 pmAfaik applications can't open network paths at all under Linux. network paths need to be mount, either manually, or through some explorer equivalent ---------------------------------------------------------------------- Marc · 2011-03-28 09:38 Quote from: marcov on March 26, 2011, 01:38:23 pmAfaik applications can't open network paths at all under Linux. network paths need to be mount, either manually, or through some explorer equivalent If you have something like autofs running, then mounting is done automagically. At home I can cd to /net/machinename/sharename/subfolder ---------------------------------------------------------------------- TurboRascal · 2011-03-28 11:56 Quote from: Balf on March 28, 2011, 10:35:19 amI think Marcov had the answer in that it only works under Windows. Both marcov and I explained before that it only works in Windows. Since you went on with that, I assumed your work is in Windows... Now it's obvious it's not the case, and that explains your problem. Like i said, normal applications (also Tdbf/Lazarus) don't access the network paths, OS does that, and by which mechanism depends on the OS. What exactly OS are you using, Linux? If that's the case you MUST mount network path to the filesystem, either way marcov (mount or a VFS e.g. GVFS) and marc (autofs) explained... What OS uses the "server-side" computer? ---------------------------------------------------------------------- Balf · 2011-03-28 12:09 I have found the syntax by copying the path from my recent document list in openoffice writer... /home/peter/.gvfs/documents on sylvia/head/ I have no idea what .gvfs means but the shared folder is "head" in a folder with a sharename "documents" and the PC where it is is called "sylvia" It seems easier in xp where the path can be seen in explorer - but there you go! Thanks to everyone who replied, Peter I ---------------------------------------------------------------------- TurboRascal · 2011-03-28 12:43 Hmm, that's fine, but you cannot rely on a mechanism you do not understand. Another time it can happen the share won't be mounted there and you will find yourself wondering again. From what you said, I guess you are using Linux + Gnome? And the computer holding the file is either Windows machine another Linux machine with SAMBA? I'd advise you to learn a bit more about GVFS and SAMBA (and unix filesystems and networking if possible), to handle this easier... ---------------------------------------------------------------------- Balf · 2011-03-28 14:07 My machine is using Ubuntu 10  and the other machine (with the table on) is Windows xp sp3 on a home network - I will investigate GVFS Thanks again, Peter ---------------------------------------------------------------------- marcov · 2011-03-28 14:42 Quote from: Marc on March 28, 2011, 11:38:30 amQuote from: marcov on March 26, 2011, 01:38:23 pmAfaik applications can't open network paths at all under Linux. network paths need to be mount, either manually, or through some explorer equivalent If you have something like autofs running, then mounting is done automagically. At home I can cd to /net/machinename/sharename/subfolder But does it work without shell from programs? And what if the program does a "fileexists" instead just starting to read? ---------------------------------------------------------------------- Marc · 2011-03-28 18:52 works without shell (apache can access it) fileexists opens the containing dir, so I guess it works too ---------------------------------------------------------------------- TurboRascal · 2011-03-28 22:59 autofs indeed does work on file access level, shell doesn't have anything to do it; it's not something like explorer/nautilus stuff, it works on the OS VFS level...