Accessing split AOO Base from 2 PCs

dBase, Calc, CSV, MS ACCESS, MySQL, PostgrSQL, OTHER
Post Reply
rogmufa
Posts: 14
Joined: Fri Mar 06, 2015 5:22 pm
Location: Denmark

Accessing split AOO Base from 2 PCs

Post by rogmufa »

Hi,
I have been trying to search the Forum for this, but have got a bit confused.
I am running OO Base 4.1.13 as a SPLIT database on a Windows 10 PC (call it PC1)
I want to be able to access (read/write) the database from another PC (say PC2) on the same local net (same Windows 10 and OO Base). Preferably at the same time, but not necessarily.

I have arranged Windows file sharing, so PC2 can see the folder on PC1 where the database and all the files are stores (hsqldb.jar, mydb.data,
TKCbase.odb (let's call it) and others).

I start Base on PC2 and select ' Open an existing database file' and navigate to the file TKCbase.odb on PC1. All well so far.

If I try to open the Tables, I get the error message, " Can not create connection to data source TKCbase. (I am translating from Danish!)
Driver class org.hsqldb.jdbcDriver' can not be read in. The extra driver class path is (then it shows the path to the external file on PC2/hsqldb.jar)"
(this file is accessible from PC2 in the Windows explorer.)

It is strange that the names of the queries are visible on PC2, but - like the tables -they can't be opened.

Can anyone suggest what I need to do? Should I select 'Connect to an existing database (instead of existing database file) - and then a Data source URL?
Or do I need to get a jdbc driver on PC2? Why is it looking for the prefixed org.hsqldb... ?

Many thanks in advance!
Roger
Open Office 3.4.0 on Wnidows XP
FJCC
Moderator
Posts: 9284
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Accessing split OO Base from 2 PCs

Post by FJCC »

It has been many years since I did this sort of thing but I believe you have to set up the database in "server mode", i.e. have HSQLDB running separately from OpenOffice. This wiki may help
https://wiki.openoffice.org/wiki/FAQ_(Base)#HSQLDB
There is a section labeled "How do I setup multi-user 'server mode' access to my HSQL database?"
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
rogmufa
Posts: 14
Joined: Fri Mar 06, 2015 5:22 pm
Location: Denmark

Re: Accessing split OO Base from 2 PCs

Post by rogmufa »

Hi FJCC,
Many thanks for your quick reply. I have been looking at the article for 'server mode' etc. here https://wiki.openoffice.org/wiki/FAQ_(Base)#HSQLDB,
but I would like to understand what is going on before I try. Sorry, the post has got a bit long, but I need to be precise...

1. Host (PC1): I understand the database management system hsqldb has to be set up in server mode on the host PC (PC1). To do this I seem to have to "connect to en existing(!) database" using File-New-Database on PC1,
and then give the Data Source URL on the host PC1 , e.g.
hsqldb:file:/users/public/databases/mydb/mydb;default_schema=true;shutdown=true;hsqldb.default_table_type=cached;get_column_name=false
Question: What is the last element in this path ("mydb") - is it a folder or a file? If so, which file (extension not shown)?

2. Client (PC2): I seems I have to do File-New-Database and connect to an exixting database using e.g.
hsqldb:hsql://192.168.1.101/;default_schema=true;get_column_name=false
But how does PC2 know about where the database file is on PC1 (only the URL is given here) and how does PC2 know about the table data on PC1?
Then it gets more confusing when it states:
Each client must have a local copy of hsqldb.jar with the Class Path setup locally
But surely only there should only be one DBMS, that is hsqlbd.jar on the host?!

My question really is this:
a) is it right that there is only one DBMS which both PCs use, ie. hsqldb.jar on the host PC1?
b) is the table data on PC1 in the file mydb.data (or is it within the hsqldb.jar ??)
c) what is the last element in the path Data Source URL on the host PC1 ("mydb") - is it a folder or a file?
d) how PC2 see the table data on PC1 (there is a big file mydb.data in the same folder as hsqldb.jar)?
e) where are the queries stored, and how does PC2 know about them?

