I have a question about stored procedures in Neo4j. I already succesfully wrote a few procedures in Java and got them working with Neo4j 3.0.1. However I would like to try to write a procedure in other JVM laguage-Clojure. As I am not so familiar with this language I would like to know, if any of you had tried to do something similar? Is it even possible?
I have also researched the possibility to call a clojure program from java, but have not jet been successful.
Related
I need to store and load some data in a C++ application. This data is basically going to end up as a set of tables as per a relational database.
I write the data to tables using something like csv format, then parse them myself and apply the database logic I need in my C++ code. But it seems stupid to reinvent the wheel with this and end up effectively writing my own database engine.
However, using something like a MySQL database seems like massive overkill for what is going to be a single user local system. I have tried setting up a MySQL daemon on my Windows system and I found it rather complex and possibly even impossible without admin privileges. It would be a serious obstacle to deployment as it would need each user's system to have MySQL set up and running.
Is there a reasonable middle ground solution? Something that can provide me with a simple database, accessible from C++, without all the complexities of setting up a full MySQL install?
NB. I have edited this question such that I hope it satisfies those who have voted to close the question. I am not asking for a recommendation for a tool, or someone's favourite tool or the best tools. That would be asking which database engine should I use. I am asking for what tools and design patterns are available to solve a specific programming problem - i.e. how can I get access to database like functionality from a C++ program, without writing my own database engine, nor setting up a full database server. This is conceptually no different to asking e.g. How do I print out the contents of a vector? - it's just a bigger problem. I have described the problem and what has been done so far to solve it. My understanding from the On Topic Page is that this is within scope.
You can try sqlite.
Here are some simple code examples: https://www.tutorialspoint.com/sqlite/sqlite_c_cpp.htm
I am writing a C++ application that embeds TCL and for its database operations I am also embedding SQLite in it. I would like to be able to do the following:
Write TCL scripts for the embedded SQLite from the embedded TCL interpeter.
Pass an SQLite connection from the embedded TCL interpreter to C++ and use it in C++ for db operations, as well as the other way around.
I would appreciate suggestions.
Tcl 8.6 should ship with a build of the SQLite interface, the sqlite3 package. However, there's no (official) way to share a database connection from the package with your C++ code; there's simply no API in the package that you can call from C++ to get the connection. The official workaround is to create another connection from your C++ code and that shouldn't be too onerous unless you're doing weird mixing of things between queries in the two language bindings, a very much not normal use case.
You can hack it by using Tcl_GetCommandInfo() to retrieve, among other things, the Tcl database handle command's ClientData field. That can then be cast to a pointer to a structure whose first field is a sqlite3* handle, much as you'd obtain with sqlite3_open(). Which is messy and fragile. Also, you'd still need to respect the usual rules, such as needing to keep to a single thread. This really isn't what I'd recommend!
The computer has already been installed ORACLE. But I didn't try ORACLE before, I just use sqlite...So, for now I want to create a database locally, and just insert one table. I want to use a test C++ program to read and write in this database. Is there something useful for using API about this? BTW, in the computer I saw SQL plus and SQL developer, but I didn't find the DBCA, which I know can be used to create table...help me, thanks a lot!!
BTW, my supervisor wants to me to test different kinds of database, which will be written in my report. So I want to test different kinds of databases, for the data is quite small, just 100 lines in a table is enough, but it will be applied in a big program, so I need to try different kinds of database locally, and not difficult for me to use C++ API...Because I just know little about database. I need some suggestions, thank a lot!
While I wouldn't recommend Oracle for handling small data sets, I do have a pointer to C++ API documentation.
http://www.oracle.com/pls/db112/portal.portal_db?selected=5&frame=
... and scroll to the bottom of the page for links to further information.
There's a choice of either using C++ with Oracle OCI API, or using C++ with Oracle Pro*C precompiler. The precompiler actually does produce code that uses the OCI API.
I have done some work with the Pro*C precompiler (using C as the implementation language, though, not C++), and it wasn't too bad. OCI tends to be quite low-level, but apparently writing direct OCI code has its uses, too.
Is there a dbmaintain like tool for Clojure?
I'd like to use SQL directly for DDL instead of a DSL, using a DSL for DML and queries is fine.
I've written a very simple leiningen plugin for migrations that utilizes plain sql. It runs in the context of a clojure file, so these sql strings can still be dynamically generated.
Check out:
https://github.com/ckuttruff/clj-sql-up
I started the project recently so feedback would be very welcome.
perhaps I'm misunderstanding your question, though it seems that dbmaintain is a tool for automating the deployment and maintenance of SQL database schemas. It is capable of ensuring that the database is in the correct configuration (schemas etc.) to run a particular version of a program. This sounds like dbmaintain would match well with programs written in Clojure so it should be fine to use it as is, unless dbmaintain has some other features that are more tightly intergrated with the code?
Lobos is a similar tool for Clojure. The default way to do DDL is with a Clojure DSL, so it might not fit your requirements.
As there was no dbmaintain integration for Clojure available, we wrote our own https://github.com/mysema/lein-dbmaintain
lein-dbmaintain integrates dbmaintain into leiningen
I'm trying to code a small program for my friend's company. They build metal cabinets and every cabinet is made out of several parts. So when a customer tells them they need a new cabinet, they tell them the single part numbers. My friend needs now a little tool/database where he can look after those part numbers and if there is an entry, he can download the corresponding blueprint (saved as PDF). Of course the program needs also a function to create a new entry and uploading a PDF file with this entry.
The program needs only to be installed local on one windows machine.
Now I need to know if there is maybe a special way to solve this. It would be helpful if someone could give me some keywords, so I can google it and figure out how to begin :)
I have basic skills in C++ and Java and willing to learn new stuff :)
thanks!
Have used sqlite for database applications and found it to have a lot of functionality and speed. It lacks all the advanced database admin stuff but for single user/embedded databases its ideal. I use it over MySQL because of a significant performance improvement.
It has a Java interface via java.sql.Connection.
I think this is a good opportunity to try something else than C++/Java. In your case I would go for Ruby on Rails and for example the PaperClip extension (http://thoughtbot.com/community/) (haven't used PaperClip myself, though). Ruby on Rails is kind of made for this type of problem.