DO NOT REPLY [Bug 16878] - Exception while using (TYPE_SCROLL_INSENSITIVE) ResultSet in Tomcat 4.0

2003-02-09 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16878>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16878

Exception while using (TYPE_SCROLL_INSENSITIVE) ResultSet in Tomcat 4.0

[EMAIL PROTECTED] changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution||INVALID



--- Additional Comments From [EMAIL PROTECTED]  2003-02-10 00:06 ---
JDBC-ODBC bridge is notoriously buggy as well as the 1.4 jdk - please repeat
with test with type 4 driver and/or the 1.3 jdk.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




DO NOT REPLY [Bug 16878] New: - Exception while using (TYPE_SCROLL_INSENSITIVE) ResultSet in Tomcat 4.0

2003-02-07 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16878>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16878

Exception while using (TYPE_SCROLL_INSENSITIVE) ResultSet in Tomcat 4.0

   Summary: Exception while using (TYPE_SCROLL_INSENSITIVE)
    ResultSet in Tomcat 4.0
   Product: Tomcat 4
   Version: 4.0.3 Final
  Platform: Other
OS/Version: Windows NT/2K
Status: UNCONFIRMED
  Severity: Major
  Priority: Other
 Component: Catalina
AssignedTo: [EMAIL PROTECTED]
ReportedBy: [EMAIL PROTECTED]


