H2 Database not working on Linux - java

I'm using Maven on NetBeans to import H2 Database to my project and the following code to init. a simple embedded database:
//...
Class.forName("org.h2.Driver");
//...
connection = DriverManager.getConnection("jdbc:h2:~/MCUsers");
//...
When I run the code on my Windows machine (where I do the programming), it works fine and I can create tables and rows. But when I run the same JAR file on my Linux machine, I get the following error:
Error Code:90020 Message:Database may be already in use: null.
Possible solutions: close all other connection(s); use the server mode
[90020-194] Cause:java.lang.IllegalStateException: The file is locked:
nio:/root/MCUsers.mv.db [1.4.194/7]
The same JAR runs on my Windows machine with no problems.
There are no other Java programs running on my Linux machine.
I already tried to reboot the system - didn't work.
Only The files MCUsers.mv.db & MCUsers.trace.db are created in the root directory after this error occurs.
My Linux machine uses JRE1.8.0_112 to execute the JAR file.
Edit:
Adding "FILE_LOCK=NO;" also didn't work.

Related

deploy jar on Windows Server AWS EC2

I need to run a jar on a windows server instance.
I would like to build/update/redeploy the jar through a script.
On Linux I know how this works but I cannot seem to find any information how this works on Windows server.
I build the jar somewhere on jenkins.
On linux I can scp (ssh-copy) the jar to the server on a certain location. Then restart it.
In Windows don't even know how to copy the file on to the server without logging in manually via RDP.
I would like a scirpt that I can run in jenkins, that connects to windows server. Stops the running jar and exchanges it for the new one. Starts it up again. (with windows file handles I'd have to stop it before overwriting the jar).
How does CI work on windows server?
PS:The issue is that the jar starts up a process which only runs on windows server in a NON headless mode and thus, I cannot get around windows.

Issues while running Java Tableau Extract API sample program

I am trying to run the 'TableauSDKSample' java program on an Amazon EMR machine running Linux (64 bit) using my own custom jar. When I try to run my program, I get the following error:
A fatal error occurred while creating the extract:
Hyper Server did not call back on the callback port: process = 30320
Printing stack trace now:
com.tableausoftware.TableauException: Hyper Server did not call back on
the callback port: process = 30320
at com.tableausoftware.hyperextract.Extract.<init>(Unknown Source)
at com.samsung.tabluea.TableauSDKSample.createOrOpenExtract(TableauSDKSample.j
ava:119)
at com.samsung.tabluea.TableauSDKSample.main(TableauSDKSample.java:234)
Exiting now.
Here's what I did:
I downloaded the Extract API for C/C++/Java (64-bit) (.tar.gz file)
I untarred the above file in install-dir using tar -xvzf
extractapi-linux-x86_64-10-5-0.tar.gz
I created a jar using maven
for my very simple custom project having only one file
TableauSDKSample.java
To install the shared libraries, I copied all
the files from
install-dir/hyperextractapi-cpp-linux-gcc-x86_64-release-2017.4.0.127.r9c0f968e/lib64/tableausdk/
to /lib64/. By doing this, I avoid setting LD_LIBRARY_PATH
explicitly. See this for details: https://software.intel.com/en-us/articles/install-a-unix-including-linux-shared-library
Then I tried to run my program using
the following command:
sudo java -cp install-dir/hyperextractapi-cpp-linux-gcc-x86_64-release-2017.4.0.127.r9c0f968e/lib64/tableausdk/:install-dir/hyperextractapi-cpp-linux-gcc-x86_64-release-2017.4.0.127.r9c0f968e/lib64/tableausdk/Java/:/path/to/my/custom-jar.jar fully.qualified.MainClass
(where my main class is TableauSDKSample)
There is definitely no issue with the code as it is running on my local system where I use Eclipse IDE to run it. What am I doing wrong?

run a jarfile in a different machine from an sqlserver/issue a terminal command from an sqlserver to another windows machine

I have a series of stored procedures(say, SP1, SP2, SP3) consecutively running on an sqlserver(say, serverA).
After SP3 finishes execution, I want to run a jar file in some machine (say, computerA). Is there a way for me to trigger the run of my jar file in computerA after SP3 finishes executing in serverA?
Note: I can only run my jar file in computerA because my jar file actually retrieves data from Bloomberg API. So, this jar file needs to run in a machine that has Bloomberg terminal on it. Only computerA has a Bloomberg terminal.
I think another way of saying this is how to issue a terminal command from an sqlserver to another windows machine. Because I can just issue the following command to computerA but I really don't know how to make that possible.
java -jar D:\Runnables\myJavaApp.jar

Issue while running a java application in Linux env

I have a java project built in eclipse in my Windows machine. Now i had to run it in Linux machine. I created a jar , and i am trying to run the jar.
The main class, takes a XML file as input. Previously on Windows, i had given path of the file in Windows. Now i kept the .xml file in the root location in Unix.
can i modify the code in Windows, to the root path of Linux machine and try to run the jar.
I did it like this ,
XYZ parsero = new XYZ("//root//workflow.xml");
Created the jar and tried to run in Unix.
I got the below exception.
java.net.UnknownHostException: root
How do i need to run this.
I got the solution. It should be XYZ parsero = new XYZ("/root/workflow.xml"); unlike in Windows

About the connectivity to IBM database using JDBC in Java

I have a problem connecting to IBM (universal) database using JDBC. I wrote the code in Notepad using Java and I loaded drivers of IBM database i.e(driver name and connection URl). When I run the code using general compilation (javac code.java and java code) I am getting an error message "cannot find the driver" but I specified the correct driver name for that. Actually I did this program using Eclipse using the same database with same driver name and all and finally I succeeded, but I cant get this without using an IDE. So please help me how to connect without the IDE and how to run it in a command prompt.
You need to include the necessary JAR files on the classpath when you run your program on the command line.
If you're using IBM's DB2 UDB database, the required driver file is db2jcc.jar, and I think db2jcc_license_cisuz.jar and db2jcc_license_cu.jar are necessary for licensing as well. Search for those files, and include them on the classpath when you run your program from the command line.

Categories

Resources