h2 & linux. how to start the database? - database

sorry im rather new to linux ubuntu. i have an application that i made that runs with tomcat and connects to an h2 database. it all works fine on my windows laptop. im now moving it onto my linux computer to run all the time. but im having trouble with starting the database. i have downloaded h2 from their website. and its sitting on my desktop.
the question is. how to start the database.
and is their any other commands i need to know to run and operate it.
thankyous

The H2 database supports different modes:
You can use H2 in embedded mode using a database URL of the form jdbc:h2:~/test. This is the easiest case. In that case the database is running within the same process as your application is running, and you don't have to start a separate process just for the database.
You can use H2 in server mode. In that case you need to start a separate server process. But for your case it doesn't sound like you need this, right?
H2 also supports mixed mode (half embedded / half server), and the automatic mixed mode.
For details, see the H2 documentation about Connection Modes.

Is this what you are looking for?
https://groups.google.com/forum/?fromgroups=#!topic/h2-database/r-qRnskN0eQ

Open terminal in bin directory of h2 database and write these commands...
chmod +x h2.sh
./h2.sh
Click here for more information (similar thread)...

Related

Configure OM2M to connect to the server

https://wiki.eclipse.org/OM2M/one/Advanced_DB
I am developing an IoT project based on Eclipse OM2M project. I've been trying to do the same thing as the tutorial above did in the "Run H2 in another mode" part. In the tutorial, it said that the default database(h2) was running in embedded mode. My goal was to run the h2 database in server mode as the tutorial above did.
In h2 database part:
I started a TCP server using command
java -jar h2-1.4.196.jar -webAllowOthers -tcpAllowOthers
and it showed that the TCP server is running at tcp://127.0.1.1:41903
(The port may change every time I started a new TCP server). After I successfully started the server, I tested the connection using the web console of h2 so I think my h2 server was started correctly.
In OM2M part:
I modified some configurations in the config.ini file as below:
org.eclipse.om2m.dbUrl=jdbc:h2:tcp://127.0.1.1:41903/~/indb (set
database url) org.eclipse.om2m.dbUser=sa (set database user)
org.eclipse.om2m.dbPassword= (no database password)
However, when I ran sh start.sh in cmd to start the CSE, there were always errors shown in the picture below:
Since there's only a few information in the tutorial, I don't really know if I configure the file wrong. It seems like OM2M was not able to find my h2 database.
Can anyone tell me where I did it wrong?

Search in all project files on remote host in PhpStorm

I have lots of files in a project on a remote host and I want to find out from which file another php file is called. Is it possible to use Ctrl+Shift+f search on a remote host project?
Is it possible to use Ctrl+Shift+F search on a remote host project?
Currently it's not possible. (2022-06-09: now possible with remote development using JetBrains Gateway, see at the end)
In order to execute search in a file content in a locally run IDE such file must be read first. For that the IDE must download it... which can be quite time & connection consuming task for (S)FTP connections (depends on how far the server is; how fast your connection; bandwidth limits etc.)
Even if the IDE could do it transparently for search like it does with Remote Edit functionality (where it downloads a remote file but instead of placing it in the actual project it stores it in a temp location) it still needs to download it.
If you execute one search (one term) and then need to do another search (slightly modified term or completely different search string) the IDE would need to re-download those files again (waste of time and connection).
Therefore it makes much more sense to download your project (all or desired files only) locally and then execute such search(es) on local files.
If it has to be purely remote search (when nothing gets downloaded locally)... then you just establish SSH/RDP/etc connection to that remote host (BTW: PhpStorm has built-in SSH Console functionality) and execute such search directly on the remote server with OS native tools (find/grep and alike) or some remote software (e.g. mc or notepad++).
P.S. (on related note)
Some of the disadvantages when doing Remote Edit: https://stackoverflow.com/a/36850634/783119
EDIT 2022-06-09:
BTW, JetBrains now has JetBrains Gateway for remote development where you run the IDE core on a remote server and connect to it via SSH using a local dedicated app or a plugin to your IDE (PhpStorm comes bundled with such a plugin since 2021.3 version).
To check more on JetBrains Gateway:
https://www.jetbrains.com/remote-development/gateway/
https://blog.jetbrains.com/blog/2021/11/29/introducing-remote-development-for-jetbrains-ides/

db2 database creation

