Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.databases > #90

jTDS, trashes heap with w

Path csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!nx02.iad01.newshosting.com!newshosting.com!news-out.readnews.com!transit3.readnews.com!news-out.news.tds.net!newsreading01.news.tds.net!86597e80!not-for-mail
From "Jan Burse" <jan.burse@THRWHITE.remove-dii-this>
Subject jTDS, trashes heap with w
Message-ID <g09odi$m60$1@news.albasani.net> (permalink)
X-Comment-To comp.lang.java.databases
Newsgroups comp.lang.java.databases
Content-Type text/plain; charset=IBM437
Content-Transfer-Encoding 8bit
X-Gateway time.synchro.net [Synchronet 3.15a-Win32 NewsLink 1.92]
Lines 60
Date Wed, 27 Apr 2011 15:21:41 GMT
NNTP-Posting-Host 96.60.20.240
X-Complaints-To news@tds.net
X-Trace newsreading01.news.tds.net 1303917701 96.60.20.240 (Wed, 27 Apr 2011 10:21:41 CDT)
NNTP-Posting-Date Wed, 27 Apr 2011 10:21:41 CDT
Organization TDS.net
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.databases:90

Show key headers only | View raw


  To: comp.lang.java.databases
Dear All

I was just looking up the source code of the jTDS driver.
It seems that it is trashing the heap with java.lang
wrapper classes, even when one is using only primitive
types in his application.

For example, when I am doing, whereas the column
is integer:

    ResultSet set;
    set.getLong(1);

This amounts to a call to:

     public long getLong(int columnIndex) throws SQLException {
          return ((Long) Support.convert(con, getColumn(columnIndex), 

                   java.sql.Types.BIGINT, null)).longValue();
     }

During the above call a Long object will be created, as
can be seen from the convert implementation:

     case java.sql.Types.BIGINT:
       if (x == null) {
         return LONG_ZERO;
       } else if (x instanceof Long) {
         return x;
       } else if (x instanceof Byte) {
         return new Long(((Byte)x).byteValue() & 0xFF);
       } else if (x instanceof Number) {
         return new Long(((Number) x).longValue());
       } else if (x instanceof String) {
         return new Long(((String) x).trim());
       } else if (x instanceof Boolean) {
         return ((Boolean) x).booleanValue() ? LONG_ONE : LONG_ZERO;
       }
       break;

A solution would be to do the following
call on the result set:

    (long)set.getInt(1);

But what if I want to make the code, lets say column
size independent, and want to use a getLong() call
only.

Does this trashing happen in every JDBC driver?
Are there alternatives to jTDS, when accessing
MS SQL Databases?

Best Regards

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

Back to comp.lang.java.databases | Previous | NextNext in thread | Find similar


Thread

jTDS, trashes heap with w "Jan Burse" <jan.burse@THRWHITE.remove-dii-this> - 2011-04-27 15:21 +0000
  Re: jTDS, trashes heap wi "=?ISO-8859-1?Q?Arne_Vajh=" <=?iso-8859-1?q?arne_vajh=@THRWHITE.remove-dii-this> - 2011-04-27 15:21 +0000
    Re: jTDS, trashes heap wi "Jan Burse" <jan.burse@THRWHITE.remove-dii-this> - 2011-04-27 15:21 +0000
      Re: jTDS, trashes heap wi "=?ISO-8859-1?Q?Arne_Vajh=" <=?iso-8859-1?q?arne_vajh=@THRWHITE.remove-dii-this> - 2011-04-27 15:21 +0000
  Re: jTDS, trashes heap wi "Lew" <lew@THRWHITE.remove-dii-this> - 2011-04-27 15:21 +0000
    Re: jTDS, trashes heap wi "Jan Burse" <jan.burse@THRWHITE.remove-dii-this> - 2011-04-27 15:21 +0000
      Re: jTDS, trashes heap wi "Lew" <lew@THRWHITE.remove-dii-this> - 2011-04-27 15:21 +0000
        Re: jTDS, trashes heap wi "Jan Burse" <jan.burse@THRWHITE.remove-dii-this> - 2011-04-27 15:21 +0000
          Re: jTDS, trashes heap wi "Lew" <lew@THRWHITE.remove-dii-this> - 2011-04-27 15:21 +0000
            Re: jTDS, trashes heap wi "Jan Burse" <jan.burse@THRWHITE.remove-dii-this> - 2011-04-27 15:21 +0000
              Re: jTDS, trashes heap wi "Lew" <lew@THRWHITE.remove-dii-this> - 2011-04-27 15:21 +0000

csiph-web