Simple database web application with Eclipse and Glassfish
I just started to learning Eclipse with Glassfish server. I was looking around how can I make simple database web application, but can't figure out yet. I downloaded the Glassfish bundle for Eclipse. I need to create simple database ( perhaps one table ), and connect the database with simple web application. How to do that in Eclipse , 开发者_JAVA百科can you give me some step by step link how can I do this Thank you
For the database you could do worse than use JavaDb, which comes as standard with Java 6. Check out the JDBC tutorial for details on interfacing Java to a database.
If you decide to use Apache Derby as your database, a version of it called JavaDB comes with jee6 + Glassfish bundle, you can read this tutorial about how to connect to it and create tables from within Eclipse. You need to download the Apache Derby plugin.
This has nothing to do with Glassfish, however the example shows you how to connect to it from a normal Java desktop application using JDBC.
This Tip Of The Day seems to have the info you are looking for....
At this point, you have a webapp server and an IDE. Both of which are designed to be semi-agnostic when it comes to databases. The next choice is how you want to interact with the database. Then you should be able to find more information and examples on how to start constructing your webapp.
I'd suggest going with spring and stripes (http://www.springsource.org/ and http://www.stripesframework.org/display/stripes/Home respectively), but that's a personal choice.
精彩评论