I am trying to setup a remote OrientDB Server and I am trying to enter vertices into it from local Java code.
When I try the following code:
private static final void dropDb() {
OrientGraphNoTx graph = new OrientGraphNoTx(ORIENT_URL);
graph.drop();
}
I get an Exception saying:
Exception in thread "main" com.orientechnologies.orient.core.exception.ODatabaseException: Cannot delete database
...
Caused by: java.lang.UnsupportedOperationException: Cannot delete a database in a remote server. Please use the console or the OServerAdmin class.
How do I go about deleting a remote graph, using Java, in OrientDB?
He jackofblades,
the Graph answers your question:
Please use the console or the OServerAdmin class
// CREATE A SERVER ADMIN CLIENT AGAINST A REMOTE SERVER
OServerAdmin serverAdmin = new OServerAdmin("remote:localhost/GratefulDeadConcerts").connect("admin", "admin");
serverAdmin.dropDatabase("GratefulDeadConcerts");
This is taken from the OrientDB Wiki Page
Patrick
Related
I tried Connecting the AWS Neptune with this Java code and got the error , NoHostAvailable Exception
approach 1:
public static void main(String[] args) throws Exception {
Cluster.Builder builder = Cluster.build();
builder.addContactPoint("endpoint");
builder.port(8182);
builder.enableSsl(true);
builder.keyStore("pem-file");
Cluster cluster = builder.create();
GraphTraversalSource g = traversal().withRemote(DriverRemoteConnection.using(cluster));
System.out.println(g.V().limit(10).toList());
cluster.close();
}}
approach 2:
Cluster cluster = Cluster.build("endpoint").
enableSsl(true).keyStore("pem").
handshakeInterceptor( r -> {
NeptuneNettyHttpSigV4Signer sigV4Signer = null;
try {
sigV4Signer = new NeptuneNettyHttpSigV4Signer("us-east-2", new
DefaultAWSCredentialsProviderChain());
} catch (NeptuneSigV4SignerException e) {
e.printStackTrace();
}
try {
sigV4Signer.signRequest(r);
} catch (NeptuneSigV4SignerException e) {
e.printStackTrace();
}
return r;
}).create();
Client client=Cluster.open("src\\conf\\remote-objects.yaml").connect();
client.submit("g.V().limit(10).toList()").all().get();
what ever I do, I am getting this error:
Sep 02, 2021 3:18:34 PM io.netty.channel.ChannelInitializer exceptionCaught
WARNING: Failed to initialize a channel. Closing:
java.lang.RuntimeException: java.lang.NullPointerException
org.apache.tinkerpop.gremlin.driver.Channelizer$AbstractChannelizer.initChannel(Channelizer.java:117)
Caused by: org.apache.tinkerpop.gremlin.driver.exception.NoHostAvailableException: All hosts
are considered unavailable due to previous exceptions. Check the error log to find the actual
reason.
I need the code or the document to connect my Gremlin code in .java file to AWS neptune. I am struggling and tried various number of ways,
1.created EC2 instance and did installed maven and apache still got error and code is running in Server(EC2), i want code to present in IntelliJ
it would be more helpful, if I get the Exact Code any way. what should be added in remote-objects.yaml.
if we require Pem-file to access Amazon Neptune, please help with the creation of it.
Assuming SSL is enabled but IAM is not, in terms of Java code, this is all you need to create the connection.
Cluster.Builder builder = Cluster.build();
builder.addContactPoint("localhost");
builder.port(8182);
builder.enableSsl(true);
builder.serializer(Serializers.GRAPHBINARY_V1D0);
cluster = builder.create();
drc = DriverRemoteConnection.using(cluster);
g = traversal().withRemote(drc);
You may need to add an entry to your /etc/hosts file to get the SSL certs to resolve correctly such as:
127.0.0.1 localhost my-neptune-cluster.us-east-1.neptune.amazonaws.com
If you find that using localhost with SSL enabled does not work then use the actual Neptune cluster DNS name and make the edit to your /etc/hosts file.
The last thing you will need to do is create access to the Neptune VPC from your local machine. One way is using an SSH tunnel as explained in this post
I have a problem when accessing arangodb using Java driver.
When i run my application, it runs but neither it shows any response and nor it throws any error. Then i think it must be something on my connection to the remote arangodb server, and i tried to connect using Python arangodb, and it's success to connect.
Anyone knows what's the problem with my arangodb Java application? Is there any difference between java connector and python to arango? I'm using java driver arango 5.0.1
Here's what I've tried:
Java Driver :
public static void main(String[] args) {
// TODO Auto-generated method stub
#SuppressWarnings("deprecation")
ArangoDB arangodb = new ArangoDB.Builder().timeout(100).host("10.22.21.70",8599).user("xxx").password("xxx").useProtocol(Protocol.VST).build();
System.out.println("Test Start");
ArangoDatabase db = arangodb.db("data");
boolean tes = db.exists();
System.out.println("success");
arangodb.shutdown();
}
This program continues to run like this, without being terminated and throwing an error :
enter image description here
Using Python Arango :
import json
from arango import ArangoClient
from pyArango.connection import *
USER = 'xxx'
PASS = 'xxx'
HOST = '10.22.21.70'
DATABASE = 'data'
PORTT = 8599
client = ArangoClient(host=HOST,port=PORTT)
db = client.db(DATABASE,username=USER,password=PASS)
query = 'FOR s IN Email FILTER s.date>= "2018-11-07" LIMIT 0,2 RETURN s'
queryResult = db.aql.execute(query,batch_size=2,count=True)
res = queryResult.batch()
print(res)
And also i've tried to use telnet to the remote server, and it shows blank screen, which means no problem with the connection between my local host with the remote host.
Thanks
I'm using java driver arango 5.0.1
I had the same issue. Using v4.2.2 solved the problem. If someone could explain why drivers are not compatible, that would be great.
You are setting a timeout of 100ms, maybe you have higher network latencies while connecting to the remote server? To double check if this is the problem you can try without setting the timeout.
I have a lot of Lotus Notes / Domino (version 7) database to migrate to a new software.
On my workstation (with Lotus Notes installed), I'm using a standalone Java application to connect to a local replica an extract data.
However the replication of the distant database is still a manual process. I'd like to automatise it.
My java code basically looks like this :
Session localSession = NotesFactory.createSession(); // With Notes thread initialized
Session remoteSession = NotesFactory.createSession(SERVER, USER, PASSWORD);
Database localDb = localSession.getDbDirectory(null).openDatabase("local_name", true);
Database remoteDb = remoteSession.getDbDirectory(null).openDatabaseByReplicaID(REPLICA);
// ***EDITED CALLING INSTANCE BELOW***
remoteDb.createReplica(null, "local_name"); // Error thrown here
However the last line throws an exception (from memroy, but something like)
CN=****/***** does not have the right to create database on a server
How is it possible that I don't have the right to create database on my local computer ?
Is there any other way to programmaticly create a local replica from a distant database ?
Edit: changed calling instance of create replica to match my code causing the issue
My guess is that it's just giving you the wrong error message. One thing that's definitely wrong is that he first argument for createReplica should be an empty string, not a null pointer. I.e., try this:
localDb.createReplica("", "local_name");
Ok it looks like I found the answer.
AFAIU I had to open the database on the target server, using my local session, and run the createReplica() from here. This way, the createReplica is executed on my local Lotus Notes server, and the replica is created locally.
Session localSession = NotesFactory.createSession((String)null, (String)null, PASSWORD);
DbDirectory remoteDbDirectory = localSession.getDbDirectory(remoteSession.getServerName());
Database localSessionRemoteDatabase = remoteDbDirectory.openDatabaseByReplicaID(REMOTE_REPLICA_ID);
localSessionRemoteDatabase.createReplica("", LOCAL_FILE_NAME);
#Richard Schwartz Can you confirm this is ok ?
The only weird thing, is that it opens a prompt (like when it's expecting password) but the replica is created.
The process is executed within Eclipse.
I'm writing a code which manipulates data stored in HBase. I want to write also a test for this code. I want to use HBaseTestingUtility in my test, hence, in my #BeforeClass I create new instance of HBaseTestingUtility and I start the mini cluster:
#BeforeClass
public static void setUpClass() throws Exception {
utility = new HBaseTestingUtility();
utility.startMiniCluster();
}
It works good. However, I cannot connect to this embedded cluster in my code which is being tested. In the code I have:
Configuration config = HBaseConfiguration.create();
try (HBaseAdmin admin = new HBaseAdmin(config))
{
//code which manipulates the data
}
Unfortunately when new HBaseAdmin is created I'm getting a ConnectionError exception:
2013-11-21 11:20:35,778 WARN [main-SendThread(0:0:0:0:0:0:0:1:2181)] zookeeper.ClientCnxn (ClientCnxn.java:run(1089)) - Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: Connection refused: no further information
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:692)
at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:350)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1068)
When I try another apporach to create HBaseAdmin:
try (HBaseAdmin admin = new HBaseAdmin(HBaseCacheTest.utility.getConfiguration()))
{
//code which manipulates the data
}
it works (note that here I'm accessing the instance of HBaseTestingUtility via HBaseCacheTest.utility).
Obviously this is not a good approach as I don't want to have a production code which depends on the testing code.
One approach I see to work here is to make it possible in my production class to set the Configuration and use this setter method in my tests.
However, I believe that there should be another way to connect to the embeded mini cluster created with HBaseTestingUtility.
Any ideas?
You should not create a new Configuration object, but use the one provided by HBaseTestingUtility:
HBaseAdmin admin = testingUtility.getHBaseAdmin();
Also, if you need configuration only you can use this one:
testingUtility.getConfiguration()
Just rechecked it in my UT. I'm using HBase 0.96-hadoop2
Hope this helps :)
I am getting an error when I try to establish connection through a DataSource created in weblogic server.Has anyone faced this error in past.I am getting exception in getConnection method of the DataSource.
java.lang.IllegalArgumentException: interface weblogic.jdbc.rmi.internal.ConnectionImpl_weblogic_jdbc_wrapper_PoolConnection_com_informix_jdbc_IfxSqliConnect_RemoteInterface is not visible from class loader
at java.lang.reflect.Proxy.getProxyClass(Proxy.java:337)
at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:567)
at weblogic.rmi.internal.ProxyStub.newInstance(ProxyStub.java:69)
at weblogic.rmi.internal.OIDManager.resolveObject(OIDManager.java:242)
at weblogic.common.internal.ChunkedObjectInputStream.resolveObject(ChunkedObjectInputStream.java:81)
at weblogic.common.internal.ChunkedObjectInputStream$NestedObjectInputStream.resolveObject(ChunkedObjectInputStream.java:328)
at java.io.ObjectInputStream.checkResolve(ObjectInputStream.java:1321)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1835)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1759)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:322)
at weblogic.common.internal.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:139)
at weblogic.common.internal.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:152)
at weblogic.rmi.internal.ObjectIO.readObject(ObjectIO.java:56)
at weblogic.rmi.internal.BasicRemoteRef.unmarshalReturn(BasicRemoteRef.java:233)
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:264)
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:230)
at weblogic.rmi.internal.ProxyStub.invoke(ProxyStub.java:35)
at $Proxy2.getConnection(Unknown Source
It seems like you're trying to access the Datasource through a socket instead of looking up the JNDI name of the resource first and invoking getConnection on that reference.
You can simply find the cause of your issue by trying the following command:
java utils.dbping ORACLE_THIN scott tiger dbserver1:1561:demo
If this command returns Success!!!, you know, your connection to DB from server is okay, and you have to focus on middleware settings. If not, error detail will be provided.
scott = db username
tiger = db password
demo = db instance name
More information can be found here: http://docs.oracle.com/cd/E13222_01/wls/docs81/admin_ref/utils11.html
To execute java utils.dbping, make sure you have executed setWLSEnv.sh first, to setup java local variables.