I understand that it is possible to create a embedded OrientDB¹ server using:
OServer server = OServerMain.create();
What i don't understand is how to create or open a OrientGraph using the OrientGraphFactory. What is needed to connect both systems. (OServer, OrientGraph)?
I normally create my OrientGraph this way:
OrientGraphFactory factory = new OrientGraphFactory("plocal:" + options.getDirectory()).setupPool(5, 100);
OrientGraphNoTx noTx = factory.getNoTx();
I don't want to connect to my graph using "remote:" if possible since this would potentially create network layer within my embedded server.
My actual goals are:
Open the graph using the OrientDB workbench for inspection
Enable OrientDB Graph database distribution.
[1] http://orientdb.com/docs/2.1/Embedded-Server.html
Related
We ar running a webapplication in Azure Web Apps using a database per customer (multiple accounts per customer). When logging in we connect the user to the correct customer database. This database is also hosted in azure (an elastic pool). It is hosted in the same region (West Europe) as the Web App.
Once the connection is pooled, request times are fast, but the first time a user log's in, the connection still needs to be created an this takes (quiet) a long time.
The connectionstring is build up using a SqlConnectionStringBuilder.
var csb = new System.Data.SqlClient.SqlConnectionStringBuilder();
csb.DataSource = "tcp:******.database.windows.net,1433";
csb.InitialCatalog = "***-***-***";
csb.UserID = "**-**";
csb.Password = "**********";
csb.MultipleActiveResultSets = true;
csb.Encrypt = true;
csb.PersistSecurityInfo = false;
csb.TrustServerCertificate = false;
csb.ConnectTimeout = 30;
_connectionString = csb.ConnectionString;
// Data Source=tcp:******.database.windows.net,1433;Initial Catalog=***-***-***;Persist Security Info=False;User ID=**-***;Password=******;MultipleActiveResultSets=True;Connect Timeout=30;Encrypt=True;TrustServerCertificate=False
Am I doing anything wrong? Or are there some settings in azure to speed up the connect process?
The above request shows the first request to the application of a customer. It therefor includes the EF Migration Seed resulting in the first 2 queries not actually going to the database itself and quite a lot of queries (not all shown here) to the database.
Well, I solved my problem eventualy. Seems i was matching wrong queries within Applications Insights. I installed Stackify and this gives just the little bit more information I needed.
Seem's Entity Framework does some things with the 'master' database. As the user in the connectionstring did not have access to the 'master' database it throws an error. Well, handling that error take's up quite some time on the app-service used and therefor returning slow. It just doesn't fail.
What EF tries to do is determine if the database exist by querying the master database wich is faster then connecting to a non existing database. If it fails because it can not connect to the master database, EF just tries to connect to the database itself. If connection to the database works, it continues normal execution like the seed method.
I am creating simple authentication server that will store user and password and user groups in database.
I want to provide simple embedded data store to manage user/passwords and groups.
What will be suitable:
LDAP server data store
mongodb datastore by storing values against each user names etc
Any other?
It should also have some java api to store and retrieve data .
Please suggest?
I think for your case MongoDB will be good.It is fast to access vias API provided by mongoDB.Use Hibernate OGM.But as you want embeded then mongoDB will not be a good choice.However you can try this http://www.project-voldemort.com/voldemort/
Embedded Server
You can instantiate the server directly in your code.
VoldemortConfig config = VoldemortConfig.loadFromEnvironmentVariable();
VoldemortServer server = new VoldemortServer(config);
server.start();
For this you first need to include jar in your environment variable classpath or by including volemart jar inside your project classpath
I am currently running Titan Server (0.4) [via bin/titan.sh -c cassandra-es start] and load the sample data using rexster-console:
rexster[groovy]> g = rexster.getGraph("graph")
rexster[groovy]> GraphOfTheGodsFactory.load(g)
How can I do the same thing above using a RexsterClient in java? Essentially, Is it possible to get access to graph without me having to embed all this in client.execute()?
Thanks for your help.
Once you've created the graph you can access it with RexsterClient. You shouldn't need to recreate the graph again with it as the data is already in Cassandra. Just specify the graph name when constructing your RexsterClient instance (in the case of Titan Server the graph name is just "graph"):
RexsterClient client = RexsterClientFactory.open("localhost", "graph");
List<Map<String, Object>> results = client.execute("g.v(4).map");
That will initialize "g" and allow you to just issue some Gremlin against the Graph of the Gods sample data set. You can read more about the options for RexsterClient here.
when i run
rexster.getGraphNames()
my only result is graph, when i ran a gremlin instance directly over titan i had
tmp
and created a graph called
mygraph
i have been loooking around and havent found anything
Titan Server will only host a single instance of a graph. Therefore, rexster.getGraphNames() will always only return one graph and it will always be called graph.
Creating a graph called mygraph with the Gremlin REPL won't connect Titan Server to the graph unless you've configured it to do so and even then, it will still be referred to by Titan Server as just graph.
Is it possible to setup HSQLDB in a way, so that the files with the db information are written into memory instead of using actual files? I want to use hsqldb to export some data structures together with hibernate mappings. Is is, however, not possible to write temporary files, so that I need to generate the files in-memory and return a stream with their contents as a response.
Setting hsqldb to use nio seems not to be a solution, because there is no way to get hold of those files before they get written onto the filesystem.
What I'm thinking of is a protocol handler for hsqldb, but I didn't find a suitable solution yet.
Just to describe in other words: A hack solution would be to pass hsqldb a stream or several streams. It would then during its operation write data into those streams. After all data is written, the user of the db could then use those streams to send it back over the network.
Yes, of course, we use it all the time for integration testing.
use as url : jdbc:hsqldb:mem:aname
see here for more details
DbUnit offers a handy database dump method as part of their package :
// database connection
Class driverClass = Class.forName("org.hsqldb.jdbcDriver");
Connection jdbcConnection = DriverManager.getConnection(
"jdbc:hsqldb:sample", "sa", "");
IDatabaseConnection connection = new DatabaseConnection(jdbcConnection);
// full database export
IDataSet fullDataSet = connection.createDataSet();
FlatXmlDataSet.write(fullDataSet, new FileOutputStream("full.xml"));
see DbUnit FAQ for more details. Of course there are routines to restore the data, as that is actually the puropose of the package : prepare a test database for integration testing. Usually we do this with an annotation, but you'll have to use tha API for that.