People I find the error with the signon component of petstore 1.1.2 , the
problem is the update. i show in an example:

the line :
String queryStr ="update signon set password='j2ee' where username='j2ee'";
it's the problem . currently i stay to work in resolve the problem (only in
the source but don't in the driver ) and send a the list , i think it's no
very dificult . I hope

----------------------------------------------------------------------------
---------------
import java.util.Properties;
import java.sql.*;


//////////////////////////////////////////////////////////////////////
public class HelloSapDB {

    //////////////////////////////////////////////////////////////////////
    public static void main (String [] args) throws ClassNotFoundException,
SQLException
    {
        String user;
        String password;
        String host = "200.100.10.53";
        String dbname;

        /*
         * parse arguments
         */
        Properties options = parseOptions (args);
        host = options.getProperty ("host", "200.100.10.53");
        dbname = options.getProperty ("dbname");
        user = options.getProperty ("user");
        password = options.getProperty ("password");
        String url = "jdbc:sapdb://" + host + "/" + dbname;
        /*
         * load driver and connect
         */
        Class.forName ("com.sap.dbtech.jdbc.DriverSapDB");
        System.out.println(url);
        Connection connection = DriverManager.getConnection (url, user,
password);

        /*
         * execute update
         */
        String queryStr ="update signon set password='j2ee' where
username='j2ee'";
        PreparedStatement stmt = connection.prepareStatement(queryStr);
        int resultCount = stmt.executeUpdate();
        if(resultCount!=1)
            System.out.println ("ERROR");
        else
            System.out.println ("SUCESFULL");

    }

    //////////////////////////////////////////////////////////////////////
    public static void usage (boolean error) {
        System.out.println ("Usage: java ... HelloSapDB -u name,pwd -d
dbname [-n node]");
        if (error) {
            System.exit (2);
        }
        else {
            System.exit (0);
        }
    }

    //////////////////////////////////////////////////////////////////////
    public static Properties parseOptions (String[] args) {
        Properties result = new Properties ();
        boolean hasUser = false;
        boolean hasDb = false;

        for (int i = 0; i < args.length; ++i) {
            String currentArg = args [i];
            if (currentArg.charAt (0) != '-') {
                break;
            }
            char currentOpt = currentArg.charAt (1);
            switch (currentOpt) {
            case 'h':
                usage (false);
                break;
            case 'u':
                ++i;
                currentArg = args [i];
                int pos = currentArg.indexOf (',');
                result.put ("user", currentArg.substring (0, pos));
                result.put ("password", currentArg.substring (pos + 1));
                hasUser = true;
                break;
            case 'd':
                ++i;
                result.put ("dbname", args [i]);
                hasDb = true;
                break;
            case 'n':
                ++i;
                result.put ("host", args [i]);
                break;
            default:
                System.err.println ("invalid option " + currentOpt);
                usage (true);
                break;
            }
        }
        if (!hasUser || !hasDb) {
            usage (true);
        }
        return result;
    }

}

-------------------------------------------------------

the ERROR is�:

-------------------------------------------------------
devteam@nazca:~/dev/sapdb > java HelloSapDB -u TEST,TEST -d PFR
jdbc:sapdb://200.100.10.53/PFR
Exception in thread "main" java.lang.NoSuchMethodError
        at java.math.BigDecimal.timesTenToThe(BigDecimal.java:922)
        at java.math.BigDecimal.<init>(BigDecimal.java:176)
        at
com.sap.dbtech.util.VDNNumber.number2BigDecimal(VDNNumber.java:198)
        at com.sap.dbtech.util.VDNNumber.number2int(VDNNumber.java:278)
        at
com.sap.dbtech.jdbc.packet.ReplyPacket.resultCount(ReplyPacket.java:371)
        at
com.sap.dbtech.jdbc.CallableStatementSapDB.execute(CallableStatementSapDB.ja
va:347)
        at
com.sap.dbtech.jdbc.CallableStatementSapDB.execute(CallableStatementSapDB.ja
va:265)
        at
com.sap.dbtech.jdbc.CallableStatementSapDB.executeUpdate(CallableStatementSa
pDB.java:550)
        at HelloSapDB.main(HelloSapDB.java:46)
-------------------------------------------------------


_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to