If anyone can give me an overview of the client-server business here, I would be very grateful!
Roger
Open Office 3.4.0 on Wnidows XP
User avatar
Greengiant224
Posts: 283
Joined: Wed Jun 09, 2010 3:50 pm
Location: All Over The World

Re: Accessing split OO Base from 2 PCs

Post by Greengiant224 »

There are many posts about server type settings in this forum - Have you searched for any?

Here is one post - does this help?

viewtopic.php?t=61183

Greengiant224

Win 7, Portable AOO 4.1.14, LibreOffice 6.2, 7.4.5 & 7.6.1 (Java 1.7.81 & 1.8.0_281) utilising HSQL 1.8.10 & 2.4.*, MySQL, PostgreSQL, SQLite
+ Blood, Sweat and Tears (Application, Determination and Perseverance)
FJCC
Moderator
Posts: 9284
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Accessing split OO Base from 2 PCs

Post by FJCC »

I just ran a test using a folder that had an hsqldb.jar file from some long forgotten test. Here are the steps I took on my Windows 10 system to run HSQLDB in server mode and connect to it locally. The first couple of steps were done long ago but must have happened.
1. Make a dedicated folder under Documents. I made mine Documents\DB\HSQLDB
2. Copy into it the hsqldb.jar file from C:\Program Files (x86)\OpenOffice 4\program\classes
3. Make a bat file named StartDB.bat with the following content to start the database. You will have to edit the javapath and jarpath settings to whatever is correct for your system.

Code: Select all

@echo off
set javapath=C:\Program Files (x86)\Java\jre-1.8\bin\java.exe
set jarpath=C:\Users\fjcc\Documents\DB\HSQLDB\hsqldb.jar
"%javapath%" -cp "%jarpath%" org.hsqldb.Server -database.0 file:mydb
exit
4. Make a bat file named StopDB.bat with the following content to stop the database. You will have to edit the javapath and jarpath settings to whatever is correct for your system.

Code: Select all

@echo off 
set javapath=C:\Program Files (x86)\Java\jre-1.8\bin\java.exe
set jarpath=C:\Users\fjcc\Documents\DB\HSQLDB\hsqldb.jar
"%javapath%" -cp "%jarpath%" org.hsqldb.util.ShutdownServer 
exit
5.Open the Command Prompt program, change the directory to the folder with the copy of the hsqldb.jar and run StartDB.bat. On my system, the two commands and resulting output were:

Code: Select all

C:\Users\fjcc>cd Documents\DB\HSQLDB
C:\Users\fjcc\Documents\DB\HSQLDB>StartDB.bat
[Server@d1a2f1]: [Thread[main,5,main]]: checkRunning(false) entered                                                     
[Server@d1a2f1]: [Thread[main,5,main]]: checkRunning(false) exited                                                      
[Server@d1a2f1]: Startup sequence initiated from main() method                                                          
[Server@d1a2f1]: Loaded properties from [C:\Users\fjcc\Documents\DB\HSQLDB\server.properties]       
[Server@d1a2f1]: Initiating startup sequence...                                                                         
[Server@d1a2f1]: Server socket opened successfully in 13 ms.                                                            
[Server@d1a2f1]: Database [index=0, id=0, db=file:mydb, alias=] opened sucessfully in 116 ms.                           
[Server@d1a2f1]: Startup sequence completed in 129 ms.                                                                  
[Server@d1a2f1]: 2023-08-09 10:38:50.397 HSQLDB server 1.8.0 is online                                                  
[Server@d1a2f1]: To close normally, connect and execute SHUTDOWN SQL                                                    
[Server@d1a2f1]: From command line, use [Ctrl]+[C] to abort abruptly  
6. Start OpenOffice and select the menu Tools -> Options. Expand the OpenOffice list on the left and select Java. Click Class Path. Click Add Archive and navigate to the folder you made that contains hsqldb.jar. Click on the jar file and then click Open. Exit from the dialogs and then restart OpenOffice.
7.Select the menu File -> New -> Database.
Select Option: Connect to an existing database
Select Connection type: JDBC
Press: Next >>
fill-in the 'Data Source URL' with hsqldb:hsql://localhost/;default_schema=true
fill in JDBC driver class with org.hsqldb.jdbcDriver
User name: SA
Password required: leave un-checked at this stage
8. Finish the process for making the new database by accepting the defaults.

