🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.lang.java.databases
3 messages
3 total messages Started by Jason R. Mihalick Wed, 26 Aug 1998 00:00
JDBC-ODBC + SQL Server 6.5 + ResultSet + getString/getInt = SQLException
#39
Author: Jason R. Mihalick
Date: Wed, 26 Aug 1998 00:00
24 lines
1617 bytes
Hello,

I'm using JDK 1.1.6 (with JBuilder 2), the JDBC-ODBC bridge, and SQL Server
6.5 and have been experiencing some odd behavior from the
ResultSet.getString(String) and ResultSet.getInt(String) methods.  The order
in which I execute the getXXX methods seems to matter for some reason.

For instance, I have a column named "settlement", which is a varchar field.
If I don't call rs.getString("settlement") before I call any of the other
getXXX methods, an SQLException is thrown that says: "[Microsoft][ODBC SQL
Server Driver]Invalid column number"  If I put the getXXX calls in a certain
order (and I haven't figured out the pattern yet), then life is good, no
Exceptions thrown.

I've found that this happens with the ResultSet.getInt(String) method as
well.  It's like there is some kind of problem with the hash tables that the
getXXX methods are using.  On the other hand, it could be some dumb mistake
that I'm making!

Anybody ever see this kind of behavior?

Thanks in advance,

Jason
Re: JDBC-ODBC + SQL Server 6.5 + ResultSet + getString/getInt = SQLException
#37
Author: Stephen Barrett
Date: Mon, 31 Aug 1998 00:00
40 lines
2376 bytes
I have not been connecting to SQL Server for a few months but I
discovered that I needed to access the columns returned from SQL Server
in their proper order.  If you access col3 you can not then later access
col2.  Bummer, but then you must have worked through that nasty:

   /* MicroSoft insists on doing everything differently.
      We need to test against DBC connect messages.
   */
   String MSODBC1 = "[SQL Server]Changed language setting to '",
          MSODBC2 = "[SQL Server]Changed database context to '",
          MSODBCTester = null;

Stuff :)

Jason R. Mihalick wrote:
> 
> Hello,
> 
> I'm using JDK 1.1.6 (with JBuilder 2), the JDBC-ODBC bridge, and SQL Server
> 6.5 and have been experiencing some odd behavior from the
> ResultSet.getString(String) and ResultSet.getInt(String) methods.  The order
> in which I execute the getXXX methods seems to matter for some reason.
> 
> For instance, I have a column named "settlement", which is a varchar field.
> If I don't call rs.getString("settlement") before I call any of the other
> getXXX methods, an SQLException is thrown that says: "[Microsoft][ODBC SQL
> Server Driver]Invalid column number"  If I put the getXXX calls in a certain
> order (and I haven't figured out the pattern yet), then life is good, no
> Exceptions thrown.
> 
> I've found that this happens with the ResultSet.getInt(String) method as
> well.  It's like there is some kind of problem with the hash tables that the
> getXXX methods are using.  On the other hand, it could be some dumb mistake
> that I'm making!
> 
> Anybody ever see this kind of behavior?
> 
> Thanks in advance,
> 
> Jason
Re: JDBC-ODBC + SQL Server 6.5 + ResultSet + getString/getInt = SQLException
#38
Author: Michael Chen
Date: Mon, 31 Aug 1998 00:00
51 lines
2620 bytes
This is caused by a limitation on the SQL Server ODBC Driver and the way
JDBC-ODBC bridge was designed.  The detail is not that simple to explain.

This combination demands that you call getXXX() in the same order of the
select list of your query.  For example, if your query is:

  "select settlement, amount, description from case_database"

Then you must not call getXXX() on amount and description before you
have done it for settlement.

If you use IDS Server, you don't have to worry about this, because its
IDS JDBC Driver uses a different and more efficient mechanism.

Thank you

Michael Chen
IDS Software -- Home of IDS Server
The best Type-3 JDBC driver solution.
http://www.idssoftware.com/
----------


Jason R. Mihalick wrote in message <6s1ujp$g7g@enews1.newsguy.com>...
>Hello,
>
>I'm using JDK 1.1.6 (with JBuilder 2), the JDBC-ODBC bridge, and SQL Server
>6.5 and have been experiencing some odd behavior from the
>ResultSet.getString(String) and ResultSet.getInt(String) methods.  The order
>in which I execute the getXXX methods seems to matter for some reason.
>
>For instance, I have a column named "settlement", which is a varchar field.
>If I don't call rs.getString("settlement") before I call any of the other
>getXXX methods, an SQLException is thrown that says: "[Microsoft][ODBC SQL
>Server Driver]Invalid column number"  If I put the getXXX calls in a certain
>order (and I haven't figured out the pattern yet), then life is good, no
>Exceptions thrown.
>
>I've found that this happens with the ResultSet.getInt(String) method as
>well.  It's like there is some kind of problem with the hash tables that the
>getXXX methods are using.  On the other hand, it could be some dumb mistake
>that I'm making!
>
>Anybody ever see this kind of behavior?
>
>Thanks in advance,
>
>Jason
>
>
>
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads