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, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