You should now be able to make a table in the database in the normal way. To connect remotely you should have the same jar file on the remote computer. Change the data source URL to the URL of the PC hosting the server mode DB. The hsql service should connect you to the default database.
You stop the DB by opening another command prompt going to the folder containing the DB and executing StopDB.bat.

Try that and see if it works. I have not tried a remote connection.
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
rogmufa
Posts: 14
Joined: Fri Mar 06, 2015 5:22 pm
Location: Denmark

Re: Accessing split OO Base from 2 PCs

Post by rogmufa »

Hi FJCC,
Many thanks for the extensive example. I look forward to trying it when I get ack to the office, where I have the 2 PCs.

In the meantime, there is something decisive I don't understand:
You write To connect remotely you should have the same jar file on the remote computer.
and this corresponds to what I read in the previous link: Each client must have a local copy of hsqldb.jar with the Class Path setup locally
BUT this seems to defeat the whole idea of accessing/updating ONE database from 2 PCs. How does one maintain the 2 copies of hsqldb.jar synchronized after every table update...?!
I assume here that hsqldb.jar contains the DB engine AND the current tables with their data, and the forms and queries (although that does not explain the presence of the really big mydb.data file in the same folder).

Sorry, but I'm still confused.
Roger
Open Office 3.4.0 on Wnidows XP
User avatar
Greengiant224
Posts: 283
Joined: Wed Jun 09, 2010 3:50 pm
Location: All Over The World

Re: Accessing split OO Base from 2 PCs

Post by Greengiant224 »

rogmufa:
I assume here that hsqldb.jar contains the DB engine AND the current tables with their data, and the forms and queries (although that does not explain the presence of the really big mydb.data file in the same folder).
No, the hsqldb.jar contains the DB engine only.

The following is a short synopsis of what happens when you use a server mode system.
The .odb (front-end, contains the form/s, queries and reports) reads the ".script" and ".properties" files to open the connection.
The tables and the data they contain are populated from the ".data" file.
(i.e. the ".data" and ".backup" files are binary, the ".backup" is a compressed version)

Have you searched for server mode posts?

https://forum.openoffice.org//en/forum/ ... 67#p162653

Greengiant224

Win 7, Portable AOO 4.1.14, LibreOffice 6.2, 7.4.5 & 7.6.1 (Java 1.7.81 & 1.8.0_281) utilising HSQL 1.8.10 & 2.4.*, MySQL, PostgreSQL, SQLite
+ Blood, Sweat and Tears (Application, Determination and Perseverance)
rogmufa
Posts: 14
Joined: Fri Mar 06, 2015 5:22 pm
Location: Denmark

Re: Accessing split OO Base from 2 PCs

Post by rogmufa »

Hi Greengiant,
Many thanks for contributing to this subject. I have indeed looked in some of the posts about server mode - including the one you mention. But I get overwhelmed with the details and can't get an overview.
I have not seen a synopsis like the one you sent - so many thanks for that. It explains some things for me.

But I am still confused about what actually is the 'front end' and the 'back end' in OOBase context.
I am familiar with front/backend configurations - e.g. MySQL as backend and a Java program as frontend - but there the frontend is stored and runs on the client machine and communicates with the backend using SQL commands over a connection.

