Re: Problems with ResultSet

2001-05-30 Thread Guido Medina

That's what I'm saying with the snip example...

Guido.

Java Leader/Network Specialist, CTO, WHS International

- Original Message -
From: Ralph Einfeldt [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, May 30, 2001 2:19 AM
Subject: AW: Problems with ResultSet



 It can happen with any driver.

 That's what JDBC API doc tells:

 For maximum portability, result set columns within each row
  should be read in left-to-right order, and each column should
  be read only once.

  -Ursprüngliche Nachricht-
  Von: Guido Medina [mailto:[EMAIL PROTECTED]]
  Gesendet: Mittwoch, 30. Mai 2001 07:38
  An: [EMAIL PROTECTED]; [EMAIL PROTECTED]
  Betreff: Re: Problems with ResultSet
 snip/
  It means that you cannot do the follow with MS Access:
 
  Statement st = con.createStatement();
  ResultSet rs = st.executeQuery(..);
  while (rs.next()) {
 out.println(String a = rs.getString(1));
 ...
 ...
 ...
 out.println(String a = rs.getString(1));
  }
 snip/





Problems with ResultSet

2001-05-29 Thread Enrique Prados Valiente


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)


   if (!rs.isFirst()) rs.previous(); 

  %tr 
  td%=rs.getString(1)%/td%

   }

(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


[Microsoft][ODBC Driver Manager] Invalid cursor state


I think that Jsp fails in this code line, td%=rs.getString(1)%/td%


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









Re: Problems with ResultSet

2001-05-29 Thread Jim Cheesman

At 03:01 PM 29/05/01, you wrote:

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)


if (!rs.isFirst()) rs.previous();


Is there any particular reason you're going backwards through the result 
set? Wouldn't it be more efficient/logical to use rs.next()?

snip

 [Microsoft][ODBC Driver Manager] Invalid cursor state


Try something like:
if (rs.next()) {
   %= rs.getString(1) %
}



Salud2.
Jim




--

   *   Jim Cheesman   *
 Trabajo: 
[EMAIL PROTECTED] - (34)(91) 724 9200 x 2360
  Not only am I 
redundant and superfluous, but I
also tend to use more 
words than necessary.





Re: Problems with ResultSet

2001-05-29 Thread Moin Anjum H.

Hi,

Is your Database MSAccess?

If yes then try Statement 
s=cn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
for a full blown Explain Explaination Please go through Java Docs.

HTH
Best Regards
Moin.

Enrique Prados Valiente wrote:

 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)

if (!rs.isFirst()) rs.previous();

   %tr
   td%=rs.getString(1)%/td%

}

 (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

 [Microsoft][ODBC Driver Manager] Invalid cursor state

 I think that Jsp fails in this code line, td%=rs.getString(1)%/td%


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




Re: Problems with ResultSet

2001-05-29 Thread Guido Medina

It also happens with MS Access if your try to getType(int n), Type = {String
| Int | ...} more than once, it means that you cannot do the follow with MS
Access:

Statement st = con.createStatement();
ResultSet rs = st.executeQuery(..);
while (rs.next()) {
   out.println(String a = rs.getString(1));
   ...
   ...
   ...
   out.println(String a = rs.getString(1));
}

This should work in every database manager but doesn't work, you must do:
String a = rs.getString(1) and keep using a instead of try to get the value
again...

This happens with MS Access, I don't know if with some else database
manager...

Guido.
- Original Message -
From: Moin Anjum H. [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, May 30, 2001 1:14 AM
Subject: Re: Problems with ResultSet


 Hi,

 Is your Database MSAccess?

 If yes then try Statement
s=cn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_O
NLY);
 for a full blown Explain Explaination Please go through Java Docs.

 HTH
 Best Regards
 Moin.

 Enrique Prados Valiente wrote:

  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)
 
 if (!rs.isFirst()) rs.previous();
 
%tr
td%=rs.getString(1)%/td%
 
 }
 
  (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
 
  [Microsoft][ODBC Driver Manager] Invalid cursor state
 
  I think that Jsp fails in this code line,
td%=rs.getString(1)%/td%
 
 
  Can anyone out there help me?
  Thanks in advance,
  Enrique.





AW: Problems with ResultSet

2001-05-29 Thread Ralph Einfeldt


It can happen with any driver. 

That's what JDBC API doc tells:

For maximum portability, result set columns within each row 
 should be read in left-to-right order, and each column should 
 be read only once.

 -Ursprüngliche Nachricht-
 Von: Guido Medina [mailto:[EMAIL PROTECTED]]
 Gesendet: Mittwoch, 30. Mai 2001 07:38
 An: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Betreff: Re: Problems with ResultSet
snip/
 It means that you cannot do the follow with MS Access:
 
 Statement st = con.createStatement();
 ResultSet rs = st.executeQuery(..);
 while (rs.next()) {
out.println(String a = rs.getString(1));
...
...
...
out.println(String a = rs.getString(1));
 }
snip/