[Solved] Datasource URL in Windows?

Discuss the database features

[Solved] Datasource URL in Windows?

Postby amanchesterman » Sat Apr 20, 2013 7:51 pm

I'm embarrassed to ask this question, I'm sure the answer is elementary and I'm missing something obvious: but I need help to enter the correct Datasource URL in database properties.

The situation is that I have a split-file database containing data from a survey which works perfectly on my Linux laptop. I want to use it on another laptop running Windows XP since that machine is faster (more memory etc.).

On the Windows machine I have
a) copied across the database folder and files;
b) set up the hsqldb class path;
c) opened the survey.odb file.

I can see the forms and queries, but I can't see any of the tables -- which of course indicates that the datasource url is incorrect. So I have done Edit>Database>Properties, and of course the url shows the path for the database in the Linux file structure and that needs to be changed. My question is, what do I change it to?

I have tried C:\Documents and Settings\John\Database\ , C:\My Documents\Database, and both of those with forward rather than reverse slashes -- but none of them work. The tutorial I have been following refers to C:/users/public/databases, but that doesn't look like a Windows XP path to me ... and in any case that doesn't work either. Can anyone who uses Windows XP advise me what the correct path should look like?

Many thanks, John
Last edited by Hagar Delest on Sun Apr 21, 2013 11:57 am, edited 1 time in total.
Reason: tagged [Solved].
OpenOffice 3.4.1, Ubuntu Linux 12.04 LTS
amanchesterman
 
Posts: 10
Joined: Sat Mar 30, 2013 9:48 am

Re: Datasource URL in Windows?

Postby Greengiant224 » Sat Apr 20, 2013 9:22 pm

amanchesterman:
I'm embarrassed to ask this question, I'm sure the answer is elementary and I'm missing something obvious: but I need help to enter the correct Datasource URL in database properties.


Do not be embarrassed to ask this can be a difficult question to answer.

The situation is that I have a split-file database containing data from a survey which works perfectly on my Linux laptop. I want to use it on another laptop running Windows XP since that machine is faster (more memory etc.).


As I understand, you have a single user file mode hsqldb, yes?

On the Windows machine I have
a) copied across the database folder and files;
b) set up the hsqldb class path;
c) opened the survey.odb file.


So, clicking the Test Class Path button, the hsqldb class path works?

The tutorial I have been following refers to C:/users/public/databases, but that doesn't look like a Windows XP path to me


It is specific to the DACM tutorials, but is used in server mode where access to the backend is available to all users.
It is an accepted path as is C:\Databases for the user or C:\Public\ for multi-users.

I can see the forms and queries, but I can't see any of the tables -- which of course indicates that the datasource url is incorrect. So I have done Edit>Database>Properties, and of course the url shows the path for the database in the Linux file structure and that needs to be changed. My question is, what do I change it to?


Under linux and windows the ~/ at the beginning of the datasource url refers to the current user.
i.e. in linux = /home/<username>/ and in windows c:\users\<username>
therefore it is universal.

Back to your main question of what the path should look like.

hsqldb:file:c:\path\to\your\survey; survey is the name of your database.
You will notice the use of the backslash (' \ ') in the path you can use backslash or forward slash, both are acceptable.

One last check, have you enabled the hsqldb.jar in Tools>>Options>>Java>>ClassPaths?

Hope this helps.

Greengiant224

Win 7, AOO 4.1.6, LibreOffice 6.1.* (Java 1.8.0_181) utilising HSQL 1.8.10 & 2.4.*, MySQL, PostgreSQL, SQLite
+ Blood, Sweat and Tears (Application, Determination and Perseverance)
User avatar
Greengiant224
 
Posts: 276
Joined: Wed Jun 09, 2010 3:50 pm
Location: All Over The World

Re: Datasource URL in Windows?

Postby DACM » Sat Apr 20, 2013 11:29 pm

amanchesterman wrote:...I need help to enter the correct Datasource URL in database properties...I have a split-file database containing data from a survey which works perfectly on my Linux laptop. I want to use it on another laptop running Windows XP...

You'll make a good test subject for cross-platform support of portable 'split' database-folders. Backup your database folder and proceed with...