So I still have these questions. Maybe you have time to help:
a) But what happens with Base? You state that the 'frontend' file is mydb.odb - but this is stored on the host/sever machine - and read/used/? by the client! Is that rightly understood?
b) Do I need to have anything (frontend things) installed/copied to the client machine? (It seems strange that I apparently have to have the db engine hsqldb.jar also installed on the client machine!).

If there is an overall summary of the (server-mode) front/backend architecture, it would help a lot.

Regards
Roger
Open Office 3.4.0 on Wnidows XP
User avatar
robleyd
Moderator
Posts: 5087
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: Accessing split OO Base from 2 PCs

Post by robleyd »

You state that the 'frontend' file is mydb.odb
This is the Base .odb application, you may be confusing it with e.g. mydb the actual database.
Cheers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.2.2; SlackBuild for 24.2.2 by Eric Hameleers
FJCC
Moderator
Posts: 9284
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Accessing split OO Base from 2 PCs

Post by FJCC »

@rogmufa - Here is my understanding of how this works. The database is run only on the host machine and the code for the DB engine is in hsqldb.jar. If you start the DB engine separately from Base, as explained previously, it is running as normal, independent database software. You can then connect to that database using Base, just as you can connect to a MySQL instance or any other DB. That connection is done through a JDBC driver. That driver is also stored in hsqldb.jar. Any client machine needs hsqldb.jar to access the jdbc driver appropriate for the database version running on the host system.
It's important to know that hsqldb.jar contains not just the DB engine but also other tools needed to use the database. It contains a simple front end tool that can be launched with

Code: Select all

java -cp hsqldb.jar org.hsqldb.util.DatabaseManager
and there may be other things that I don't know about.
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Accessing split OO Base from 2 PCs

Post by Villeroy »

The frontend is LibreOffice with its queries, forms, reports and connected stand-alone documents.
I distinguish between different backend categories:

- File based (pseudo-) databases such as text files, spreadsheets and dBase with limited functionality. Good enough for mail merge, filtering and sorting.

- Connections to the files of some relational database such as HSQL (jdbc:hsqldb:file:path/file_name) or H2 SQLite, MS Access and others. These database connections are writable by a single user. Subsequent users connecting to the same set of database files get read-only access.

- Embedded databases (HSQL and with LibreOffice also Firebird) are a special case of the former because the files of an embedded database are "installed" to a temporary directory and wrapped back at the end of an editing session.

- Connections to some database server such as MySQL, PostgreSQL but also HSQL, H2 and many others. A database server is a continuously running program waiting for requests from clients. Database servers do handle sessions with all the implications of simultanious multi-user access (for instance jdbc:hsqldb:hsql:host/db_name).
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
robleyd
Moderator
Posts: 5087
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: Accessing split OO Base from 2 PCs

Post by robleyd »

If you haven't already done so, you might find it useful to look at the HyperSQL User Guide
Cheers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.2.2; SlackBuild for 24.2.2 by Eric Hameleers
rogmufa
Posts: 14
Joined: Fri Mar 06, 2015 5:22 pm
Location: Denmark

Re: Accessing split OO Base from 2 PCs

Post by rogmufa »

Many thanks to all here - especially FJCC: I used the formula you wrote on 09 Aug using localhost access (StartDB.bat, StopDB.bat, Data source URL and JDBC Driver class) and reproduced the result! Now I look forward to trying remote access when I get to the office with 2 PCs!
I now see why the client needs to have hsqldb.jar - to get the driver.

In the meantime, a couple of things puzzle me:
1. In this case, I don't see any mydb.data file in the folder with mydb.odb (which Greengiant224 writes The tables and the data they contain are populated from the ".data" file.).
2. The database mydb.odb seems to be created when I run StartDB.bat for the first time, presumably because the file contains the parameter -database.0 file:mydb - is that rightly understood?
3. I am thinking of putting the StartDB.bat file in the Windows automatic startup. Is there any need to use the StopDB.bat file? I guess the DB stops when the (host) PC is closed down.

