• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Database problems

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have just moved over from Asp and started my writting a small forum (like i did when I learned asp)
1. Trying to pull from a form, in asp I would use:
("INSERT INTO Message (MessageSubject, MessageBody) VALUES ('"&MessageSubject&"' , '"&MessageBody&"' ) ");
How do I do this in jsp?
2. How do I pass the date and time over for when the message was created
3. I think that this can be done by JSP, servlets or beans , is this correct? Which would be the easyest way to learn it, and which would be the best way to do it?
 
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1. Just as there's more to ASP than the SQL statement you listed, there's also more to J2EE. You'll need to create a connection object and do various other minor tasks. This is normally done in JDBC. The SQL code is the same as it would be for ASP.
2. Java has 2 date/time classes - java.util.Date and java.sql.Date. One is more convenient for general date/time manipulation and formatting, the other is designed to fit into databases better. Conversion from one form to the other is fairly simple.
3. "Best" varies with what you need to do. The simplest way to go from an ASP background is probably JSP, as the translation process is pretty much one-to-one. If you feel more comfortable in a code-only environment or have more logic than HTML, servlets are an alternative route - they both compile down to almost the same thing.
J2EE supports 2 different types of Javabeans - simple Javabeans and Enterprise Javabeans. A simple Javabean is more or less equivalent to a COM object, and an EJB to a DCOM object. Beyond that, I recommend you check out your favorite bookstore for J2EE books. If it's anything like the place where I hang out, the only problem you should have is deciding which book you want - they currently devote as much shelf space to Java as they do to VB, C++ and C# combined.
If you're into online reading and/or frugal living, you can also check out the docs at http://java.sun.com
 
Andrew Lock
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
cheers for that.
think i'm going to aim for jsp and servlets and leave beans for while.
brain was fried with the supper easy instal of tomcat etc.
 
New rule: no elephants at the chess tournament. Tiny ads are still okay.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic