Monday, October 27, 2014

an application web java to insert data into a database oracle from xml files








I am going to analyze the first sentence for you, the rest is up to you:








i want to create an application







We're talking Swing, AWT, SWT, JavaFX, Web-based, server side...?



wich can handle xml files







Ah, you would need an XML parser for that. If you choose the Java built-in libraries, you'll end up using DOM or SAX. There are hundreds of other XML parsing libraries out there, so pick one you are comfortable with. (Open Source XML Parsers in Java). My guess: you'll most likely end up using the built-in XML parsers. Lots of good examples to be found for those. (Starts here: Trail: Java API for XML Processing (JAXP) (The JavaĆ¢„¢ Tutorials)). Are you going to upload those files to the server? Here's a page that will keep you busy for a day or two: java - How to upload files to server using JSP/Servlet? - Stack Overflow. This automatically implies you need to learn servlets.



display xml files's data on a html page







There we go, a web application. So you need to learn HTML, probably some CSS as well. You would also need a language to create the dynamic pages. JSP, JSF, Spring MVC with templates are some of your options. Probably JSP is the easiest in your situation (Again, loads of examples available). Then you would need a webserver component who can execute all that code that generates the page. Tomcat, Jetty, JBoss, Wildfly, Glassfish, JOnAS, Geronimo, TomEE. Again, try one out, and see if you like it.



insert those data into an oracle database.







And there is a database. So you have to learn JDBC. Grab the Oracle driver from the Oracle pages (JDBC/UCP Download Page). The interwebz is full of examples on how to connect to Oracle. JDBC is learned here: Lesson: JDBC Basics (The JavaĆ¢„¢ Tutorials > JDBC(TM) Database Access)



Now you nailed all the components, it's time to learn how to run your application. You have to learn how to create JARs, WARs, maybe an EAR, and deploy those on the server. Getting the server configuration right can be a bit tricky, so be prepared to dig around countless XML files too... (Well, at least WildFly has only ONE config file thee days.)








I probably left stuff out, but as you can see, such a simple first sentence can explode in your face if you study exactly what the requirements are. Lesson learned: if you write down a "single line requirement application"™, study EACH and EVERY word of your sentence and see what it means. For example, if you have the word "web" in there, that will all of a sudden add lots of complexity around your little project.








I won't say anything about the time it takes. That all depends on how much time you can invest, how good a learner you are, what the restrictions are, your age, background, experience, ...















No comments:

Post a Comment