Thanks for now,
Roger
Open Office 3.4.0 on Wnidows XP
rogmufa
Posts: 14
Joined: Fri Mar 06, 2015 5:22 pm
Location: Denmark

Re: Accessing split OO Base from 2 PCs

Post by rogmufa »

PS from Roger,
Re. my question 2: I actually want to expose an existing database (say mydb.odb) on the host for remote access. If the database mydb.odb exists before I run StartDB.bat I suppose that a new db is not created.

I seems strange that the Data source URL (on the client) does not need to mention the actual database (here mydb.odb) or the path to it - only the PCs URL. So it seems that the StartDB.bat file starts the server, but only with respect to a predefined instance of a database. Then, requests to the URL of the server only get responses from the one database mydb.odb. Is that right?
(I only need to expose one database, so this is OK here).
Regards
Roger
Open Office 3.4.0 on Wnidows XP
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Accessing split OO Base from 2 PCs

Post by Villeroy »

rogmufa wrote: Wed Aug 16, 2023 6:16 pm Many thanks to all here - especially FJCC: I used the formula you wrote on 09 Aug using localhost access (StartDB.bat, StopDB.bat, Data source URL and JDBC Driver class) and reproduced the result! Now I look forward to trying remote access when I get to the office with 2 PCs!
I now see why the client needs to have hsqldb.jar - to get the driver.

In the meantime, a couple of things puzzle me:
1. In this case, I don't see any mydb.data file in the folder with mydb.odb (which Greengiant224 writes The tables and the data they contain are populated from the ".data" file.).
Set up the configuration file server.properties so the server finds the right files in the right place. The following sample specifies a set of database files E:/Daten/hsql/database/Praxis.data, E:/Daten/hsql/database/Praxis.properties, E:/Daten/hsql/database/Praxis.script etc.

Code: Select all

server.database.0=file:E:/Daten/hsql/database/Praxis;ifexists=true
server.dbname.0=Praxis

server.address=192.168.15.2
server.acl=E:/Daten/hsql/acl.txt
The access control list acl.txt allows local clients only.

Code: Select all

allow 127.0.0.1
allow 192.168.15.0/24
2. The database mydb.odb seems to be created when I run StartDB.bat for the first time, presumably because the file contains the parameter -database.0 file:mydb - is that rightly understood?
No, this is misunderstood.
3. I am thinking of putting the StartDB.bat file in the Windows automatic startup. Is there any need to use the StopDB.bat file? I guess the DB stops when the (host) PC is closed down.
Windows does not run any Java program as a service, so you don't get any shutdown routines, logging facilities etc. Java is enemy to MS. Therefore, you will crash the database process when shutting down the system.
On a normal operating system, you can start the script that is shipped with hsql as a system service before any user log-in. The program will log its events to the system log, and it will be shut down cleanly with the system.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
rogmufa
Posts: 14
Joined: Fri Mar 06, 2015 5:22 pm
Location: Denmark

Re: Accessing split OO Base from 2 PCs

Post by rogmufa »

