How-To-Repeat:

1.   Use: JDK 1.1.8
2.   Use: mysql-connector-java-2.0.14-bin.jar

3.   Run testsuite file Transaction.java/class
Problem in ResultSet.getDouble() when testing testsuite Transaction.java
file:

>java Transaction
java.lang.NoSuchMethodError: java.lang.Double: method
parseDouble(Ljava/lang/String;)D not found
        at com.mysql.jdbc.ResultSet.getDouble(Unknown Source)
        at com.mysql.jdbc.ResultSet.getDouble(Unknown Source)
        at com.mysql.jdbc.ResultSet.getObject(Unknown Source)
        at Transaction.<init>(Compiled Code)
        at Transaction.main(Transaction.java:133)

Error occurs at:
        System.out.println(RS.getDouble(2));

4.   Change JDBC java code to use JDK 1.1.8 compatible calls.
Seems like parseDouble not supported in JDK 1.1.8 so change the code in
        \mysql-connector-java-2.0.14\com\mysql\jdbc\ResultSet.java to

approx line 1783:
        /**
         * Converts a string representation of a number
         * to a double. Need a faster way to do this.
         */

        public static double getDouble(byte[] buf) throws SQLException
        {
                if (buf.length == 0)
                {
                        return 0;
                }

                try
                {
                        // Change to be JDK 1.1.8 compatible.
                        // return Double.parseDouble(new String(buf));
                        return Double.valueOf(new String(buf)).doubleValue();
                }
                catch (NumberFormatException e)
                {
                        throw new SQLException("Bad format for number '" + new 
String(buf) +
"'");
                }

        }
5.   Run Transaction.java/class again:

>java dbTransaction
Rollback Ok
23.485115
Commit Ok

Pete...


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 11 September 2002 8:05 PM
To: Peter Tan
Subject: Re: getDouble() not working with JDK 1.1.8


Your message cannot be posted to [EMAIL PROTECTED] because it did not
follow the format expected by our spam/off-topic filter. To this list we
accept only repeatable bugs reports, meaning that you can describe a
set of steps we can follow to repeat the bug on our systems.

If you are having problems with MySQL but are unable to provide the required
description, and have not purchased a support contract from MySQL AB,
you should send your message to [EMAIL PROTECTED] and possibly one of
our
knowledgable users or developers will help you. However, we do not guarantee
that every message on [EMAIL PROTECTED] will be answered. We can afford
to provide free code, but unfortunately, we cannot afford to provide
guaranteed free support on top of that. We do, nevertheless, fix our bugs
regardless of who reports them and whose systems they affect, and will
investigate your problem if you can prove to us with a test case that the
error is in our code and not yours.

If you have purchased a support contract from MySQL AB, you should follow
the standard support request procedure to report this problem. Support
contracts are available at https://order.mysql.com/.

If you are able to describe how we can repeat the problem, include the
string
"How-To-Repeat:" in the body of your message, followed by the detailed
description of what we need to do to make it happen, and our filter will
accept your message. If you use mysqlbug script, which comes with the MySQL
distribution, to post the message, it will be automatically accepted.

You have written the following:

---start of your  message----
Use: JDK 1.1.8
        mysql-connector-java-2.0.14-bin.jar

Problem in ResultSet.getDouble() when testing testsuite Transaction.java
file:

>java Transaction
Insert Rtn: 1
1
java.lang.NoSuchMethodError: java.lang.Double: method
parseDouble(Ljava/lang/String;)D not found
        at com.mysql.jdbc.ResultSet.getDouble(Unknown Source)
        at com.mysql.jdbc.ResultSet.getDouble(Unknown Source)
        at com.mysql.jdbc.ResultSet.getObject(Unknown Source)
        at dbTransaction.<init>(Compiled Code)
        at dbTransaction.main(dbTransaction.java:133)

Error from:
                System.out.println(RS.getDouble(2));

Seems like parseDouble not supported in JDK 1.1.8 so change the code in

\mysql-connector-java-2.0.14\com\mysql\jdbc\ResultSet.java to

line 1783:
        /**
         * Converts a string representation of a number
         * to a double. Need a faster way to do this.
         */

        public static double getDouble(byte[] buf) throws SQLException
        {
                if (buf.length == 0)
                {
                        return 0;
                }

                try
                {
                        // Change to be JDK 1.1.8 compatible.
                        // return Double.parseDouble(new String(buf));
                        return Double.valueOf(new String(buf)).doubleValue();
                }
                catch (NumberFormatException e)
                {
                        throw new SQLException("Bad format for number '" + new 
String(buf) +
"'");
                }

        }

Pete...

---end of your message-------

MySQL Development Team

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to