Class XXX could not be loaded.

I am facing the above problem even though i have included/imported the class that i want, <%@page language="java" import="java.util.*, xxx" %>can somebody tell me why ?Thanks
[208 byte] By [shawshonga] at [2007-9-19]
# 1
Is it XXX or xxx?
sudha_mpa at 2007-7-8 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 2
yes ... sorry for the typo
shawshonga at 2007-7-8 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 3
1. Do you have XXX.class in your WEB-INF/classes dir?2. Try XXX obj = new XXX(); in your JSP, don't forget to import it.It should work even if it is not there in a package. But including it in a package is also not a bad idea.Sudha
sudha_mpa at 2007-7-8 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 4

Sudha,

Thanks.... i have another question about resultSet.... Below is a piece of my code ...

callableStatement cs = conn.prepareCall(sql);

:

: // register ouput parameter and set input

:

:

bFound = cs.execute();

resultSet rs = cs.getResultSet();

while (rs.next()) {

aaa = rs.getString(1);

:

:// get the output

:

}

My problem is : i always get bFound = False, what wrong with the code ?

appreciate ur guide !! Thanks

shawshonga at 2007-7-8 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 5

This means your stored proc is failing.

Why don't you try something like this,

if(cs.executeUpdate()==0) {

System.out.println("Executed successfully !!!");

resultSet rs = cs.getResultSet();

while (rs.next()) {

aaa = rs.getString(1);

//...

}

} else {

System.out.println("Execution failed !!!");

}

Hope this helps.

Sudha

sudha_mpa at 2007-7-8 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 6

This means your stored proc is failing.

Why don't you try something like this,

if(cs.executeUpdate()==0) {

System.out.println("Executed successfully !!!");

resultSet rs = cs.getResultSet();

while (rs.next()) {

aaa = rs.getString(1);

//...

}

} else {

System.out.println("Execution failed !!!");

}

Hope this helps.

Sudha

sudha_mpa at 2007-7-8 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 7

sudha,

shouldn't be my stored procedure is failing, because if i use cs.executeQuery(), it's working fine, just that there is an error after retrieving of the last row... that's why i use cs.execute(), to prevent the error from occuring.... but i cant go thru the while (rs.next()) loop as the rs is always NULL.

just wonder how can i solve the problem ?

shawshonga at 2007-7-8 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 8
sudha...And my SQL statement is a "SELECT" statement ... so executeUpdate() cannot be used here/// any other suggestion ?
shawshonga at 2007-7-8 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 9
> And my SQL statement is a "SELECT" statement ... so> executeUpdate() cannot be used here/// Then, why are you using CallableStatement? Please stick on to either Statement or PreparedStatement.
sudha_mpa at 2007-7-8 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 10
sudha,now i am confuse .... callableStatement is useful for update/insert and delete only ? and prepareStatement and statement is mainly for "SELECT" ?
shawshonga at 2007-7-8 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 11

> now i am confuse .... callableStatement is useful for

> update/insert and delete only ? and prepareStatement

> and statement is mainly for "SELECT" ?

You are absolutely mistaken.

You can select/update/delete/insert using Statement or PreparedStatement. CallableStatement is mainly for executing SQL Stored procedures. Why don't you read javadocs for Jdk API?

If you want to execute a single SQL statement (it doesn't matter whether it is select/insert/update/delete), you better use Statement.

If you want to execute an sql statement multiple times with different parameters, then use PreparedStatement. PrepareStatement allows you to pre-compile your statement and will be ready to accept parameters from you and execute the query.

Hope this clarifies. Don't forget the duke.

Sudha

sudha_mpa at 2007-7-8 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 12

ok ... i have a precompile SQL statement with multiple output parameters and multiple rows retrieval... i use preparedStatement in my code ... as below :

//declare variables

private Connection conn;

private PreparedStatement ps;

private resultSet rs;

GetDrCrRsnPB_Call = "begin P_GetDrCrRsnPB.SP_GetDrCrRsnPB(?,?,?,?,?,?,?,?,?,?);end;"; // this is my precompile package

ps = conn.prepareStatement(GetDrCrRsnPB_Call);

//set the input

ps.setString(1, iprodgrp);

ps.setString(2, iadjprcs);

rs = ps.executeQuery();

while (rs.next()) {

// get the output

oDrCrIndc = rs.getString(1);

:

:

:

:

}

I got the following error .... "not all variables bound" ... how can i solve this problem ? how can i register output parameter using preparedStatement ?

Please help ...

shawshonga at 2007-7-8 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 13
You need to,1. Use CallableStatement for this instance.2. set all the 10 parameters.3. use, cs.registerOutParameter(int parameterIndex, int sqlType) to register the o/p parameters.4. Then execute the query.Sudha
sudha_mpa at 2007-7-8 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 14
If i use callableStatement, how am i going to use resultSet.next() then ? resultSet is not the method for CallableStatement...
shawshonga at 2007-7-8 > top of java,Enterprise & Remote Computing,Web Tier APIs...