> LITT Vincent wrote:
>
> Hi,
> I'd like to use a Java Bean to access a Database, I've written it and
> compiled it. Then I've compressed it in a .jar file. In addition I've
> copied the .jar file in the /javaWebServer2.0/lib directory. Then I've
> restarted the JWS.
>
> But when I try to load it from a .jsp page I have the following error
> message :
> Error during page parsing:
> com.sun.server.http.pagecompile.jsp.JspException: Class:
> beans.DbAccess.DbBean not found
>
> The bean I've written is :
>
> package beans.DbAccess;
>
> import java.sql.*;
> import java.io.*;
>
> public class DbBean implements Serializable // I've tried without
> "implements Serializable" ...
> {
> private String dbUrl;
> private String dbServerUrl = "schiratti-nt:1521:deve";
> private String dbDriver;
> private String login="tarifdba";
> private String password="tarifdba";
>
> private Connection dbCon;
>
> public DbBean()
> {
I think that the problem is here, it should be
String FullUrl = "jdbc:oracle:thin:" + login +"/" + password + "@" +
dbServerUrl;
> String FullUrl = "jdbc:oracle:thin:@"+dbServerUrl, login, password
> ;
> setDbDriver("oracle.jdbc.driver.OracleDriver");
>
> setDbUrl(FullUrl);
> }
>
> public boolean connect() throws ClassNotFoundException, SQLException
>
> {
> Class.forName(this.getDbDriver());
> dbCon = DriverManager.getConnection(this.getDbUrl());
> return true;
> }
>
> public void close() throws SQLException
> {
> dbCon.close();
> }
>
> public ResultSet execSQL(String sql) throws SQLException
> {
> Statement s = dbCon.createStatement();
> ResultSet r = s.executeQuery(sql);
> return ( r == null ) ? null : r;
> }
>
> public String getDbDriver()
> {
> return this.dbDriver;
> }
>
> public String getDbUrl ()
> {
> return this.dbUrl;
> }
>
> public void setDbDriver(String newValue)
> {
> this.dbDriver = newValue;
> }
>
> public void setDbUrl (String newValue)
> {
> this.dbUrl = newValue;
> }
> }
>
> and the jsp page is :
>
> <html>
> <body>
> <%@page language="java" import="java.sql.*"%>
>
> <jsp:useBean id="db" scope="page" class="beans.DbAccess.DbBean" />
>
> <%! ResultSet rs =null; %>
>
> <%rs = db.execSQL("select VDR_ID from vendeur"); %>
>
> <%= rs.getString("VDR_ID") %>
>
> </body>
> </htm>
>
> If anyone could help me ...
>
> Thanks
>
> Vincent
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".