tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard Downey" <rdow...@contenlo.com>
Subject RE: connecting to MS-SQL
Date Wed, 14 Feb 2001 14:24:22 GMT
I'd put a  while (rs.next ()) {   ..... }  round your   if ( rs.getString...
code . In effect it hasn't positioned to the start of the record set hence
the cursor message. Hope that helps.

-----Original Message-----
From: David Treves [mailto:dwork@macam98.ac.il]
Sent: 14 February 2001 14:13
To: tomcat-user@jakarta.apache.org
Subject: Re: connecting to MS-SQL


I managed to create the connection, statement and the resultset, the problem
is when I try to get the data:

try
{
  Connection con = broker.getConnection();  //using the DBConnectionBroker
pool
  Statement stmt = con.createStatement();
  ResultSet rs = stmt.executeQuery("SELECT MAX(id) AS 'id' FROM table");

   if (rs.getString(1) != null)  // THIS IS THE PROBLEMATIC PART
      id = String.valueOf(rs.getInt(1) + 1);  // assign an id to the user
   else
      id = "1";
}

note that I have records in the table so it does fetch results.

Thanks,
David.


----- Original Message -----
From: "Richard Downey" <rdowney@contenlo.com>
To: <tomcat-user@jakarta.apache.org>
Sent: Wednesday, February 14, 2001 3:59 PM
Subject: RE: connecting to MS-SQL


> At what point does it raise that message ? Have you connected OK to the
> Database ? got a Recordset etc.  ? The JDBC-ODBC in SDK 1.3 certainly
works
> with SQL 7 and is very Quick.
>
> -----Original Message-----
> From: David Treves [mailto:davidt@macam98.ac.il]
> Sent: 14 February 2001 13:38
> To: mailing list tomcat-users
> Subject: connecting to MS-SQL
>
>
> Hi,
>
>     I am trying to connect to a MS-SQL 7 database. I manage to create all
> the necessary object, but when I execute the servlet I get the following
> error:
>
> [Microsoft][ODBC Driver Manager] Invalid cursor state
>
> I use JdbcOdbc driver supplied with SDK 1.3
>
> Any idea?
>
> David Treves
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, email: tomcat-user-help@jakarta.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, email: tomcat-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, email: tomcat-user-help@jakarta.apache.org



Mime
View raw message