Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Java Databases > jTDS, trashes h...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 11 Topic 3747 of 3876
Post > Topic >>

jTDS, trashes heap with wrapper cl*****

by Jan Burse <janburse@[EMAIL PROTECTED] > May 12, 2008 at 05:41 PM

Dear All

I was just looking up the source code of the jTDS driver.
It seems that it is tra****ng the heap with java.lang
wrapper cl*****, 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) Sup****t.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 tra****ng happen in every JDBC driver?
Are there alternatives to jTDS, when accessing
MS SQL Databases?

Best Regards
 




 11 Posts in Topic:
jTDS, trashes heap with wrapper classes
Jan Burse <janburse@[E  2008-05-12 17:41:49 
Re: jTDS, trashes heap with wrapper classes
=?ISO-8859-1?Q?Arne_Vajh=  2008-05-12 18:32:28 
Re: jTDS, trashes heap with wrapper classes
Jan Burse <janburse@[E  2008-05-13 02:03:03 
Re: jTDS, trashes heap with wrapper classes
=?ISO-8859-1?Q?Arne_Vajh=  2008-05-12 20:54:40 
Re: jTDS, trashes heap with wrapper classes
Lew <lew@[EMAIL PROTEC  2008-05-12 19:36:38 
Re: jTDS, trashes heap with wrapper classes
Jan Burse <janburse@[E  2008-05-13 02:03:22 
Re: jTDS, trashes heap with wrapper classes
Lew <lew@[EMAIL PROTEC  2008-05-13 00:14:05 
Re: jTDS, trashes heap with wrapper classes
Jan Burse <janburse@[E  2008-05-13 20:25:07 
Re: jTDS, trashes heap with wrapper classes
Lew <lew@[EMAIL PROTEC  2008-05-13 19:28:40 
Re: jTDS, trashes heap with wrapper classes
Jan Burse <janburse@[E  2008-05-14 23:00:42 
Re: jTDS, trashes heap with wrapper classes
Lew <lew@[EMAIL PROTEC  2008-05-14 23:29:16 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Dec 3 23:18:54 CST 2008.