Java local database - java

I am creating a piece of software using Java and Eclipse. The software is to be freestanding and not require an internet connection.
The main use of the program requires access to database. I am used to developing for Android where there is an inbuilt MySQL database in every device. Is there a similar thing with Java. I have looked everywhere and have seen references to this kind of thing but have not seen any clear answers. I know there is JDBC, but this seems to be a method of controlling the database rather than creating it.
What I am trying to establish is, is there a pre installed database available to use in Eclipse without any further installation, in the same way as the MySQL Db is available when using Android??
The version of Java I am using is java.runtime.version=1.7.0_40-b43
and I am using Eclipse Kepler Service Release 2

What I am trying to establish is, is there a pre installed database available to use in Eclipse without any further installation, in the same way as the MySQL Db is available when using Android??
First, Android includes SQLite (not mysql). Second, No. No there is not. You could use Derby or SQLite or H2 (or any other pure Java database). As pure Java databases they don't require external installation (but they can be installed externally) and can be run directly in Eclipse.

Would SQLite work for your purposes?
http://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html
It's not pre-installed, but seems like it might be a good fit otherwise:
http://wiki.eclipse.org/Connecting_to_SQLite

Related

my java application setup isn't working because of database [duplicate]

I created a java application that is a front end for a MySQL Database using NetBeans and JDBC.
Now after creating the jar file it runs smoothly on my computer (Since I have the MySQL installed) but, if I run the jar on a different computer it won't work since it does not have the DB the application is using and not even MySQL installed.
So the question is, is it possible to add the database to the executable jar so it will run on any computer without the need for any installation of any software (Except for JRE of course) ?
If yes, how do I go about doing so?
Thanks everyone for the help in advance.
Use derby database. It already included in JDK's db folder when you installed the Java on your computer.
If you purely want to use the database without using the MySql then simply using the collections to create database, then you doesn't need any other database client as like MySql. But you need knowledge of Hibernate, Spring etc.

Can multiple users connect to a Microsoft Access database at the same time using Java?

The question is pretty self-explanatory, but below is some more info about the situation:
I am building a Java program that will be replacing a program that consists of an Excel user interface with an Access database. The Excel program connects to the Access database and communicates with VBA. But, so far there has only ever been one user at a time. Now that the program is due to expand, we need many users to be able to write to any table at the same time.
Access allows multiple users to connect at once, of course. This is not possible in HSQLDB, which is what prompted the question. Obviously, this is better accomplished with a server, but the plan is to build the program using the current database and then accomplish the transition to a server later.
Thanks in advance
In order to support multiple concurrent users (processes) writing to an Access database you must use the Access Database Engine. The options to do that from a Java application are:
Use Java's own JDBC-ODBC Bridge and the Access ODBC driver. (Note that the JDBC-ODBC Bridge was removed from Java 8.)
Use a third-party JDBC-ODBC Bridge and the Access ODBC driver.
Use a third-party JDBC driver that works with the Access Database Engine (if such a thing exists).
Note especially that the UCanAccess JDBC driver does not use the Access Database Engine and therefore does not support multiple concurrent users (processes) writing to the Access database.
You can do it. I have a similar application that I use. In version 1.8 of Java, the ODBC bridge was removed, so you'll have to look into using a separate library to connect, assuming you are using 1.8 or above. For me, it's way slower, but it does work. check out
Removal of JDBC ODBC bridge in java 8
I use "Ucanaccess" for my program, which is one of the suggestions in that question.

The derby database

In the IT class room I constantly hear chat about the derby database not being built for netbeans. I write code in java and becuase I am learning to implement databases and I have the oppurtunity to be taught sql code. My question is, is the derby database not meant for netbeans and if not why why? So far it works fine for me. Our education system is a bit out of order so I like to be well informed about things.(You don't have to worry about making sense about the last statement).I use the database for recording details in shop and company scenarios so far. So answer could relate to this.
The Java DB(Derby) database is Oracle's supported distribution of Apache Derby. Java DB(Derby) is a fully transactional, secure, standards-based database server, written entirely in Java, and fully supports SQL, JDBC API, and Java EE technology. The Java DB database is packaged with the GlassFish application server, and is included in JDK 8(except Mac OS X) as well.
There is a whole official NetBeans IDE Tutorial about Working with the Java DB(Derby) Database. Whoever has suggested you those incorrect details,he might not have got to work with Derby Database OR might be a fan of Oracle/MySQL,etc. databases! But,I and all the commentators post suggest you to move frankly with Derby database as there is no such problem!
Also,I am leaving you the official tutorial's link---> Official NetBeans IDE Tutorial on Java DB(Derby) Database

Deployment of a Swing application that uses a database

I have created a Java Swing application with database in NetBeans IDE. I have a database created directly in NetBeans. How do I arrange that this application will be installed to run outside NetBeans IDE? For example in Windows. When I have applications without database, it is easy; but the database I do not know.
you need to install a database such as:
mysql, microsoft sql, sqlite, etc.
You can also get portable versions of these that only require an unzip and run (e.g. mysql in xampp).
You will need to create a script (either in your program or do it by hand) to create the necessary schema, and tables that are needed.
Your application must have the same credentials for both your database but also within your requests from java.
If your doing the installation by hand you usually do all the above by hand.
The database need not be on the same computer but can be on the same network or also on the internet - but it will have to be somewhere unless your using something portable like sqllite.
If your creating an automated install script you should define that in your question.

SQLite manager, Add on to FireFox

I'm new to databases and i need to use it for a project i am working on, i have the following question.
If we use SQLite manager to create a database on java and then produce a jar file of the complete program. To install this project do we have to always have the SQLite Manager add-on for FireFox for every computer this program is going to be installed on. Despite having the ability to add and remove things from the database in my program in a GUI.
No, it's not necessary to include extra tools if your program contains every functionality that is needed to operate the database. In some cases it's even better when the end user can't directly access the database, to avoid all kinds of data corruption issues.
That being said, it can be nice to offer a generic tool alongside your solution, and SQLite Manager would be an excellent choice. Check out this list of SQLite management tools for other possible choices.
As a sidenote, there are embeddable database engines that are written in Java and may be easier/more natural to integrate in a Java program than SQLIte - examples of this type of product are Apache Derby and H2

Categories