How to launch H2 in server mode? - h2

I'm trying to develop some app on H2 database, but the problem is I can't run JDBC queries and using web-interface of the database at the same time.
The exception log looks as follows:
org.h2.jdbc.JdbcSQLException: Database may be already in use: "Locked by another process". Possible solutions: close all other connection(s); use the server mode [90020-169]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
at org.h2.message.DbException.get(DbException.java:169)
at org.h2.message.DbException.get(DbException.java:146)
At H2 launch I've chosen Server mode but this doesn't help. The image is given below
http://gyazo.com/1c59fe77bf29e2061da1a0894e18a471

I found it, it takes 2 steps to complete it:
add String ";AUTO_SERVER=TRUE" to both jdbc String in application and server web-form.
My string using test database is: "jdbc:h2:~/test;AUTO_SERVER=TRUE"

Related

Multiple connections for Embedded Databases

I'm working with an H2 database in embedded mode and I came up with this quote in H2 documentation (here).
In embedded mode, an application opens a database from within the same
JVM using JDBC.
In Derby documentation (here), I came up with this.
If you use the embedded driver, two separate instances of Derby cannot
access the same database. If a Derby instance attempts to access a
running database, an error message appears, and a stack trace appears
in the derby.log file. If you want more than one Derby instance to be
able to access the same database, you can use the Network Server.
I would really appreciate if someone can elaborate on why is that only the same JVM can access the database in embedded mode.
Thank you.

How to replicate existing OracleRDB ODBC connection in Oracle's SQL Developer application?

I am new to Oracle database in general, but I'm attempting to get Oracle's SQL Developer running on a workstation that has pre-configured System DSNs created for an OracleRDB database. I've confirmed the ODBC connections are working because I can use MS Access to connect and link to the tables. The "test" options within ODBC also succeed. Now I am trying to get a similar connection created using SQL Developer so I can see the column types and write queries in a more useful editor.
Here's what I have available when examining the ODBC connection properties:
Now I'm trying to create a duplicate connection in SQL Developer, but I'm at a loss for why things don't work. I first tried using the default SQL Developer installation, but couldn't get things working. Then I discovered there's an OracleRDB extension available, so I installed that, but I keep getting this error when attempting to use similar values:
As I stated, these ODBC connections were pre-configured on the workstation I'm using, so I don't know anything more than what is provided by the Oracle ODBC driver window.
Is there something obvious I'm not seeing or doing to replicate this connection in SQL Developer? Or perhaps something else I can do to debug this to learn more?
UPDATE
On the advice of one answer I'm trying to make the connection with JDBC, but having a hard time understanding what I'm doing wrong. Here's another screenshot with the connection parameters I have available, but with the server and database names changed:
With these values (the port came from my tnsnames.ora file), if I try to make a JDBC connection I keep getting the following error from SQL Developer:
One final attempt I did was to use the proper values in the Oracle RDB tab, and when I use them and click 'test' the Testing Connection dialog just spins and never seems to return:
So I apologize for the long post here, but I'm struggling because there's just something I am really not understanding about how this all works. I appreciate everyone who took the time to read this question.
Oracle SQL Developer is a Java Application. You'll need to get the JDBC Driver for RDB.
Once you have that, in the SQL Developer preferences, find the Third Party JDBC section, and then use that to add an entry and point to the JAR for what you just installed.
Step by step instructions here.
Working connection string for RDB Thin Driver:
RDB_DB_CONN_STR = "jdbc:rdbThin://node.myplace.com:1707/";
where node.myplace.com is the name of the OpenVMS node hosting the RDB Thin Driver, 1707 is the port number assigned to the RDB Thin Driver.

How to check connection of cassandra with pentaho data integrator

I'm trying to load data from Oracle table to Cassandra table by using Pentaho Data Integration 5.1(Community Edition). But I'm not getting whether connection has been established between oracle and cassandra. I'm using Cassandra 2.2.3 and Oracle 11gR2.
I've added following jars in lib folder of data-integration
--cassandra-thrift-1.0.0
--apache-cassandra-cql-1.0.0
--libthrift-0.6.jar
--guava-r08.jar
--cassandra_driver.jar
Please anyone can help me to figure out how to check whether connection has been established in Pentaho.
There are some ways to debug if a connection is established to a database, I don't know if all of them are valid for cassandra, but I'll add a especial one for that.
1) The test button
By simply clicking the test button on the connection edit screen.
2) Logs with high details may help
Another way to test is running you transformation with a high detail log:
sh pan.sh -file=my_cassandra_transformation.ktr -level=Rowlevel
3) The input preview
For cassandra, in especific, I would try just to create a simple read operation using Cassandra Input step and clicking in the 'preview' button.
4) The controlled output test
Or maybe you can try with a simplier transformation first, to make sure it's running fine. Eg.

Exception caused while querying Hive Derby database via JDBC

I am a new user to Hive and have just started using it for a project. I am having problem connecting to the database using java. It is explained as follows:
I ran Hive database on my machine that created a derby metastore_db using the Embedded Derby Driver. Now, I wish to query this metastore_db via a separate Java program for issuing queries.
I followed multiple tricks that I could find online but still am not able to get that working.
Snapshot of my Java file:
String url = "jdbc:derby:metastore_db;create=true";
String username = "APP";
String password = "mine";
String drivername = "org.apache.derby.jdbc.EmbeddedDriver";
Connection con = DriverManager.getConnection(url,username, password);
Statement stmt = con.createStatement();
res = stmt.executeQuery("describe " + tableName);
Running the java file:
I have placed it in the same folder as the metastore_db and then running it using the following command:
java -cp "derby-10.4.2.jar:." ConnectTesting
I get the following syntax exception:
java.sql.SQLException: Syntax error: Encountered "describe" at line 1, column 1.
Some of the things I have already tried:
url = "jdbc:derby:metastore_db;create=false";
url = "jdbc:derby://localhost:10000/metastore_db";
url = "jdbc:derby://localhost:1527/metastore_dbDB"; // By default port at which hive listens
The above two give error as:
No suitable driver found for jdbc:derby://localhost:10000/metastore_db
url = "jdbc:derby:<full_path_to_db>/metastore_db";
If I have my HIVE server already running, and then from another terminal I execute the java file, it says:
"Another instance of Derby may have already booted the database "
Can anyone kindly point out as to what am I doing wrong and how can I connect to the already existing database to issue queries.
That's a lot of different questions. Which one do you really need answered?
"describe" is a command implemented by the "ij" tool; it is not a SQL statement. So to run "describe", you have to run it from "ij" (or by using the RunScript utility to run "ij" within your application; you cannot run it directly from Statement.executeQuery().
In order to use the client-server driver, with the hostname:port syntax, you have to (a) use the derbyclient.jar rather than the derby.jar in your classpath, and (b) have the Network Server running.
And, you cannot have the same Derby (embedded) database open in multiple applications simultaneously, so while your application is running, you cannot run a second application against the same (embedded) database. If you need this functionality, you need to switch all your applications to using the client driver, and run the Network Server to provide multi-application access to your database.
Have you run the Derby tutorial yet? It covers most of these topics in more detail: http://db.apache.org/derby/docs/10.10/getstart/

Setting connection info using XQJ with Oracle 11g

I am trying to submit XQuery queries to an Oracle 11g database through their XQJ API.
When I instantiate an oracle.xquery.xqj.OXQDataSource as explained in http://www.oracle.com/technetwork/articles/oem/xquery-jdbc-325944.html, I can submit queries fine except that I haven't found how I can set up the server connection (server name, port, username, password, ...) info:
This datasource claims that it doesn't support setting any property.
It doesn't implement the data source constructor which takes a JDBC connection.
I don't see any non standard method to set such info.
When I try to access some random collection like collection("oradb:/foo") I just get an empty result set even when no server is running, suggesting that the driver doesn't even try to connect.
What have I missed and how can I set the server connection info?
Thanks,
Eric
Thanks to Charles Foster I can answer to my own question: the XQJ implementation from Oracle is an old standalone version from January 2010 that is pretty useless and doesn't interact with Oracle databases.
Despite all the Oracle statements about XQJ, I haven't been able to find any client/server XQJ implementation (except one from DataDirect of course) and the way to submit XQuery queries to Oracle databases appears to be through JDBC, embedded in PL-SQL statements.
It is possible in 12.
XQJ to run queries in Java:
http://docs.oracle.com/database/121/ADXDK/adx_j_xqj.htm#ADXDK99930
XQJ to run queries against the database:
http://docs.oracle.com/database/121/ADXDK/adx_j_xqjxdb.htm#ADXDK136

Resources