How do I achieve queryaccelearation=all and packageset using Java JDBC?

I am setting the queryaccelearation=all in below code

//set queryacceleration  
String url = "host:60010/DB2:user=xxxx;password=yyyyy;specialRegisters=CURRENT QUERY ACCELERATION=ALL;";  
con = DriverManager.getConnection(url,props); 

and i am getting the below exception:

ERROR: [jcc][10214][10050][3.62.56] java.util.Properties object passed to java.sql.Driver.connect() cannot be overridden by URL: jdbc:db2://;password=yyyyy;specialRegisters=CURRENT QUERY ACCELERATION=ALL;. ERRORCODE=-4461, SQLSTATE=42815

What am I doing wrong?

I am trying to the db2 database packageset into java jdbc application i am getting the below error. please see the below code for me.

              //Declare the packageset
                                     String packageset=”F9DERWSl”;

              // Set user ID for the connection
                 props.put("user", props.getProperty("DB2_USERNAME"));
                 // Set password for the connection
                 props.put("password", props.getProperty("DB2_PASSWORD"));

                 // set securityMechanism
                              new String("" + + ""));
                 props.put("encryptionAlgorithm", "2");

                 // getting the database connection
                 con = DriverManager.getConnection(props.getProperty("DB2_URL")+"packageset", props); 

- ERROR: [jcc][t4][2030][11211][3.62.56] A communication error occurred during operations on the connection's underlying socket, socket input stream, or socket output stream. Error location: Reply.fill() - (-1). Message: Connection reset. ERRORCODE=-4499, SQLSTATE=08001

1 answer

  • answered 2018-11-08 12:43 Mark Barinstein

    1. java.util.Properties object passed to java.sql.Driver.connect() cannot be overridden by URL

    You must not specify user and password twice - in the URL and in the properties. Exclude them from either place.

    1. Current package set cat be specified in the URL like this:

      jdbc:db2:// QUERY ACCELERATION=ALL;currentPackageSet=F9DERWSl;