My program
   Test.java
  1. public static void main(String[] args) throws Exception
  2. {
  3.  Class.forname("sun.jdbc.odbc.JdbcOdbcDriver");
  4.  Connection con=DriverManager.getConnection("jdbc:odbc:test","sa","");
 5.Statement st=con.createStatement
(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
   System.out.println("Success");
 }
With jre 1.4.0_01, in the DOS prompt, this program stoppig at 
line :5.  
With jre 1.4.1._01
I am executing this program successfully in the DOS prompt. But not in 
the Tomcat 4.0.
 
This is detailed description of error:   
With jre 1.4.0_01 

An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0x6D366658
Function=[Unknown.]
Library=(N/A)

NOTE: We are unable to locate the function name symbol for the error
  just occurred. Please refer to release documentation for possible
  reason and solutions.


Current Java thread:
at sun.jdbc.odbc.JdbcOdbc.setStmtAttrPtr(Native Method)
at sun.jdbc.odbc.JdbcOdbc.SQLSetStmtAttrPtr(JdbcOdbc.java:4676)
at sun.jdbc.odbc.JdbcOdbcResultSet.setRowStatusPtr
(JdbcOdbcResultSet.java:4473)
at sun.jdbc.odbc.JdbcOdbcResultSet.initialize
(JdbcOdbcResultSet.java:171)
at sun.jdbc.odbc.JdbcOdbcStatement.getResultSet
(JdbcOdbcStatement.java:423)
- locked <02AD8108> (a sun.jdbc.odbc.JdbcOdbcStatement)
at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery
(JdbcOdbcStatement.java:253)
at Test.getCount(Test.java:28)
at org.apache.jsp.test$jsp._jspService(test$jsp.java:60)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service
(JspServlet.java:202)
at org.apache.jasper.servlet.JspServlet.serviceJspFile
(JspServlet.java:382)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter
(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke
(StandardWrapperValve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke
(StandardContextValve.java:190)
at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:566)
at org.apache.catalina.valves.CertificatesValve.invoke
(CertificatesValve.java:246)
at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke
(StandardContext.java:2343)
at org.apache.catalina.core.StandardHostValve.invoke
(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke
(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke
(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:564)
at org.apache.catalina.valves.AccessLogValve.invoke
(AccessLogValve.java:468)
at org.apache.catalina.core.Stan

RE: ResultSet

2002-05-29 Thread Anand Bashyam Narasimhan

Manuel,

For you to be able to invoke the clone() method on an Object does'nt it have
to implement Cloneable interface. That's the reason why to are getting a
compile time error. 

If JDK is not a constraint you can switch to 1.2 or 1.3.x and use
CachedRowSet which allow you to have bidirectional. Another programmatic
approach would be when you are iterating through the rows to count the rows
push all the data in each row into a data model that mimics each row in the
table and keep adding them in an Array of some sort.

Of course if you don't want to do this...then solution to do "select
count(*)..." would be the option I would go with.

Anand

-Original Message-
From: Manuel Rodriguez Diaz [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 29, 2002 1:00 PM
To: Tomcat Developers List
Subject: Re: ResultSet


Thankyou.
I've just tried this.
In fact i write a select count(1) which is faster (for a reason i don't
know).
The problem is that in many cases i have a group clause that cause problems
with
this method.
So i thought this:

resultset= statement.CreateQuery();
resultset2= resultset;

Obviously, both resultset and resultset2 points the same set of data.
Because i have java 1.1, my resultsets are forward-only. When i loop
resultset
to count, resultset2 loops too.

I've tried to clone the resultset too.
ResultSet temp;
Object aux= new Object();
    aux= (java.lang.Object)rs;
temp= (ResultSet)aux.clone();

But it fails at compilation time. What can i do?

James Mitchell escribió:

> have you tried getting the row count from the db instead of looping
> yourself?
>
> this approach will offload a few resources (counting) back to the db
> (assuming its tiered) where it belongs(IMHO)
>
> //assuming your db supports count() [duh]
> //if you build your sql in chunks
> String sqlSelect = "Select Col1, Col2 "
> String sqlFrom   = "From myTable "
> String sqlWhere  = "Where Col3 = 'SomeVal'";
>
> //typically a helper function
> //execute the sql on your connection
> Resultset rs = getMyResults("Select count(*) as ct " + sqlFrom +
sqlWhere);
> size = rs.getLong("ct")
> //proceed as you did before, but this time you have the row count.
>
> Hope this helps.
>
> James Mitchell
>
> > -----Original Message-
> > From: Manuel Rodriguez Diaz [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, May 28, 2002 12:56 PM
> > To: [EMAIL PROTECTED]
> > Subject: ResultSet
> >
> >
> >
> > Hi all,
> > I'm working with java 1.1. (this is a mandatory requirement).
> > In this version of Java, resultset are "FORWARD ONLY".
> > The fact is that i need to count the rows contained in a resultset
> > before displaying its data and the  way i've thought to do this is read
> > all the resultset.
> > rows= 0;
> > while( rs.next()) {
> > rows++;
> > }
> >
> > With my actual version of java, I would need to re-execute the query
> > again to get the pointer "beforeFirsted".
> > Is there any way to obtain a independent copy of a ResultSet without
> > executing the query again?
> >
> > Thankyou
> >
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




Re: ResultSet

2002-05-29 Thread Manuel Rodriguez Diaz

Thankyou.
I've just tried this.
In fact i write a select count(1) which is faster (for a reason i don't know).
The problem is that in many cases i have a group clause that cause problems with
this method.
So i thought this:

resultset= statement.CreateQuery();
resultset2= resultset;

Obviously, both resultset and resultset2 points the same set of data.
Because i have java 1.1, my resultsets are forward-only. When i loop resultset
to count, resultset2 loops too.

I've tried to clone the resultset too.
ResultSet temp;
Object aux= new Object();
aux= (java.lang.Object)rs;
temp= (ResultSet)aux.clone();

But it fails at compilation time. What can i do?

James Mitchell escribió:

> have you tried getting the row count from the db instead of looping
> yourself?
>
> this approach will offload a few resources (counting) back to the db
> (assuming its tiered) where it belongs(IMHO)
>
> //assuming your db supports count() [duh]
> //if you build your sql in chunks
> String sqlSelect = "Select Col1, Col2 "
> String sqlFrom   = "From myTable "
> String sqlWhere  = "Where Col3 = 'SomeVal'";
>
> //typically a helper function
> //execute the sql on your connection
> Resultset rs = getMyResults("Select count(*) as ct " + sqlFrom + sqlWhere);
> size = rs.getLong("ct")
> //proceed as you did before, but this time you have the row count.
>
> Hope this helps.
>
> James Mitchell
>
> > -Original Message-
> > From: Manuel Rodriguez Diaz [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, May 28, 2002 12:56 PM
> > To: [EMAIL PROTECTED]
> > Subject: ResultSet
> >
> >
> >
> > Hi all,
> > I'm working with java 1.1. (this is a mandatory requirement).
> > In this version of Java, resultset are "FORWARD ONLY".
> > The fact is that i need to count the rows contained in a resultset
> > before displaying its data and the  way i've thought to do this is read
> > all the resultset.
> > rows= 0;
> > while( rs.next()) {
> > rows++;
> > }
> >
> > With my actual version of java, I would need to re-execute the query
> > again to get the pointer "beforeFirsted".
> > Is there any way to obtain a independent copy of a ResultSet without
> > executing the query again?
> >
> > Thankyou
> >
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




RE: ResultSet

2002-05-28 Thread James Mitchell

have you tried getting the row count from the db instead of looping
yourself?

this approach will offload a few resources (counting) back to the db
(assuming its tiered) where it belongs(IMHO)

//assuming your db supports count() [duh]
//if you build your sql in chunks
String sqlSelect = "Select Col1, Col2 "
String sqlFrom   = "From myTable "
String sqlWhere  = "Where Col3 = 'SomeVal'";

//typically a helper function
//execute the sql on your connection
Resultset rs = getMyResults("Select count(*) as ct " + sqlFrom + sqlWhere);
size = rs.getLong("ct")
//proceed as you did before, but this time you have the row count.

Hope this helps.

James Mitchell

> -Original Message-
> From: Manuel Rodriguez Diaz [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, May 28, 2002 12:56 PM
> To: [EMAIL PROTECTED]
> Subject: ResultSet
>
>
>
> Hi all,
> I'm working with java 1.1. (this is a mandatory requirement).
> In this version of Java, resultset are "FORWARD ONLY".
> The fact is that i need to count the rows contained in a resultset
> before displaying its data and the  way i've thought to do this is read
> all the resultset.
> rows= 0;
> while( rs.next()) {
> rows++;
> }
>
> With my actual version of java, I would need to re-execute the query
> again to get the pointer "beforeFirsted".
> Is there any way to obtain a independent copy of a ResultSet without
> executing the query again?
>
> Thankyou
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




ResultSet

2002-05-28 Thread Manuel Rodriguez Diaz


Hi all,
I'm working with java 1.1. (this is a mandatory requirement).
In this version of Java, resultset are "FORWARD ONLY".
The fact is that i need to count the rows contained in a resultset
before displaying its data and the  way i've thought to do this is read
all the resultset.
rows= 0;
while( rs.next()) {
rows++;
}

With my actual version of java, I would need to re-execute the query
again to get the pointer "beforeFirsted".
Is there any way to obtain a independent copy of a ResultSet without
executing the query again?

Thankyou


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




Re: ResultSet

2002-03-11 Thread Micael Padraig Og mac Grene

If you want to compare String objects as literals, use the intern() method.

Micael

At 03:58 PM 3/11/02 +0700, you wrote:
>Hi,
> For the brave, can anyone guess why with this rather unsociable code:
>
>
>   if ((res.getString(3) == null) || (res.getString(3) == "")) {
>out.println("res.getString(2) + "&myDate=" + myDate + ">" + res.getString(2) +
>"");
>}
>   if ((res.getString(3) != null) || (res.getString(3) != "")) {
>out.println("" + res.getString(3)+ " " + res.getString(2) +
>"");
>}
>
>
>the first condition is NEVER satisfied, even though out.println of
>res.getString(3) does not display anything! Ie res.getString(3) IS null,
>empty or whatever, but the condition is never satisifed. Quickly again, this
>is executed:
>
>
>   if ((res.getString(3) != null) || (res.getString(3) != "")) {
>out.println("" + res.getString(3)+ " " + res.getString(2) +
>"");
>}
>
>
>even though - out.println("" + res.getString(3)+ " " -  shows it is
>empty (no output)!
>
>Thanks
>
>Paul.
>
>
>--
>To unsubscribe, e-mail:   
>For additional commands, e-mail: 



--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: ResultSet

2002-03-11 Thread Ed Yu

Try to do this:

if ((res.getString(3) != null) && (res.getString(3).length > 0))
{
...
}

It is because java.util.String must use its equals() method for string
comparison. The only logical operator you can use is for null
comparison.

Also some database distinguish between empty string '' and null value,
just becareful of that!

> -Original Message-
> From: Paul Wallace [SMTP:[EMAIL PROTECTED]]
> Sent: Monday, March 11, 2002 3:58 AM
> To:   Tomcat Developers List
> Subject:  ResultSet
> 
> Hi,
> For the brave, can anyone guess why with this rather unsociable
> code:
> 
> 
>   if ((res.getString(3) == null) || (res.getString(3) == "")) {
>out.println(" res.getString(2) + "&myDate=" + myDate + ">" + res.getString(2) +
> "");
>}
>   if ((res.getString(3) != null) || (res.getString(3) != "")) {
>out.println("" + res.getString(3)+ " " + res.getString(2) +
> "");
>}
> 
> 
> the first condition is NEVER satisfied, even though out.println of
> res.getString(3) does not display anything! Ie res.getString(3) IS
> null,
> empty or whatever, but the condition is never satisifed. Quickly
> again, this
> is executed:
> 
> 
>   if ((res.getString(3) != null) || (res.getString(3) != "")) {
>out.println("" + res.getString(3)+ " " + res.getString(2) +
> "");
>}
> 
> 
> even though - out.println("" + res.getString(3)+ " " -  shows it
> is
> empty (no output)!
> 
> Thanks
> 
> Paul.
> 
> 
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> 

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




ResultSet

2002-03-11 Thread Paul Wallace

Hi,
For the brave, can anyone guess why with this rather unsociable code:


  if ((res.getString(3) == null) || (res.getString(3) == "")) {
   out.println("" + res.getString(2) +
"");
   }
  if ((res.getString(3) != null) || (res.getString(3) != "")) {
   out.println("" + res.getString(3)+ " " + res.getString(2) +
"");
   }


the first condition is NEVER satisfied, even though out.println of
res.getString(3) does not display anything! Ie res.getString(3) IS null,
empty or whatever, but the condition is never satisifed. Quickly again, this
is executed:


  if ((res.getString(3) != null) || (res.getString(3) != "")) {
   out.println("" + res.getString(3)+ " " + res.getString(2) +
"");
   }


even though - out.println("" + res.getString(3)+ " " -  shows it is
empty (no output)!

Thanks

Paul.


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




problems with resultSet

2001-05-29 Thread Enrique Prados Valiente

hi,

Hi!
I'm using Tomcat and JSP but there are problem, my JSP don' work.
I have this code in my JSP
(code.)
Statement 
s=cn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_  
READ_ONLY);
(more code)

In begin of my JSP there is this code line <%@ page language="java" 
import="java.sql.*,java.io.*,java.util.*" %>

but when I run the server and JSP, it appears this error
Error: 500
Localizacion: pag.jsp
Error interno del servlet:
org.apache.jasper.JasperException: No se puede compilar la clase para 
JSPC:\TOMCAT\work\localhost_8080%.  java:81: No variable 
TYPE_SCROLL_INSENSITIVE defined in interface java.sql.ResultSet.
Statement 
s=cn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_  
READ_ONLY);
^
C:\TOMCAT\work\localhost_8080%..java:81: No variable CONCUR_READ_ONLY 
defined in interface java.sql.ResultSet.
Statement s=cn.createStatement(ResultSet.TYPE_SCROLL_INS  
ENSITIVE,ResultSet.CONCUR_READ_ONLY);
 
  
 ^
C:\TOMCAT\work\localhost_8080%..java:84: Method absolute(int) not found 
in interface java.sql.ResultSet.
   rs.absolute(5);

Can anyone out there help me?
Thanks in advance,
Enrique.