Sorry for this trivial question, but I am new to programming and I wanted to create a Java app that can be distributed to other computers without having to install database on that computer.
The app is similar to an address book app where you store details about a person. Is there a way to create something like that using netbeans which does not require a database or is there any other way to go about it..
I have searched for answers, but I guess I am not searching for the right keywords which I'd appreciate if someone could enlighten me with.
PS: I know how to create an app like that in netbeans which is connected to a database (Mysql or Postgresql) but they cannot be moved from one computer to other? Or can it be? I don't know.
Thanks you in advance..
When I want to make a Java program relying on a database and which is lightweight and which doesn't appear to have any other dependencies than a JVM, I use Apache Derby (JavaDB).
It is a pure Java database engine which you can embed in your Java application. Very small footprint. I usually package the program with a SQL file for creating the database structure and another one for populating it. Worth taking a look IMO.
EDIT: Just saving you the search... If you try DerbyDB, there is a little something you want to know (in case you also have that syndrome of not reading manuals)... When you close Derby, it throws exceptions if it went wrong AND if it went well. You'll receive exceptions with exception.getSQLState().equals("08006") and "XJ015". These are for successful shutdown; don't mind them. On connection to Derby, you'll get exception.getErrorCode() == 40000 if the database was not yet created; just create it. (These exceptions are all SQLException instances.)
If your application has a database back-end, then you will require database software on either the computer where the application is running, or on a remote server.
If you want the application and database to be portable, you can use something like SQLite (an embedded SQL database engine) or even flat files.
You do not have to move the database to any computer, what you can do is write some SQL scripts to generate the tables(and populate, if necessary) needed for application, and it can work on any computer.
Related
I am currently writing a database system in Java that writes and reads to a MySQL database hosted on XAMPP. The system is fully up and running using MySQL commands to select, update, add, delete etc.
The issue is that we are currently using an old database written in Visual FoxPro that has its tables stored as .DBF files. Rather than taking a few years to get a fully working system and then moving everybody over to the MySQL system at once, we would like to have both systems working concurrently with gradually more people beginning to move over and use the MySQL system.
This is where I am having issues. Is there a way to both update a MySQL table and .DBF file when a job is added through the Java program? Is it as simple as using a MySQL command to directly modify the file? I understand there could be possibilities in Python or PHP however I have never learnt either of these languages and would prefer an easier solution.
Trying to keep two databases in synch is a bad idea. If you miss something and the data no longer matches, how will you know which is right? (A man with one clock always knows what time it is; a man with two is never sure.)
If the existing system is complex enough, maybe consider moving one module at a time.
If the existing system is well-written, it might be possible to switch it to work with MySQL without too much effort. That said, my experience is that very few applications are well enough designed and written to make that a simple task.
Alternatively, you might set up your new system with some kind of wrapper that talks to the existing DBFs until you're done and then can easily switch to MySQL.
Before I started learning and using Java I used VB. In VB, a program can open a Microsoft Access database file and view/edit the records. VB has a component that handles the file and parsing. What I am looking for is a Java program that can open a database file directly. What I am not looking for is Java communicating with a SQL server a database server or any other kind of server. I have tried to search the net for Java and databases but all I am able to find is Java protocols that communicate with a server or a Java server service. Those items fill the search records on all of the search engines I have tried. I have found that DB's can be XML, and that Java can open them but, it seems that it no longer preserves the relational aspects. I may be wrong on that fact, I am uncertain.
A. Can Java open a local DB file?
B. Can that preserve the relational aspects?C. Can multiple Java programs open the same DB file?
D. If a Java program on computer A modifies the DB file will the Java program on computer B know about that change and update itself?
Assuming they are not modifying the same record. The type of DB file is not that important to but it would be nice if it could be opened by MS Access. It would also be nice if it could be open by JAVADB. Neither of those two are required.
E. what kind of components or projects could meet this need?
Pure Java hasn't graphic design. Some degree of design of databases have IDE, for example Eclipse in perspectives: Database Debug, Database development. Can view tables, design columns etc.
It isn't full desktop tool for (semi) amateur computer worker.
In Java can write full comfortable user database program (in example Open Office "Base" has some dependencies to Java), with filling similar to entry level access.
For simpler database like sqlite there are several java projects that you can use, for example sqlite 4 java.
Sqlite is pretty good these days and for small databases a good choice.
I want to make a form or applet that will serve as GUI to a "database". The basic outline of it will be just a menu where people can put in a date and then all of the items related to that date will show up. I also want to have an insert option where people can add information for a date.
However, I was thinking if this could be possible with creating a database. I want to have this be pretty portable and give it to anyone so don't want to have to deal with connecting to database and installing DB server and all that.
Is it possible to keep all the data within the program and the filesize of the program just grows dynamically as more information is put in?
There are several "stand alone" or "single user" database engines around.
H2
HSQLDB
As I understand it, Apache Derby and even Java DB can be configured for "single user" operation, but you would need to verify this.
If you don't care about having a Java based database, you could also look at SQLLite
Applets have very restrictive security constraints, generally meaning that they can't read or write files to a local disk. You can run a in memory database, but once the applet/database is closed, the data is lost
There is a very lightweight file DBMS called Derby, created by Apache. Take a look at it here: http://db.apache.org/derby/
It's free and simple to use. It is not a very powerful solution, but it does sound like something you need.
First of all, I'm sorry for a long explanation.
I need to develop a desktop app that will enable users to enter patients lab results for tracking diabetes treatment.
I usually code in php/mysql, but I'm not allowed to use it (my first choice was to use LAMP / XAMPP, but was told not to do so). I was told to use MS Access, as the easiest tool, but since I've never used it before, it gave me a lot of headache. Its wizards are great, but I needed to use data from several tables in my forms, and was simply unable to efficiently do so.
So, here is my question: What sort of db can I use with Java to create such an Application? As I said, I'm most comfortable with PHP/MYSQL combination, but during my studies I also used Java quite a lot. If I could find some sort of 'template' for such an application, I could probably create this easily.
I found this http://netbeans.org/kb/docs/java/gui-db.html using google. How complicated is this?
I need to create this ASAP, since I need to get this App to a team of medical staff, since I need this data to use as datasets for my MSc thesis (related to case based reasoning). I'm really behind schedule here :). And someone will probably break my neck if I don't develop it in a few days and start working on a theoretical part of my thesis.
Thank you in advance.
Okay, this one is near and dear having just been diagnosed as pre-diabetic.
What's not completely clear from your description is if you are keeping a separate database for each instance of the app, or are you sharing the data in one big remote database?
And how much data are you expecting?
If it's just for each instance, then any old database will work; the lightest weight one is actually probably sqlite3, but since you're in a hurry and used to LAMP, mysql will certainly work.
For remote data, go with mysql.
Either way around, there are plenty of ways to connect to the database, most all of them based on JDBC. It seems like you basiucally need two tables: patient, and labs. Patient will be something like <name,dob,ssan,address>, and labs something like <ssan, labtype, value, units>. SSAN would be the key and a record would be something like
123-45-6789|A1C| 6.0|pct glucolated
In that case, I'd just make the tables, have two forms with the data, and don't try for anything too fancy.
Update
Okay, from your comments, yes, either use Derby or just use text files. Do you need any particularly complicated queries? In the Old Days we would just have made something like a CSV file and read it into memory.
Oh, and look into Java Web Start for distributing the app.
You can use Java to connect to a database via JDBC. Check out this tutorial. http://download.oracle.com/javase/tutorial/jdbc/index.html. You can use mySQL as your database. You can also use embedded databases such as derby which don't require an external database application.
Here are 2 tutoriala how to build CRUD application on top of the NetBeans Platform (a Swing-based RCP):
http://platform.netbeans.org/tutorials/nbm-maven-crud.html
http://platform.netbeans.org/tutorials/nbm-crud.html
I've tried searching for similar questions here and I don't think I've found anything that matches what I'm looking for. I would like to know where to start in developing a (most likely) database-driven Java application that could keep track of customers, invoices, and quotes for my dad's auto shop. There will be a couple computers in the shop that will need access to it.
I was thinking of having a server in there to handle the database and let whatever machines need to access it use a client app.
Almost all of my experience is in a LAMP environment but I have been trying to learn as much as I can about Java and feel pretty comfortable playing with it in Netbeans or Eclipse.
I'm not asking anyone to tell me how to make it or anything. I would just like to know where to start learning. Is MySQL a good match with Java or should I use something else? I've been wanting to learn Java and I figured this would be a good project to learn on but everything I read seems to give only bits and pieces of what I want to know.
Java and MySQL work well together. Here are some things I would recommend to get started:
JDBC (Java Database Connector) - use it to connect to MySQL
Swing programming - used to create the GUI front end that users will interact with. While NetBeans has a drag and drop GUI builder interface, actually understanding what's going on under the hood is very important.
GlazedLists is a great project for showing dynamic content in table format, such that you can easily filter, sort, etc. Given you will probably have table views of customers, etc., I would look into this
If I were you I would definitely set the bar a little bit lower and try some easier projects to start with (ones that do not require database connectivity, for instance). Once you're a little more advanced with Java, then I'd start work integrating a MySQL table with your app.
I think that most of the answers to this question will prove useful as a starting point
You'll never find a complete subject list to learn java or any other tecnology, I suggest that you should start by writing down the requirements for the project and start "trying/failing" at what you want to do. Bits and Pieces are a very good way to learn.
You could try building different test applications, to get the feel of java, and slowly start using all parts needed to build your application. Common concepts used in small database-driven Java applications are:
JDBC, a java database connector
A client/server architecture (needed if multiple clients need to keep their data synchronized)
Synchronization
A swing GUI
A learning path that worked for me was:
Build a command-line driven java application
Build a test application with a graphical user interface (GUI).
Build a test application with a client/server architecture, but with only one client
Build a test application with a client/server architecture, connect multiple clients and keep them synchronized.
Build a java application with a JDBC database connector, set up a MySQL server and connect the server in your client/server architecture to it.
You can search for each of the concepts on the internet. It should be easy to find tutorials that will teach you how to use them.
MySQL should work well with Java.
In any case, if you use JDBC (a generic API to access SQL databases, part of the standard Java library), you should be quite independent of what underlying database you are using (apart from vendor-specific SQL extensions).