HSQLDB alias doesnt exist, linux sh script - java

The problem is that when my hsql server starts, it tells that the alias exists, everything connected successfully:
rpi#RaspberryPi:/home/snb/update_skynetwork/apps/App/bin$ sh skysql.sh
/home/snb/update_skynetwork/apps/App/lib/hsqldb-2.2.8.jar
[Server#133796]: [Thread[main,5,main]]: checkRunning(false) entered
[Server#133796]: [Thread[main,5,main]]: checkRunning(false) exited
[Server#133796]: Startup sequence initiated from main() method
[Server#133796]: Could not load properties from file
[Server#133796]: Using cli/default properties only
[Server#133796]: Initiating startup sequence...
[Server#133796]: Server socket opened successfully in 7 ms.
] opened sucessfully in 1462 ms.=0, id=0, db=file:/home/snb/update_skynetwork/apps/App/sky-network-hsqldb/sky-network-hsqldb, alias=sky-network-hsqldb
[Server#133796]: Startup sequence completed in 1473 ms.
[Server#133796]: 2012-12-20 10:23:11.843 HSQLDB server 2.2.8 is online on port 9001
[Server#133796]: To close normally, connect and execute SHUTDOWN SQL
[Server#133796]: From command line, use [Ctrl]+[C] to abort abruptly
But when I try to connect with my java app I receive this error:
-on server:
[Server#133796]: [Thread[HSQLDB Connection #bdb503,5,HSQLDB Connections #133796]]: database alias=sky-network-hsqldb does not exist
[Server#133796]: [Thread[HSQLDB Connection #110003,5,HSQLDB Connections #133796]]: database alias=sky-network-hsqldb does not exist
[Server#133796]: [Thread[HSQLDB Connection #175d6ab,5,HSQLDB Connections #133796]]: database alias=sky-network-hsqldb does not exist
-on client:
Caused by: org.hsqldb.HsqlException: General error: database alias does not exist
at org.hsqldb.error.Error.error(Unknown Source)
at org.hsqldb.ClientConnection.<init>(Unknown Source)
... 16 more
I have tried to test the connection with the sqltool, but still the same.
Also, I have checked the alias name in the properties of client - all the same, like needed. The jars of hsql are the same. Everything matches.
As OS I have a Raspberry-pi VM.
EDIT
This is my sqltool.sh :
#! /bin/sh -e
export CLASSPATH=../lib/hsqldb-2.2.8.jar:$CLASSPATH
export CLASSPATH=../lib/sqltool.jar:$CLASSPATH
java -classpath $CLASSPATH org.hsqldb.cmdline.SqlTool -- inlineRc=url=jdbc:hsqldb:hsql://localhost/sky-network-hsqldb,user=SA,password=

It seems the only possible issue is shell script.
Can you use a simple name for the alias, without hyphens.
The database file name should be OK with the hyphens.
The server message states you do not have a server.properties file. In this case, the database file path and the name/alias should be on the command line. Please check your shell script and report / change the line that starts the server.

Related

Cannot find mysql.sock file and cannot check if mysql is running on mac using xampp

I am extremely new to Computer Science, and we were asked by our professor to connect our java file to our MySQL database using XAMPP. My java file would not connect to the database I created on phpmyadmin no matter what I did, so I tried to get to the root of the problem by entering mysqladmin -u root -p ping on my terminal. This was the result:
error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/tmp/mysql.sock' exists!
I went to my tmp folder and could not find the mysql.sock file. I tried checking if mysql was running by entering ps aux | grep mysql on my terminal. The result was
username 5078 0.0 0.0 4277504 672 s001 S+ 11:21AM 0:00.00 grep mysql
but I have no idea what that means. I also tried commands like service mysql restart and sudo service mysqld start, but terminal would say
zsh: command not found: service
I tried locating for the mysql.sock file because I thought it was just misplaced, so I entered locate mysql.sock and netstat -ln | grep mysql on the terminal, but they returned nothing. I also tried mysqladmin -p -u <user-name> variables but the result again was
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/tmp/mysql.sock' exists!
The weird thing is that on the Log tab of XAMPP, it says INFO: Successfully started "mysql". I am also able to connect to my databases using my php projects, but I just can't connect with my java files. Please help, I am desperate.

Jacoco instrumentation using tcp server method

I am trying to run integration tests on my java code from remote server, so whenever my tests hit my code server, jacoco records it.
I am new to jacoco, till now i have gather that there is tcp server method which doesnot require any restart.
I have added below line in my /etc/profile.
export JAVA_OPTS="-javaagent:/home/vansh/jacoco/lib/jacocoagent.jar=address=*,port=57026,destfile=/home/vansh/jacoco/jacoco.exec,output=tcpserver"
2)but when i am trying to take dump using below command -
java -jar jacococli.jar dump --address localhost --port 57026 --destfile /home/vansh/jacoco/jacoco-it.exec
ERROR:
[INFO] Connecting to localhost/127.0.0.1:57026.
[WARN] Connection refused (Connection refused).
[INFO] Connecting to localhost/127.0.0.1:57026.
Exception in thread "main" java.net.ConnectException: Connection refused (Connection refused)
at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399)
at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242)
at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224)
at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:403)
I checked that there is nothing run on port 57026, is my first command javaagent one is correct?
I have done same thing a year ago, In my case I run a TCP_Client jar for collecting the dump with many ways(periodically/with and without resetting previous coverage).
I set JAVA_OPTS as follows,
-javaagent:<file_Path_for_jacoco_agent>/jacocoagent.jar=output=tcpserver,address=*,port=6300
Here is my repo link of tcp client - enter link description here
set fixed arguments to the code or create a jar with this repo
If you are running a jar from this code,
You can run this jar with passing "address" "port" "dump-folder-path" "periodic-time-for-dumping" "resetting-option-with-every-dump" arguments.
example : java -jar ExecutedDataDump.jar "127.0.0.1" "6300" "D:\\server-dumplog\\" "5" "noreset"
You will get get jacoco.exec files with time stamp in every 5 secs time and due to noreset every jacoco.exec is get cumulative report
Hope this will helpful for you.

Unable to move data from HDFS to Cassndra( different server)

I am trying to move my data (exported from Hive) to a Cassandra table located in some other server
This is sqoop command :
export --connect jdbc:cassandra://server_address:port/KeySpace_name --username "MyUsername"--password "MyPass" --table my_cassandra_table --export-dir /user/xyz/ --columns Column_list
I get this error:
E0501: Could not perform authorization operation, Call From trphada05.hadoop.searshc.com/157.241.81.9 to trphada01:8020 failed on connection exception: java.net.ConnectException: Connection refused; For more details see: http://wiki.apache.org/hadoop/ConnectionRefused

Deploying java application using capistrano

I am trying to get my java application deployed on tomcat server (in windows), I am getting the following error. Please help me with some guideline on the following connection error. I have admin privilege and server is running in local.
C:\builds>cap local deploy
DL is deprecated, please use Fiddle
* 2013-04-01 14:19:06 executing `local'
* 2013-04-01 14:19:06 executing `deploy'
* 2013-04-01 14:19:06 executing `deploy:update'
** transaction: start
* 2013-04-01 14:19:06 executing `deploy:update_code'
* executing "xcopy C:/_Savita/app/my-app \"C:/builds/releases/20
130401084906\" /S/I/Y/Q/E && (echo > C:/builds/releases/20130401084906/REVISION
)"
servers: ["localhost"]
*** [deploy:update_code] rolling back
* executing "rm -rf C:/builds/releases/20130401084906; true"
servers: ["localhost"]
** [deploy:update_code] exception while rolling back: Capistrano::ConnectionErr
or, connection failed for: localhost (Errno::ECONNREFUSED: No connection could b
e made because the target machine actively refused it. - connect(2))
connection failed for: localhost (Errno::ECONNREFUSED: No connection could be ma
de because the target machine actively refused it. - connect(2))
Please find below the deploy script used
set :application, "myApp"
#set :scm, "git"
set :repository, "C:/_Savita/app/my-app"
#set :branch, "master"
default_run_options[:pty] = true
ssh_options[:forward_agent] = true
task :local do
roles.clear
server "localhost", :app
set :user, "Savita Doddamani"
set :java_home, "C:/Program Files (x86)/Java/jdk1.6.0_25"
set :tomcat_home, "C:/Program Files (x86)/Apache Software Foundation/Tomcat 6.0"
set :tomcat_manager, "user"
set :tomcat_manager_password, "pwd"
set :maven_home, "C:/_Savita/softwares/apache-maven-2.2.1"
set :deploy_to, "C:/builds/"
set :use_sudo, false
namespace :tomcat do
task :deploy do
puts "==================Building with Maven======================" #Line 22
run "export JAVA_HOME=#{java_home} && cd #{deploy_to}/ && #{maven_home}/bin/mvn clean install package -DskipTests"
puts "==================Undeploy war======================"#Line 24
run "curl --user #{tomcat_manager}:#{tomcat_manager_password} http://$CAPISTRANO:HOST$:8080/manager/text/undeploy?path=/#{application}"
puts "==================Deploy war to Tomcat======================" #Line 26
run "curl --upload-file #{deploy_to}/current/target/dist/local/#{application}*.war --user #{tomcat_manager}:#{tomcat_manager_password} http://$CAPISTRANO:HOST$:8080/manager/text/deploy?path=/#{application}"
end
end
after "deploy", "tomcat:deploy" #Line 30
after "tomcat:deploy", "deploy:cleanup" # keep only the last 5 releases
end
ECONNREFUSED is the return from the connect(2) system call. It means that the server process is not listening on TCP port 8080. Java takes time to start up and you may be attempting to connect via curl too soon or you have not configured Tomcat to listen on port 8080 or you have not started Tomcat at all.

Creating a connection with hsqldb

I have to connect a database to a java program. I'm using HSQLDB on OS X 10.7.4 with Eclipse Helios and SQLExplorer plugin.
This is the content of the runServer.sh file:
#!/bin/bash
cd ../data
java -classpath ../lib/hsqldb.jar org.hsqldb.server.Server -database.0 file:mantenimiento -dbname.0 mantenimiento
You can find it in:
http://i45.tinypic.com/jfw6tw.png
When I executed the script this is what I get:
MacBook-Pro-de-Luis:bin luis$ ./runServer.sh
: No such file or directory ../data
[Server#6016a786]: [Thread[main,5,main]]: checkRunning(false) entered
[Server#6016a786]: [Thread[main,5,main]]: checkRunning(false) exited
[Server#6016a786]: Startup sequence initiated from main() method
[Server#6016a786]: Could not load properties from file
[Server#6016a786]: Using cli/default properties only
[Server#6016a786]: Initiating startup sequence...
[Server#6016a786]: Server socket opened successfully in 7 ms.
] opened sucessfully in 505 ms.dex=0, id=0, db=file:mantenimiento, alias=mantenimiento
[Server#6016a786]: Startup sequence completed in 513 ms.
[Server#6016a786]: 2012-05-18 10:54:51.396 HSQLDB server 2.2.8 is online on port 9001
[Server#6016a786]: To close normally, connect and execute SHUTDOWN SQL
[Server#6016a786]: From command line, use [Ctrl]+[C] to abort abruptly
I have problems with cd ../data and then it creates the database and says its working but it is created in /bin and not in /data.
When I try to reate the conexion in Eclipse with SQLexplorer I get this:
http://i45.tinypic.com/21d3cl2.png
And the terminals says:
[Server#6016a786]: [Thread[HSQLDB Connection #60f47bf5,5,HSQLDB Connections #6016a786]]: database alias=mantenimiento does not exist
Anyone knows what am I doing wrong?
Thank you.
No such file or directory ../data
Create the ../data directory: it doesn't exist. So obviously, you can't cd into it.
If you look at your folder structure, you'll see that the runServer.sh file sits one level behind the bin folder. Yet, the .sh script tries to go BACK one level to find the ../data folder, the .. means go back one folder.
Try changing the ../data to just data and see what happens.

Categories

Resources