Follow these steps to make your 'split' database-folder portable (automatic Data Source and Class Path setup). In your case, you can download mydb_wizard.odb for future databases and reference purposes, but you'll also want to copy the listed macro-code to your own .odb file (mydb.file.odb) and set it to auto-run using: Tools > Customize > Events > Open Document. Also add hsqldb.jar to your database-folder as described. That way, you'll keep all your front-end components like Queries, Forms, Reports and Macros intact, while your upgraded .odb will support database-folder portability.

So now you can skip all the manual steps when moving your dedicated 'split' database-folder among computers, except the new step to enable macros in *Office: Tools > Options > *Office > Security > Macro Security > Medium (or 'Low' as desired).
AOO 4.1.x; LO 4.2.x; Windows 7/8 64-bit
Warning: Avoid embedded databases --> Solution: Adopt a portable 'split database' folder
Soli Deo gloria
User avatar
DACM
Volunteer
 
Posts: 1138
Joined: Tue Nov 03, 2009 7:24 am

[Solved] Datasource URL in Windows?

Postby amanchesterman » Sun Apr 21, 2013 9:18 am

Greengiant and DACM, thank you both for your patient and clear explanations!

@ Greengiant: Yes, it's a single-user file-mode hsqldb and when I click the Test Class Path button it works fine. The clue in your answer that enabled me to solve the problem was that you made clear that the backwards slash '\' should be used in Windows file paths and the url should include the full path to the database file. So (for anyone else who faces this problem) I opened up Windows Explorer, found the survey file -- and there in the address bar at the top of the Explorer window the full path to the file is displayed. I simply copied-and-pasted that path into the url, and the database now works perfectly. Thanks very much!

@ DACM: I was aware of your recent tutorial but I didn't think that it applied to my situation because it's entitled 'how to create a new split-file database' -- and mine already exists. However I'm willing to be a 'test subject' if that will help, I have another computer (a Windows 7 PC) that I could copy the database to, although I don't really need it on that machine.
To be clear about what I have to do: as I understand the instructions in your post above, I should:
a) copy the macro code in your tutorial into my file (survey.odb) on the Linux machine and set it to auto-run;
b) add hsqldb.jar to the database folder on the Linux machine;
c) on the Windows 7 machine, set the security level for macros to run;
d) copy the whole database folder from the Linux machine to the Windows 7 PC.
Is that correct?

Again, many thanks
John
OpenOffice 3.4.1, Ubuntu Linux 12.04 LTS
amanchesterman
 
Posts: 10
Joined: Sat Mar 30, 2013 9:48 am

Re: [Solved] Datasource URL in Windows?

Postby DACM » Sun Apr 21, 2013 3:15 pm

amanchesterman wrote:...Is that correct?

Yup

And if you wouldn't mind, on the Linux machine...
1. make a backup of the database folder (for safe keeping of your original for test purposes)
2. add the macro to survey.odb in the backup folder
3. enable macros
4. test run survey.odb in the backup folder
5. then move the backup folder to the Windows machines and test run with macros enabled

It's really the Linux machine that we're testing here for cross-platform support, but it would be nice to get your field test across all three machines (Linux, Win XP, Win 7).

And thank you for testing!
AOO 4.1.x; LO 4.2.x; Windows 7/8 64-bit
Warning: Avoid embedded databases --> Solution: Adopt a portable 'split database' folder
Soli Deo gloria
User avatar
DACM
Volunteer
 
Posts: 1138
Joined: Tue Nov 03, 2009 7:24 am

Re: [Solved] Datasource URL in Windows?

Postby amanchesterman » Sun Apr 21, 2013 7:39 pm

Test completed and 100% successful. My survey database incorporating your modifications runs fine with OpenOffice 3.4.1 on Linux Ubuntu, LibreOffice 3.6.6 on Windows XP, and LibreOffice 4.0.1.2 on Windows 7. DACM, I take off my hat to you! :super:

Good wishes
John
OpenOffice 3.4.1, Ubuntu Linux 12.04 LTS
amanchesterman
 
Posts: 10
Joined: Sat Mar 30, 2013 9:48 am


Return to Base

Who is online

Users browsing this forum: No registered users and 4 guests