I've been charged with writing a DB manipulator with java for a project.
My professor gives us material that says to use the sqlj library (Oracle I'm assuming?), but nobody explains where it comes from or how do download it.
I've been looking for hours now.
The SQLJ site?
http://www.sqlj.org/
Unless you mean the executable, but I'm not sure what that is:
http://www.oracleutilities.com/OSUtil/sqlj.html
The jars you're looking for are in Oracle Database Client. You can download it here: http://www.oracle.com/technetwork/database/features/jdbc/index-091264.html
SQLJ is not a library, it is a language extension - this means you'll have to use a preprocessor to compile your java code to .sqlj files, which can then be executed. It's not as simple as including a library.
this might get you started - you will need an Oracle environment on your machine though, I'm not sure if it's freely available
You can download DB2 Express-C and compile your SQLj classes, generate the java files, and access plans for the database.
Usually when you look for libraries, try typing: library-name maven repository, that will usually give you the right library, if not - that means "The library is kinda unusable and there are lots of better tools".
P.S.: Don't listen to your professor, just do it using standard JDBC or JPA.
Related
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.
I need to read BerkeleyDB files from Java.
Oracle has an official Java Edition of BerkeleyDB, but it seems that this uses its own, incompatible binary file format.
What do I do?
According to the Wikipedia page, there are Java bindings for classic Berkeley DB, but they require use of JNI and a native library. Here's a link to the Sleepycat Berkeley DB - Java API documentation.
Berkeley DB can actually store data in 2 different formats, depending on whether you elect to use the SQL API or not. The SQL API is a recent addition, Berkeley DB has historically been a key/value database.
It is true that you need to build the native library and use JNI, but this is to be expected if you want to access files created by a native library. Fortunately, the build process is very simple.
If you are building under Windows, please refer to the installation guide.
For Linux or other *NIX, after you have untarred the file go to the build_unix directory and do one of the following:
If you are using the (standard) key/value interface:
../dist/configure --enable-java --prefix=/usr/local/db
make install
If you are using the SQL API:
../dist/configure --enable-sql --enable-jdbc --prefix=/usr/local/db
make install
(Obviously you can replace --prefix with the install location of your choice)
For more information see the docs page.
Hope that helps, good luck with your project.
I want to create an installer using Java that install at first MySQL. The user tape at first the password of root user. Then the installer copy jar file into program files and create shortcut on desktop.
So my question how to install MySQL automatic via Java. Is there any way??
Thanks in advance.
best regards,
Ali
Depends on the platforms you want to install onto. Basically if you know how to do it via the command line, then you can write a shell script that is executed from Java, or a series of command line statements that are executed from Java to do it.
Since you mention root user, I'm guessing some flavor of linux? Doesn't MySQL already have ways of doing this that come with the installers and/or binary distributions?
This write-up might help you in creating a java installer: Convert Java to EXE (also has information about other platforms)
But, before going for that, I would like to ask you, why do you want o bundle MySQL with your java app? The recommended way, if you want a DBMS bundled in your app can be:
Ask the user the install MySQL him self. You app will use it.
Use SqLite (embedded RDBMS). Or even simpler, Berkley DB for a Key-value store. This approach will be super light and no installation needed.
You can try to perform a 'private' ad-hoc MySQL installation that is only used by your application: that means you will have to copy the binaries (please note they are different for each platform) plus some custom configuration files to a 'mysql' subdirectory of your programs' main directory.
I can assure you it won't be easy and fast to do. You have to struggle a bit making it work under each platform. This kind of stuff is always a bit tricky.
If you prefer to install MySQL in a system-wide manner (as a service, using the provided install package) you'll have to embed the package into your setup program and then use the proper operating system commands to install it. That would be different on each platform, and under Linux you'll have to install the proper package for each distro. Messy.
You can look at some commercial solutions for making Java install programs. See install4j for example.
Shipping MySQL with your Java application is not so easy. Are you sure you need MySQL, and you cannot use some simpler alternatives, like sqlite? If you choose sqlite, there are some 100% java solutions, and that means no difference between platforms and easy deploy of your application.
Think about it, listening to this simple advice can make you save 14-15 hours of work and debugging (with always some possibility of failure, because complex installers do fail).
I did some research on their site, and after some Google-ing, it looks like there are only drivers for C & C++. Is there an open driver that I can use with SQLLite, or is there a way I can use it with JDBC?
UPDATE
I'm doing development on Linux, but I would like to keep my options open. Native libraries would work, but wouldn't give the cross-platform freedom that I'm used to with Java.
I have used org:xerial:sqlite-jdbc
Example Groovy script:
#Grab(group='org.xerial', module='sqlite-jdbc', version='[3.6.4,)')
sql = groovy.sql.Sql.newInstance("jdbc:sqlite:test.db","org.sqlite.JDBC")
sql.execute("create table students(name, age)")
(note: 3.6.4 is not the latest version)
SQLite JDBC is completely written in Java, so there are no external dependencies.
SQLite is a native library - therefore a platform independent solution is not that simple. The SQLiteJDBC project uses a internally complex but working system for accessing SQLite database platform independent (on most platform with a good speed). As the name implies it can be used via JDBC (see code sample on the main page).
If you only need one specific platform you can also use the SQLite Java wrapper. For windows there are pre-compiled binaries; sources are also available.
There is also SQLJet, which is a pure java impl which is compatible with sqlite.
I need to make my Java program as a PlugIn to OME - an Image processing web based s/w having Java API
www.openmicroscopy
OmeroJava is the appropriate API for the latest version of OME (OMERO 4.2), if you are writing a client. If you would like to embed your code inside of Insight (the OMERO Java client), then you should start with How to write a client. Other links to OME-Java libraries are for a legacy version and should not be used.
Looks like the Open Microscopy Java API is worth investigation. If it's not, it's worth highlighting in your question as to why it's not suitable (marked as legacy?)