How do you access a database from a java program an ordinary desktop? I've practised doing it after installina database server. You start the server and then your programs work. But I can't ask each and every ordinary user to install a database server and start it up every time they want to use my program! I want to write a small program (no internet or network access) that stores info. in an access or mySQL datbase and reads/writes to/from the database. Isn't this possiblewithout the server? I've written little programs in VisualJ++ that had database access although I never installed nor started and stopped a server, how was that possible? I've just got a gap in my understandiung you could drive a truck through...
Elouise, If a database is already installed, you could call a batch file to start it up. However, most users don't have a database on their PC. Since you don't have internet access, you could use a flat file or XML file to persist the data. Some IDEs give you an embedded database. I'm not sure if that is what Visual J++ was doing, but it's a possibility.
I was planning to include the access database (the .mdb file) in the same location as my program. But the PC does not have MS Access installed. Will a batch file (I'll have to look up what that is) work under these circumstances? What are some java IDEs that giver you an embedded database (cheapest first please)? [ March 07, 2004: Message edited by: Elouise Kivineva ] [ March 07, 2004: Message edited by: Elouise Kivineva ]
What is your goal? Do you want your application accessible by other users, where you give them the ability to read/write information to a persistant storage(database)? Also, If I am not mistaken, I would think you will need MSAccess, at least to give you quick access to the database(.i.e. table created, modify data). Craig
author & internet detective
The .mdb files doesn't help unless the user has access installed. I don't think it can be installed with a batch file. (It could be started with one if it was already installed.) There are also probably licensing issues with trying to deploy a database with your application. The IDEs that give you an embedded database simulate a server side database. They wouldn't help with what you are trying to do because they don't let you deploy the database.
Joined: Mar 19, 2002
[QOUTE] But I can't ask each and every ordinary user to install a database server and start it up every time they want to use my program! I want to write a small program (no internet or network access) that stores info. in an access or mySQL datbase and reads/writes to/from the database. Isn't this possiblewithout the server? [/QOUTE]
Well, without the use of an internet/intranet or network access, you are kind of limited on providing user's access to your application without asking the user to do too much. And if you do decide to go with MSAccess instead of an SQL Server type database, you really are placing a limit on your application's flexibility. I don't think the "Server"(I am assuming you mean database server) is going to be a hurdle, but the way the user will access your application minus a internet/intranet or network access, will be a hurdle. The only alternative I can think of is RMI or some type of Client/Socket communication. I don't know enough about, but I am sure the ranchers over at the Distributed Java forum can shed some light on your design. Craig.
Joined: Feb 07, 2002
I want to store employee vacation data and have a program that lets the user add vacation periods (start date, end date). The database would store employee data needed by payroll (SSN, total vacation days earned , etc.). The program counts the number of vacation days in the period given (ignores weekends and holidays) and computes the number of days still available for use. I could use this program to let our many managers input vacation days w/o allowing the risk of their counting vacation days wrong and to prepare monthly reports for payroll that include all our employee vacation days to be paid that month - in one report and in exactly the format payroll has requested. I could store the data in a text file (one per employee) but a database would be so much easier. I could create this program in 2 hours with VisualJ++ and I thought it was such a lousy tool (fake java + fake VB moulded together). I'm just finding it hard to accept that w/o Microsoft's help this is so vastly more difficult.
Originally posted by Elouise Kivineva: But the PC does not have MS Access installed. Will a batch file (I'll have to look up what that is) work under these circumstances?
I havent used it that way myself, but I think most of the 'server' editions of windows include the Jet database access engine which will allow you to use and access (or maybe even create) a MS Access database programatically. Try setting up a data-source through the ODBC control applet, and accessing that datasource through JDBC on a PC that does not have MS Access. That is all I can tell you...you may have to do a bit of research or even go through MSDN (which is always a nightmare for me)
I am still not quite sure on what direction the design of your application is headed. OPTION 1 Do you want all of the managers and users to access one version of your application(JAVA GUI), whether the persistant storage is a database server or an non-server database(i.e. MSAccess, XML, TextFile)? If so, you need a way that the Managers and users can easily access your application from their PC(i.e. network, internet/intranet etc). The web access would require at the minimum, knowledge of writing an Applet or if you want to go all out you can use SERVLET/JSP etc. The web access is alot more involved than the java GUI application. For example you can place your GUI in "shared" folder on the network, the path of the MSAccess database is hardcoded in your program. You provide instructions on how each user can access your application i.e. maybe a desktop link that points to your application. Modifications are easier, the GUI is in one central location. All of the information to generate the payroll report is stored in one location.
OPTION 2 I am assuming you do not want each user to have their own version of your GUI and database installed on each user's and manager's PC. This would be a maintanence nightmare. Everytime you would have to make a modification to the GUI, you would have to ask each user and manager to install the newer version. And also you stated that not every computer or any computer has MSAccess installed on it, etc. So each computer will need MSAccess. You would have to find a way to consolidate the information from each database to create the payroll report. And if the users' and managers' computers are not linked together through some kind of network, that is the only way I can see your application working. Whether you use Visual J++, Visual Basic or Java etc. Writing the problem is relatively easy compared to making the transition of providing easy access to your GUI, without asking the user community to do to much work. I don't think I covered everything, but I hope this helps. Craig.
author & internet detective
If you after a nice light-weight free DB that can be bundled with your application, try hypersonic DB http://hsqldb.sourceforge.net/ Can be run in-process, or as a standalone server. For small DB's, it's a blast. Won't solve your RAD needs, but you can at least avoid the requirement of having Access/SQL Server what have you installed on the customer's PC.