Hi FJCC,
(Now at last I have access to the 2 PCs at my client's office) I used the formula you wrote on 09 Aug using localhost access (StartDB.bat, StopDB.bat, Data source URL and JDBC Driver class) and reproduced the result on the 'server' PC.

Now over to the 'client' PC (where OO 4 is installed): I did these steps (adapted from the 'server' formula):
Start OO. Select the menu File -> New -> Database.
Select Option: Connect to an existing database
Select Connection type: JDBC
Press: Next >>
fill-in the 'Data Source URL' with hsqldb:hsql://192.168.1.200/;default_schema=true
fill in JDBC driver class with org.hsqldb.jdbcDriver
User name: SA
Password required: leave un-checked at this stage
Finish the process for making the new database by accepting the defaults.

I am sure the URL of the 'server' PC is 192.168.1.200.
BUT the problem is that OO gives the error message: 'JDBC driver could not be accessed' (in Danish!). Do I have to set any paths up?
I am sure that the hsqldb.jar in C:\Program Files (x86)\OpenOffice 4\program\classes exists. I assume this is what you mean by "To connect remotely you should have the same jar file on the remote computer. ". It is of course not the same physical file as hsqldb.jar on the 'server', but it just came when installing the OO package on the 'client'.

Any help will be most appreciated!
Roger
Open Office 3.4.0 on Wnidows XP
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Accessing split OO Base from 2 PCs

Post by Villeroy »

1. Your URL is wrong because there is no database name.
2. There is an important option missing in Base's graphical user interface which is why the driver can not be found.

Save the following Basic macro under "My Macros" and fill out the constants, e.g. the server name or its IP (cURL_Path), the database name as setup in your server config (cURL_DBName) and the path to the driver file (cJarPath).

Code: Select all

REM  *****  BASIC  *****

Sub Connect_JDBC_Backend()
REM This mini version of my FreeHSQLDB macro should be able to reconnect
REM a database document with any type of JDBC connection (HSQL, MySQL or other)
REM if you set up the right constants for a valid URL, a driver path and class name

oDoc = ThisDatabaseDocument ' this code is embedded in the odb
REM oDoc = ThisComponent ' this code is not embedded in the odb

REM-------- Database Location (URL) --------------------
REM protocol prefix refering to a set of files
REM Const cURL_Prefix = "jdbc:hsqldb:file:"
REM protocol prefix refering to a database server
Const cURL_Prefix = "jdbc:hsqldb:hsql:"

REM file path or server name with trailing slash
REM in case of cURL_Prefix = "jdbc:hsqldb:file:"
REM Const cURL_Path = "C:\path\hsqldb\DUMMY"
REM HSQL on Windows accepts strange URLs with slashes or with backslashes such as
REM Const cURL_Path = "C:\Users\UserName\HSQLDB\"
REM local files on a Linux sytem:
REM Const cURL_Path = "/var/hsql/database/"

REM in case of cURL_Prefix = "jdbc:hsqldb:hsql:" we specify a server name or IP address
REM Const cURL_Path = "//ServerName/"
Const cURL_Path = "//192.168/178.1/"

REM Either the database name is set up by a remote server if cURL_Prefix looks like "jdbc:hsqldb:hsql:
REM if cURL_Prefix looks like "jdbc:hsqldb:file:" the nae refers to a set of files starting with the same prefix
REM DatabaseName.properties DatabaseName.script DatabaseName.data etc.
Const cURL_DBName = "DUMMY" 'file name prefix or database name defined on server side

REM options that turned out to be useful with HSQL (see HSQL documentation)
Const cURL_Options = ";default_schema=true;shutdown=true;hsqldb.default_table_type=cached;get_column_name=false"
REM JDBC connections other than hsql may support other options
REM or none at all:
REM cURL_Options = ""

REM--------- Database Driver -------------------
REM use system notation for the local HSQL driver
Const cJarPath = "C:\path\hsqldb-2.4.1.jar"
REM the "ability" used by the JDBC driver when used with a client:
Const cClass = "org.hsqldb.jdbcDriver"

REM user name logging in at the JDBC database
Const cUser = "SA"

REM does the JDBC connection require any password?
Const cPwdRequired = False

REM if you insist in storing the password in the Base document (which is a security issue)
cPWD = ""

on error resume next
   oDoc.CurrentController.ActiveConnection.close()
on error goto 0
oDataSource = oDoc.DataSource
oDataSource.URL = cURL_Prefix & cURL_Path & cURL_DBName & cURL_Options
With oDataSource.Settings
   .JavaDriverClass = cClass
   .JavaDriverClassPath = ConvertToURL(cJarPath)
End With
oDataSource.User = cUser
oDataSource.IsPasswordRequired = cPWDReq
oDataSource.Password = cPwd
End Sub
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
rogmufa
Posts: 14
Joined: Fri Mar 06, 2015 5:22 pm
Location: Denmark

Re: Accessing split OO Base from 2 PCs

Post by rogmufa »

Hi Villaroy,

Many thanks.
Re. 1: I don’t understand why it worked on the localhost using just the GUI and
'Data Source URL' as hsqldb:hsql://localhost/;default_schema=true
(i.e. no database name here)
and
JDBC driver class as org.hsqldb.jdbcDriver
(i.e. there was no complaint about not finding the driver).

Re. 2: What is the missing option in the graphical interface? The connection works on the local host using only the GUI.

Many thanks for your advice. The macro seems very complicated – I hoped I was just missing one little parameter! Anyway, I am going to try running the macro and setting as you advise:
Const cURL_Path = "//192.1681.200/"
and
Const cURL_DBName = "mydb"
(this was the name as defined in the StartDB.bat file:
set jarpath=C:\Users\fjcc\Documents\DB\HSQLDB\hsqldb.jar
"%javapath%" -cp "%jarpath%" org.hsqldb.Server -database.0 file:mydb
)
and
Const cJarPath = "C:\Program Files (x86)\
OpenOffice 4\program\classes\hsqldb.jar"

Does this look OK? Do I need to set any other constants before I run the macro?

It would actually be easier to understand if I could avoid a macro and just set the missing parameter(s). But maybe it can’t be done using the GUI (although it worked at the localhost).

Best regards – and thanks!
Roger
Open Office 3.4.0 on Wnidows XP
rogmufa
Posts: 14
Joined: Fri Mar 06, 2015 5:22 pm
Location: Denmark

Re: Accessing split OO Base from 2 PCs

Post by rogmufa »

Hi again Villeroy,

I have modified your macro file with:
Const cURL_Path = "//192.1681.200/"

Const cURL_DBName = "mydb"

Const cJarPath = "C:\Program Files (x86)\OpenOffice 4\program\classes\hsqldb.jar"

I don't know if I need
oDoc = ThisComponent - but I get I get ' Datasource not found' at this line oDataSource = oDoc.DataSource
or oDoc = ThisDatabaseDocument - but here I get the same error.

But in what context do I run the macro?
a) If I run it from the main upstart OO window (without selecting Database) I get 'not found' error at this line
oDataSource = oDoc.DataSource
b) If I select Database in the main window, I have to decide on a new db, eller connect to existing. So I selected New and called it e.g. New2, then ran the macro within the new (empty) database. But then I still get ' Datasource not found' at this line
oDataSource = oDoc.DataSource

