I have made a simple J2EE web application which has few pages which pick up and displays data from mysql database. I need to send this project to someone as a proof of my project work. How do I send it?
I am using Netbean6.5 IDE and mysql database. I have included the driver in the library folder of the web project in netbeans. Now I want to know that if I zip the project and mail it to someone, will he be able to run my project. And how to the mail the database in mysql?
It can be done in different way. You can create a script file (.sql) which will do all the database specific job like creating tables and loading sample data. Package your web application as war file. And write a java file which calls the .sql file and deploy the war file. Create a jar like setup.jar and put the java file there, change the Manifest.MF file of the jar so that if some one clicks the jar it loads the db and then deploy the webapp. Providing a readme file will be a good idea. Instead of jar file you can create a .bat file in which also do the same. Or you can work with ANT script to do all the things starting from database set up to deploying the web application.
Java Programmer | SCJP 1.5 | SCWCD 1.4
Joined: Nov 10, 2009
thanks for reply but I could not digest much. Will it not work if I just create a zip containing the website's folder and the mysql's data snapshot. Is there any way I could create a snapshot of the data???
Please specify me detailed steps. I have no idea as to how to create this .sql sript file etc....
That could work but then you're assuming that (s)he has mysql installed and that it's bound to the same port number.
What you could do, but it's very overkill, is create a virtual machine, install mysql, appserver and your app. Create the necessary services and give him/her that.
Or just open your ports for the app, mail the code and direct him/her to the website on your machine.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Joined: Jun 26, 2007
If you send a snapshot then he/she have to look into it and manually entry the data into to database and before that the database need to be locally created. That's why I told about the .sql file which will contain the sql commands to create and load the test data. And the person whom you are sending the data if unaware of sql commands then it's difficult. So if you put the create and insert sql commands in a file and save it with .sql extension he/she can directly run it. But if your database is available in some server and the person whom you are sending the code have permission to access then all these database stuff not required. Only the webapp need to be deployed. In the same way if the app server is running in network and he/she is in the same network group then nothing required, you need to only send the link of your welcome page.
If it's just a small project, why use MySql at all? Use Hsqldb and ship the complete DB with the application - no setup, no nothing.
Joined: Jun 26, 2007
Use Hsqldb and ship the complete DB with the application - no setup, no nothing
Completely agreed to Ulf. But still if we have to do it with MYSQL/Oracle then what will be the approach? I had also face this type of problem. Is there any 3rd party packaging tool available? Or we need to follow any of the above approach.