2 Replies Latest reply on Mar 14, 2016 7:10 PM by Marco Ardito

    DS created from jboss-cli gets space character removed from "check-valid-connection-sql"

    Marco Ardito Master

      as in title, adding a datasource from jboss-cli which has a simple sql statement check-valid-connection-sql is added but the sql statements is missing "spaces" so it is not valid for the server.

       

      this does not happen loading the value from the web console (spaces are preserved)

       

      I restarted from scratch

      - extracted teiid-8.13.2-wildfly-server.zip

      - i did NOT install anything else

      - copied all my custom *.properties files under /standalone/configuration

      - started server as /bin/standalone.sh -c standalone-teiid.xml -b 0.0.0.0 -bmanagement 0.0.0.0

       

      then entered jboss-cli

       

      and issued

      ===================================

      [standalone@localhost:9990 /] /subsystem=datasources/data-source=testDS:add(jndi-name=java:/testDS, enabled=true, use-java-context=true, driver-class=com.mysql.jdbc.Driver,driver-name=mysql-connector-java-5.1.22-bin.jar, connection-url="jdbc:mysql://192.168.x.y:3306/testdb",user-name=testuser, password=testpassword,check-valid-connection-sql=select version();,validate-on-match=true)

       

      {"outcome" => "success"}

      ===================================

       

      but then :

      ===================================

      [standalone@localhost:9990 /] ls /subsystem=datasources/data-source=testDS

      connection-properties                                    min-pool-size=undefined                                

      statistics                                               new-connection-sql=undefined                           

      allocation-retry=undefined                               password=testpassword                                   

      allocation-retry-wait-millis=undefined                   pool-prefill=undefined                                 

      allow-multiple-users=false                               pool-use-strict-min=undefined                          

      background-validation=undefined                          prepared-statements-cache-size=undefined               

      background-validation-millis=undefined                   query-timeout=undefined                                

      blocking-timeout-wait-millis=undefined                   reauth-plugin-class-name=undefined                     

      capacity-decrementer-class=undefined                     reauth-plugin-properties=undefined                     

      capacity-decrementer-properties=undefined                security-domain=undefined                              

      capacity-incrementer-class=undefined                     set-tx-query-timeout=false                             

      capacity-incrementer-properties=undefined                share-prepared-statements=false                        

      check-valid-connection-sql=selectversion();              spy=false                                              

      connectable=false                                        stale-connection-checker-class-name=undefined          

      connection-listener-class=undefined                      stale-connection-checker-properties=undefined          

      connection-listener-property=undefined                   statistics-enabled=false                               

      connection-url=jdbc:mysql://192.168.x.y:3306/testdb       track-statements=NOWARN                                

      datasource-class=undefined                               tracking=false                                         

      driver-class=com.mysql.jdbc.Driver                       transaction-isolation=undefined                        

      driver-name=mysql-connector-java-5.1.22-bin.jar          url-delimiter=undefined                                

      enabled=true                                             url-selector-strategy-class-name=undefined             

      exception-sorter-class-name=undefined                    use-ccm=true                                           

      exception-sorter-properties=undefined                    use-fast-fail=false                                    

      flush-strategy=undefined                                 use-java-context=true                                  

      idle-timeout-minutes=undefined                           use-try-lock=undefined                                 

      initial-pool-size=undefined                              user-name=testuser                                  

      jndi-name=java:/testDS                               valid-connection-checker-class-name=undefined          

      jta=true                                                 valid-connection-checker-properties=undefined          

      max-pool-size=undefined                                  validate-on-match=true               

      ==========================================

       

      and when I deploy a vdb that just loads a model from the DS it works but the log shows

       

      ==========================================

      2016-03-14 22:47:32,621 WARN  [org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory] (XNIO-1 task-4)  IJ030027: Destroying connection that is not valid, due to the following exception: com.mysql.jdbc.JDBC4Connection@e60607d: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'selectversion()' at line 1

          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

          at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)

          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

          at java.lang.reflect.Constructor.newInstance(Constructor.java:526)

          at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)

          at com.mysql.jdbc.Util.getInstance(Util.java:386)

          at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1053)

          at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4096)

          at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4028)

          at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2490)

          at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2651)

          at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2728)

          at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2678)

          at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:894)

          at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:732)

          at org.jboss.jca.adapters.jdbc.CheckValidConnectionSQL.isValidConnection(CheckValidConnectionSQL.java:74)

          at org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnectionFactory.isValidConnection(BaseWrapperManagedConnectionFactory.java:1292)

          at org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnection.checkValid(BaseWrapperManagedConnection.java:512)

          at org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnectionFactory.getInvalidConnections(BaseWrapperManagedConnectionFactory.java:1082)

          at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.getConnection(SemaphoreArrayListManagedConnectionPool.java:374)

          at org.jboss.jca.core.connectionmanager.pool.AbstractPool.internalTestConnection(AbstractPool.java:1071)

          at org.jboss.jca.core.connectionmanager.pool.strategy.OnePool.testConnection(OnePool.java:91)

          at org.jboss.as.connector.subsystems.common.pool.PoolOperations$TestConnectionInPool.invokeCommandOn(PoolOperations.java:232)

          at org.jboss.as.connector.subsystems.common.pool.PoolOperations$1.execute(PoolOperations.java:88)

          at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:803)

          at org.jboss.as.controller.AbstractOperationContext.doCompleteStep(AbstractOperationContext.java:601)

          at org.jboss.as.controller.AbstractOperationContext.completeStepInternal(AbstractOperationContext.java:354)

          at org.jboss.as.controller.AbstractOperationContext.executeOperation(AbstractOperationContext.java:330)

          at org.jboss.as.controller.OperationContextImpl.executeOperation(OperationContextImpl.java:1183)

          at org.jboss.as.controller.ModelControllerImpl.internalExecute(ModelControllerImpl.java:362)

          at org.jboss.as.controller.ModelControllerImpl.execute(ModelControllerImpl.java:218)

          at org.jboss.as.domain.http.server.DomainApiHandler.handleRequest(DomainApiHandler.java:208)

          at io.undertow.server.handlers.encoding.EncodingHandler.handleRequest(EncodingHandler.java:72)

          at org.jboss.as.domain.http.server.security.SubjectDoAsHandler$1.run(SubjectDoAsHandler.java:72)

          at org.jboss.as.domain.http.server.security.SubjectDoAsHandler$1.run(SubjectDoAsHandler.java:68)

          at java.security.AccessController.doPrivileged(Native Method)

          at javax.security.auth.Subject.doAs(Subject.java:415)

          at org.jboss.as.controller.AccessAuditContext.doAs(AccessAuditContext.java:92)

          at org.jboss.as.domain.http.server.security.SubjectDoAsHandler.handleRequest(SubjectDoAsHandler.java:68)

          at org.jboss.as.domain.http.server.security.SubjectDoAsHandler.handleRequest(SubjectDoAsHandler.java:63)

          at io.undertow.server.handlers.BlockingHandler.handleRequest(BlockingHandler.java:56)

          at org.jboss.as.domain.http.server.DomainApiCheckHandler.handleRequest(DomainApiCheckHandler.java:95)

          at io.undertow.security.handlers.AuthenticationCallHandler.handleRequest(AuthenticationCallHandler.java:52)

          at io.undertow.server.Connectors.executeRootHandler(Connectors.java:199)

          at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:774)

          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

          at java.lang.Thread.run(Thread.java:745)

      =======================================

       

      If I correct the "connection checking sql" from web console, then even jboss-cli show the right sql text and everything is fine...

       

      Marco