I hope you can help.
Best regards
Roger
Open Office 3.4.0 on Wnidows XP
rogmufa
Posts: 14
Joined: Fri Mar 06, 2015 5:22 pm
Location: Denmark

Re: Accessing split OO Base from 2 PCs

Post by rogmufa »

PS (Roger here again!)
If I create a new database and this time call it mydb, and then run the above macro, I get no error message from the macro,
but when I click on Tables I get 'Cannot make connection to data source "mydb"'.
I have of course run StartDB.bat on the 'server' PC.
Regards
Roger
Open Office 3.4.0 on Wnidows XP
rogmufa
Posts: 14
Joined: Fri Mar 06, 2015 5:22 pm
Location: Denmark

Re: Accessing split OO Base from 2 PCs

Post by rogmufa »

Hi again (all the helpful contributors!),

I think I must be near a solution, but I don't know how to proceed. Any help would be appreciated.

Summary so far:
- I used the formula FJCC wrote on 09 Aug using localhost access (StartDB.bat, StopDB.bat, Data source URL and JDBC Driver class) and reproduced the result on the 'server' PC.
- I ran StartDB.bat on the 'server' PC.
- I modified Villeroy's macro with:
Const cURL_Path = "//192.1681.200/"
Const cURL_DBName = "mydb"
Const cJarPath = "C:\Program Files (x86)\OpenOffice 4\program\classes\hsqldb.jar"
(I don't know how to decide whether I need oDoc = ThisComponent or or oDoc = ThisDatabaseDocument)
- On the 'client PC: I created a new database and called it mydb, and then ran the above macro. I got no error message from the macro, but when I click on Tables I got 'Cannot make connection to data source "mydb"'.

(I can 'ping' the 'server' at 192.1681.200 from the client, so the PCs can see each other).

Regards
Roger
Open Office 3.4.0 on Wnidows XP
Mountaineer
Posts: 318
Joined: Sun Sep 06, 2020 8:27 am

Re: Accessing split AOO Base from 2 PCs

Post by Mountaineer »

As Villeroy already wrote: your URL to the db is to short:
cURL_Path = "//192.1681.200/ is like delivery at EmpireStateBuilding without knowing name or appartment.

cURL_Path = "//192.1681.200/C:/Users/somebody/data/
is more likely - i guess you need the folder of the file here.

And check in explorer, if you have access to this file from remote. You may need to save the password for network access... If you don't have access in explorer, you will fail with database access also...
OpenOffice 3.1 on Windows Vista
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Accessing split AOO Base from 2 PCs

Post by Villeroy »

Edit>Database>Properties...
Bildschirmfoto von 2023-09-27 12-24-37.png
Bildschirmfoto von 2023-09-27 12-24-37.png (28.31 KiB) Viewed 5002 times
We connect via jdbc using the hsqldb driver using the server connection protocol hsql: (contrary to file:). The server should be up and running on 192.168.15.2, listening to port 9001. If you configured another port number, say 9101, use 192.168.15:9101 instead.
On that server we request a sesstion with the database named "Praxis" (as specified in the file server.properties on the server). The arguments behind the semicolon specify some additional things that have been proven useful when used with Base. But you can omit these arguments and get a connection anyway.
By default, the HSQL server listens on port 9001. If that port is not availlable, used by another server program, your start script will not start properly. Your firewall or router may block that port number.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Accessing split AOO Base from 2 PCs

Post by Villeroy »

On the server side (Windows), get a terminal and run
netstat -ano > netstat.txt

Open netstat.txt with a text editor and find a line like this:
TCP 192.168.15.2:9001 0.0.0.0:0 LISTENING 6308

This machine 192.168.15.2 listens to a tcp connection on port 9001. The last number is the process ID of the running hsql server as shown in the Windows task manager on the "Details" tab for the java.exe.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
rogmufa
Posts: 14
Joined: Fri Mar 06, 2015 5:22 pm
Location: Denmark

Re: Accessing split AOO Base from 2 PCs

Post by rogmufa »

Hi Villeroy,,
Thanks for the advice. On the server I ran StartDB.bat and I can see in netstat:
TCP 192.168.1.200:53167 95.166.124.186:443 ESTABLISHED 11220
(other lines...)
TCP [::]:9001 [::]:0 LISTENING 3212
- so it seems the server is listening. (I don't have a file server.properties, so I guess the default port is being used).

However, when I try to reproduce your DB properties dialog on a new database mydb.odb on the client i get "JDBC-driver not found" - whether I use the text as in your dialog or the full path: C:\Program Files (x86)\OpenOffice 4\program\classes\hsqldb.jar (and I am sure the hsqldb.jar file exists here!).

I guess you are advising to use the Properties dialog in stead of the macro which you sent me.

[TO 'Mountineeer': Thanks for the advice, but the path to the mydb.odb on the server is specified in the StartDB.bat file which I run on the server:
set jarpath=C:\Users\info\Documents\DB\HSQLDB\hsqldb.jar
"%javapath%" -cp "%jarpath%" org.hsqldb.Server -database.0 file:mydb
- so it does not seem necessary to be specified in the client - and Villeroy's macro and Properties dialog do not refer to the path.
]

Regards
Roger
Open Office 3.4.0 on Wnidows XP
Post Reply