Dear all,
I am creating a system using JSP/Servlet/EJB technologies. The JSP is to
serve as the View, Servlet is the Controller and EJB is the Model to access
an Oracle 7.3 database.
I am new to EJB and I don't know what is the difference between the code of
a normal JDBC program and a JDBC program that is used to access the
database.
This is my code for access an Oracle database, would the code look much
different if it is written for EJB architecture??
try {
conn =
DriverManager.getConnection("jdbc:oracle:thin:@"+host+":"+port+":"+sid,
username,password);
Statement stmt = conn.createStatement();
ResultSet result = stmt.executeQuery("SELECT * FROM ITEMS WHERE GROUP_ID =
"+group_id_str+" ORDER BY PRICE DESC");
while (result.next()) {
item_name = result.getString("NAME");
price = result.getFloat("PRICE");
System.out.println(item_name+" "+String.valueOf(price));
}
} catch (SQLException se) {
System.out.println("Cannot connect to database");
}
Anthony Mak
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
