Can't access hive tables over http - java

I am trying to use the Hive JDBC driver to connect to the hive server running on a particular host port. I can establish the connection and create tables (the tables also show up on the namenode web UI) but I can't access existing tables. Note: The existing tables were running the hive console and (for some odd reason) can only be accessed when I run the hive console in that particular directory.
How can I get my jdbc client to access the hive tables using the JDBC connection?

Related

Cannot connect H2 database using Server Mode

I use H2 database (file) in my Java app and due to some data appearance problem in IntelliJ, I use file option instead of memory.
Here is my url setting in application.properties:
spring.datasource.url=jdbc:h2:file:~/test-db;
DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;AUTO_SERVER=TRUE
I can connect and see table data via IntelliJ and H2 console by using the url parameter as shown below:
jdbc:h2:file:~/test-db
However, even I connect to the database successfully, the table data is not seen in DBeaver as shown below:
I think I should use tcp option to connect H2 daabase, but I cannot by using the following settings:
spring.datasource.url=jdbc:h2:tcp://localhost/~/test-db
or
jdbc:h2:tcp://localhost/C:/test-db
and get "Unable to open JDBC Connection for DDL execution" error (I use Windows). Any idea?
You're using a file-associated connection to that in-memory DB that can only be used by 1 tool at once.
So when IntelliJ is connected it generates a lock-file to protect it against multi-access.
I would suggest a TCP connection that allows multiple connections - see redundant question here:
H2 database error: Database may be already in use: "Locked by another process"

How to connect MsAccess database existing in windows folder using Kubernetes

I have an MSAccess database in my local windows. and I need to connect it with java code using Kubernetes.
I tried to use the below:
jdbc:ucanaccess:///run/desktop/mnt/host/c/Users/Public/fdb/F_B_1_2.mdb;jackcessOpener=com.sms-manager.mobile_app.mobileapp.manage.CryptCodecOpener
But it's not working with me.
it's giving java error database not existing.
Is your java application running in container and trying to connect to ms access db which is in another machine? if yes then you can create Kubernetes service and endpoint of your db server or external name of db server. Choose suitable JDBC and ODBC driver to connect to MS Access Database

Enabling TCP/IP protocol on SQL server using Java

I currently have a java application that I need to connect and write to a SQLEXPRESS instance of the SQLserver DB, at the moment my code will connect to the DB, but only if I open the SQL server config manager and manually enable the TCP/IP protocol,set the port to 1433 and then restart the server. The following link describes what i am talking about https://dzone.com/articles/connecting-sql-server-java this.
I want to distribute my application to users, but I don't want the users to have to manually set this themselves I want my java code to do it for them, is this possible to do in java?

java application not connect with a specific database in mysql on localhost,connection refused error comes

My java application is not connect with a specific database in MySQL on local host.'Connection refused' named error coming when I am trying to connect.
I have checked also service of MySQL its working because there is two db on local host, I am able to connect with one Db. I have googled all the things but my problem still not resolved.
Please check the Bind address
(https://dev.mysql.com/doc/refman/5.1/en/server-options.html#option_mysqld_bind-address) to see if you have altered the my.cnf|ini configuration file on mysql correctly.
Also if you are trying to connect using different machine then you have to create a user and grant him privileges like this to make the database available remotely
CREATE USER 'jeffrey'#'%' IDENTIFIED BY 'mypass';
GRANT ALL ON db1.* TO 'jeffrey'#'%';
Wildcard % is used to give access to any IP connecting your machine.

How to create a batch file for connecting to Java DB Network Server

I have made a Netbeans application that is reliant on the DB Network Server in order to retrieve data. In Netbeans the code works fine and runs well. Outside of Netbeans everything but the database information is working. I have made a batch file for connecting to the localhost server that seems to connect on the port I assigned: 1527. Even after connecting to the localhost, it won't display the database information.
My code in the batch file:
PATH C:\Program Files\Java\jdk1.8.0_25\db\bin;%PATH%
startNetworkServer
When I run this I get the result:
Security manager installed using the Basic server security policy.
Apache Derby Network Server - 10.10.1.8 - (1557168) started and ready to accept connections on port 1527connect
Is there more code that I need to add in order to connect to the actual database itself from the server? Or is this not the right way to do this at all? I have tried using the Embedded DB but that didn't work and only caused more problems. I would prefer greatly to stay away from it and stick to the Network DB.

Categories