RE: Connecting to ms sql

2001-04-05 Thread Warren Crossing

hey,

go to java.sun.com/products
go to the jdbc site.
they have a list of jdbc drivers.
you might be better of using a jdbc odbc bridge from sun.

l8r.

-Original Message-
From: Bahl, ankur [mailto:[EMAIL PROTECTED]]
Sent: Friday, 6 April 2001 4:09 PM
To: '[EMAIL PROTECTED]'
Subject: Connecting to ms sql 


Hi,
I  want to connect to ms sql using tomcat. I am successful in connecting
to oracle. To connect to oracle I have used DBConnectionBroker
 Please suggect me a driver to connect to sql and the site from where I can
download it from.

Reply ASAP,

Regards,
Ankur Bahl,
HCL Perot Systems,
Bangalore.
*: +91-80-6586905/6/7/8  Ext: 318

WARNING: The information in this message is confidential and may be legally
privileged. It is intended solely for the addressee.  Access to this message
by anyone else is unauthorised.  If you are not the intended recipient, any
disclosure, copying, or distribution of the message, or any action or
omission taken by you in reliance on it, is prohibited and may be unlawful.
Please immediately contact the sender if you have received this message in
error. Thank you.- HCL Perot Systems



RE: connecting to MS-SQL

2001-02-14 Thread Richard Downey

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:[EMAIL PROTECTED]]
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: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]



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




Re: connecting to MS-SQL

2001-02-14 Thread David Treves

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" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
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:[EMAIL PROTECTED]]
 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: [EMAIL PROTECTED]
 For additional commands, email: [EMAIL PROTECTED]



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



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




RE: connecting to MS-SQL

2001-02-14 Thread Richard Downey

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:[EMAIL PROTECTED]]
Sent: 14 February 2001 14:13
To: [EMAIL PROTECTED]
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" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
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:[EMAIL PROTECTED]]
 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: [EMAIL PROTECTED]
 For additional commands, email: [EMAIL PROTECTED]



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



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



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




Re: connecting to MS-SQL

2001-02-14 Thread Frank Mau

Hi, 
I think you should try this code-snippet:

...
Connection con = null;
try {
  // get data from database
  con = DriverManager.getConnection( ... ); // replace with your 
DB-connector

  Statement stmt = con.createStatement();
  ResultSet rs = stmt.executeQuery( "put your SQL-Statement here" );
  if ( null != rs  ) {
 while( rs.next() ) {
   ... (get data with rs.getString() etc.)
 }
 rs.close();
  }
  rs = null;
  stmt.close();
  stmt = null;
} catch( Exception e ) {
  ... // some exception handling here   
} finally {
  // don't forget to close the connection !!
  try { con.close(); con = null; } catch( Exception e ) {}
}
...

Bye
Frank


 Ursprngliche Nachricht 

Am 14.02.01, 14:38:10, schrieb "David Treves" [EMAIL PROTECTED] zum 
Thema 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: [EMAIL PROTECTED]
 For additional commands, email: [EMAIL PROTECTED]

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