I installed db2 client in my system for personal use. I am not able to understand from where to create the database so that i can create tables on that db and play around with sql queries as of now.
This is totally related to my personal use and learning purpose.
Please inform how to create a dummy database and play around with it with db2 client?
Regards,
Are you on Windows? Are you using DB2 Express-C? I'm assuming you are, since you say this is for personal work.
After you have the DB2 binaries installed, you should have been prompted with the "DB2 First Steps" application, where you could have the application go through a GUI to create the database for you. If you missed it, you should be able to find it in your start menu with Start -> Programs -> IBM DB2 -> DB2COPY1 (Default) -> Set-up Tools -> First Steps.
If you prefer the command line, you can use the following:
First, determine if your installation created a default instance (on Windows, this will be called DB2) by using the db2ilist command. In the DB2 Command Window, if you're not on the instance you want to create a database in, you can switch with the following command:
set db2instance=DB2
Be sure to not include spaces around the equal sign.
Now, in order to create a database in the current instance, you use this command:
db2 create database mydatbase
For further reading, IBM has produced a Getting Started ebook, and I would highly recommend you check it out!
The DB2 client is just that - a client only. It does not include the database engine.
To create a database you have to install the server. The server includes the client portions.

Running batch file remotely using Hudson

What is the simplest way to schedule a batch file to run on a remote machine using Hudson (latest and greatest version)? I was exploring the master slave setup. I created a dumb slave but I am not sure what the parameters should be so that I can trigger the batch file in the remote slave machine.
Basically, I am trying to run 2 different batch files on two different remote machines sequentially, triggered from my machine (the master). The Step by step guide on the Hudson website is a dead link. There are similar questions posted on SO but it does not quite work for me when I use the parameters they mention.
If anyone has done something similar please suggest ways to make this work.
(I know how to set up jobs, and add a step to run a batch file etc what I am having trouble configuring is doing this on a remote machine using hudson in built features)
UPDATE
Thank you all for the suggestions. Quick update on this:
What I wanted to get done is partially working, below are the steps followed to get to it -
Created new Node from Manage Nodes -> New Node -> set # of Executors as 1, Remote FS root set as '/var/hudson', set Launch method as using JNLP, set slavename and saved.
Once slave was set up (from master machine), I logged into the Slave physical machine, I downloaded the _slave.jar from http://masterserver:port/jnlpJars/slave.jar, and ran the following from command line at the download location -> java -jar _slave.jar -jnlpUrl http://masterserver:port/computer/slavename/slave-agent.jnlp. The connection was made successfully.
Checked 'Restrict where this project can be run' in the Master job configuration, and set paramater as slavename.
Checked "Add Build Step" for adding my batch job script
What I am still missing now is a way to connect to 2 slaves from one job in sequence, is that possible?
It is fairly easy and straight forward. Lets assume you already have a slave running. Then you configure the job as if you are locally on the target box. The setting for Restrict where this project can be run needs to be the node that you want to on. This is all for the job configuration.
For the slave configuration read the following pages.
Installing Hudson as a Windows service
Distributed builds
On windows I prefer to run the slave as a service and let the remote machine manage the start up and shut down of the slave. The only disadvantage with this is, you need to upgrade the client every time you update the server Just get the new client.jar from the server, after the upgrade and put it on the slave. Then restart the slave and you are done.
I had troubles using the install as a service option for the slave even though I did it as a local administrator. I used then srvany to wrap the jar into a service. Here is a blog about it. The command that you need to wrap, you will get from your Hudson server from the slave page. For all of this to work, you should set up the slave management as jnlp.
If you have an ssh server on your target machine, you can use the ssl slave settings. These work for me like a charm. I use them with my unix slaves. So far the ssl option with unix is less of an hassle, than the windows service clients.
I had some similar trouble with slave setup and wrote up this blog post - I was running on Linux rather than Windows, but hopefully this will help.
I dont know about how to use built-in hudson features for this job - but in one of my project builds, i run a batch file that in turn uses PSTools
to run the job on a remote server. I found PS tools extremely easy to use - download, unpack and run the command with the right parameters, hence opted to use this.

Automatically connect to a DB in a swing application

I m working on a single user swing application that access an hsqldb database. How can i Automatically run the DB server when a user run the application.?
for example, after i finish development i will put the application into an exe file.
If the exe file is distributed to multiple users. How can the DB server run and the DB be created when the user run the exe file?
Thanks
dumb question: why not just use HSQLDB in an embedded manner, instead of a client-server? (in fact, before reading your Q I didn't realize it could be made to run in client-server mode) If you're not sharing anything, just accessing a persistence layer, it should be straightforward.

Resources