VoltDB: How to start or compile the database programmatically? - java

I am wondering if VoltDB can be started and controlled using plain java. Since the voltdb is provided as Java implementation it should be possible to control and start / stop a single database / server instance from within a java program.
At least the compiling of a DLL and Procedures inside a jar should be possible to be triggered automatically.
I want to faciliate this in a unit test.

The VoltDB wiki on Github has an article, Using Eclipse to Develop and Debug VoltDB Client Applications, that describes how to set up Eclipse to test a java stored procedure.

Related

Can I use MySQL from AWS Lambda in Python?

Is the MySQL connector for Python or some equivalent module available in a form I can zip up and included in an AWS Lambda function, or is that just asking for trouble? Apparently Lambda functions written in Node.js can use a builtin library to talk to MySQL on RDS, but I don't see an obvious way to do that in Python.
I wouldn't want to try to install something that takes a long time or requires any assumptions about the underlying operating system. On Windows at least, it's a whole separate installer.
Same question for Java: does this work out of the box, or are there machinations necessary to package a MySQL jar file?
If in some cases you need to uses native library (which mysql should have), you can uses pure python implementation using PyMySQL, and include it in the deployment package of lambda.
More detail on how to create deployment package for python is here https://docs.aws.amazon.com/lambda/latest/dg/lambda-python-how-to-create-deployment-package.html
See the advanced version.
For java, I guess it will work out of the box as long as you include all dependency in jar.
I think I got it. Being on Windows added some steps.
I got Python 2.7.10, which comes with Pip. I then installed mysql-connector-python using the trick here.

Debugging between JRuby and Java

I have a large Java project that uses some Ruby scripts (primarily because of Ruby's support for "yield"). The Ruby code calls Java code which calls more Ruby code. It's very interleaved, but everything is driven from Java.
I'm using embedded jruby-standalone and building a jar-with-dependencies (via maven). I'm using a maven plugin to run jrubyc and generate .java files which maven compiles for me.
When I run the jar-with-dependencies, I can attach my debugger to the Java process with no problems, but I'd really love to be able to debug the Ruby code. Is there a solution for this?
I'm not launching any kind of jruby executable to which I could attach arguments. It's embedded in the jar and invoked via java -jar.
You could use the gem pry-remote.
Unlike pry, it does not require the process to be launched from a terminal (or a terminal emulator if you're on Windows).
It's not really a debugger per se, but if you add binding.remote_pry in your code where you wish to observe and react within that context (you could for example catch an exception), this would put pry in waiting mode for a remote connection, and from another terminal you should be able to connect to this process and debug it.
2 minutes hands-on tutorial is available here.
Drawbacks:
you cannot have 2 pry remote sessions.
your code must contain the right 'debugging' condition
I use this in pre-deployment environments when developing web apps with jruby, h2 and jetty server.
Good luck!

GAE multi-module, multi-language application on localhost

I have a multi-module GAE Application that is structured like this:
a Python27 module, that is a regular web application. This Python app uses the Datastore API. Regular, boring web app.
a Java module (another web application) that hooks on the Datastore calls (calls made by the Python web app), and displays aggregated data about the recorded Datastore calls.
I have been able to deploy this application on the GAE cloud, and everything works fine.
However, problems arise when I want to run my application on localhost.
The Python module must be started using the Python SDK. The Java module must be started using the Java SDK.
However, the 2 SDK's do not seem to share the same datastore (I believe the 2 SDKs write/read to separate files on disk).
It seems to me that the 2 SDK's also differ in the advancement of the Development Console implementation.
The Python SDK sports a cleaner, more "recent-looking" Development Console (akin to the new console.developers.google.com console) than the Java SDK, which has the old-looking version of the Development Console (akin to the old appspot.com console)
So my question is, is there a way to boot 2+ modules (in different languages: Python, Java) that share the same Datastore files? That'd be nice, since it would allow the Java module to hook on the Python Datastore calls, which does not seem to be possible at the moment.
You might be able to do something similar by using "appscale" (an open source project that could be able to help you, if you setup Virtual Box and load the image on it). Look at community.appscale.com
Another way (mind you, this is tricky) would be to :
1- deploy your python as a standalone project on localhost:9000
2- deploy your java as a standalone project on localhost:8000
3- Change your python and java code so that when they are in Dev, they hit the right localhost (java
hits localhost:9000 and python hits localhost:8000)
4- Try, like #tx802 suggested, to specify a path to local_db.
I am not sure either method works, but I figure they are both worth trying at the very least.

How to embed MySQL Database in a Java Application

It used to be that you could use Connector/MXJ to embed a MySQL Database in to a Java Application, however the Connector/MXJ project has been EOL'd by Oracle (thanks Larry) so I am looking for the best way to accomplish my goal.
Our application ships with an embedded Tomcat and JRE and we would like to embed the MySQL database as well (don't ask if we can use some other database engine - it has to be MySQL). I can't find any good documentation or answers on the best way to do this so here are the thoughts that I have come up with:
Simply launch the executable to startup mysqld as part of the application's startup script
Write/Use a JNI wrapper around libmysqld to startup the server at application start and stop it at application stop (this would be the preferred method)
For the second (preferred) option, I don't think writing a JNI wrapper around the libmysqld calls would be too difficult, however I am wondering if that would even work since libmysqld only provides access to code running in the same process (no named pipes or tcp access). Would a process kicked off within a running java app allow the parent application to access the database?
Perhaps try this. It's for MariaDB, which may be ok, or it might even work with MySQL since they should be largely compatible.
https://github.com/vorburger/MariaDB4j

How do I debug Java code running inside a JVM hosted by my C++ application?

I have a C++ application that uses the Java Native Interface and creates a JVM in order to execute Java code. How can I debug this Java code while it is being executed within my C++ application? I have all the relevant Java source code, and I'd like to set breakpoints and watch object data within Eclipse.
I've heard of JDPA and JDWP as tools to accomplish this, but I have no idea about the specific steps. Is there a tutorial for this kind of debugging situation?
This EclipseZone article is a few years old but I think the basic workflow is the same.
Enable remote debugging when starting your JVM within JNI (using the JavaVMInitArgs.JavaVMOption array, see the spec on JNI_CreateJavaVM).
You should then be able to follow the EclipseZone steps using localhost as your remote site.
You could run jdb.exe from your c++ application. Here is a nice article that can set you in the right direction.
http://www.javaworld.com/javaworld/javaqa/2000-06/04-qa-0623-jdb.html
Cheers!

Categories

Resources