🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.java.databases
Article #37

Re: JDBC-ODBC + SQL Server 6.5 + ResultSet + getString/getInt = SQLException

#37
From: 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
Technical Details
Message-ID: <35EB0928.6C3BB579@cornell.edu>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <6s1ujp$g7g@enews1.newsguy.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 107d46,91df2c8488888997
X-Google-Attributes: gid107d46,public
X-Google-Thread: 1073da,91df2c8488888997
X-Google-Attributes: gid1073da,public
From: Stephen Barrett <smb1@cornell.edu>
Subject: Re: JDBC-ODBC + SQL Server 6.5 + ResultSet + getString/getInt = SQLException
Date: 1998/08/31
Message-ID: <35EB0928.6C3BB579@cornell.edu>
X-Deja-AN: 386549275
Content-Transfer-Encoding: 7bit
Sender: smb1@cornell.edu (Verified)
References: <6s1ujp$g7g@enews1.newsguy.com>
Content-Type: text/plain; charset=us-ascii
Organization: Cornell University
Mime-Version: 1.0
Newsgroups: comp.lang.java.databases,borland.public.jbuilder.database