8 Replies Latest reply on Jan 27, 2007 11:59 PM by sai_nukala

    User not found: SA

    sabelorin

      I am using JBoss 4.0.1sp1 and the Getting Started Guide 4.0 v3, and have reached section 4.1.7 (The Database) with no problems. As stated by the tutorial, I have uncommented the code that uses TCP connections and commented out the other sections:

      <connection-url>jdbc:hsqldb:hsql://localhost:1701</connection-url>
      ....
      <depends>jboss:service=Hypersonic</depends>
      ....
      <mbean code="org.jboss.jdbc.HypersonicDatabase"
       name="jboss:service=Hypersonic">
       <attribute name="Port">1701</attribute>
       <attribute name="Silent">true</attribute>
       <attribute name="Database">default</attribute>
       <attribute name="Trace">false</attribute>
       <attribute name="No_system_exit">true</attribute>
       </mbean>
      


      However, I receive "User not found: SA" messages whenever trying to access the database, as follows (this also occurs when trying to connect through the HSQL DB Manager):

      C:\j2eetutorial14\examples\bank>ant -f jboss-build.xml db-create-table
      Buildfile: jboss-build.xml

      db-create-table:
      [java] ScriptTool.init error: User not found: SA
      [java] java.sql.SQLException: User not found: SA
      [java] at org.hsqldb.jdbc.jdbcUtil.sqlException(Unknown Source)
      [java] at org.hsqldb.jdbc.jdbcConnection.(Unknown Source)
      [java] at org.hsqldb.jdbcDriver.getConnection(Unknown Source)
      [java] at org.hsqldb.jdbcDriver.connect(Unknown Source)
      [java] at java.sql.DriverManager.getConnection(DriverManager.java:512)
      [java] at java.sql.DriverManager.getConnection(DriverManager.java:171)
      [java] at org.hsqldb.util.ScriptTool.execute(Unknown Source)
      [java] at org.hsqldb.util.ScriptTool.main(Unknown Source)
      [java] java.lang.NullPointerException
      [java] at org.hsqldb.util.ScriptTool.execute(Unknown Source)
      [java] at org.hsqldb.util.ScriptTool.main(Unknown Source)
      [java] Exception in thread "main"
      [java] Java Result: 1

      BUILD SUCCESSFUL
      Total time: 1 second

      What is missing/incorrect? Thanks.

        • 1. Re: User not found: SA

          That shouldn't happen. Why don't you post your whole hsql-ds.xml file?

          • 2. Re: User not found: SA
            sabelorin

            OK, here it is (hsqldb-ds.xml):

            <?xml version="1.0" encoding="UTF-8"?>
            
            <!-- The Hypersonic embedded database JCA connection factory config
            $Id: hsqldb-ds.xml,v 1.15 2004/09/15 14:37:40 loubyansky Exp $ -->
            
            
            <datasources>
             <local-tx-datasource>
            
             <!-- The jndi name of the DataSource, it is prefixed with java:/ -->
             <!-- Datasources are not available outside the virtual machine -->
             <jndi-name>DefaultDS</jndi-name>
            
             <!-- for tcp connection, allowing other processes to use the hsqldb
             database. This requires the org.jboss.jdbc.HypersonicDatabase mbean. -->
             <connection-url>jdbc:hsqldb:hsql://localhost:1701</connection-url>
            
             <!-- for totally in-memory db, not saved when jboss stops.
             The org.jboss.jdbc.HypersonicDatabase mbean necessary
             <connection-url>jdbc:hsqldb:.</connection-url>
            -->
             <!-- for in-process persistent db, saved when jboss stops. The
             org.jboss.jdbc.HypersonicDatabase mbean is necessary for properly db shutdown
             <connection-url>jdbc:hsqldb:${jboss.server.data.dir}${/}hypersonic${/}localDB</connection-url>
            -->
            
             <!-- The driver class -->
             <driver-class>org.hsqldb.jdbcDriver</driver-class>
            
             <!-- The login and password -->
             <user-name>sa</user-name>
             <password></password>
            
             <!--example of how to specify class that determines if exception means connection should be destroyed-->
             <!--exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.DummyExceptionSorter</exception-sorter-class-name-->
            
             <!-- this will be run before a managed connection is removed from the pool for use by a client-->
             <!--<check-valid-connection-sql>select * from something</check-valid-connection-sql> -->
            
             <!-- The minimum connections in a pool/sub-pool. Pools are lazily constructed on first use -->
             <min-pool-size>5</min-pool-size>
            
             <!-- The maximum connections in a pool/sub-pool -->
             <max-pool-size>20</max-pool-size>
            
             <!-- The time before an unused connection is destroyed -->
             <!-- NOTE: This is the check period. It will be destroyed somewhere between 1x and 2x this timeout after last use -->
             <!-- TEMPORARY FIX! - Disable idle connection removal, HSQLDB has a problem with not reaping threads on closed connections -->
             <idle-timeout-minutes>0</idle-timeout-minutes>
            
             <!-- sql to call when connection is created
             <new-connection-sql>some arbitrary sql</new-connection-sql>
             -->
            
             <!-- sql to call on an existing pooled connection when it is obtained from pool
             <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
             -->
            
             <!-- example of how to specify a class that determines a connection is valid before it is handed out from the pool
             <valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.DummyValidConnectionChecker</valid-connection-checker-class-name>
             -->
            
             <!-- Whether to check all statements are closed when the connection is returned to the pool,
             this is a debugging feature that should be turned off in production -->
             <track-statements/>
            
             <!-- Use the getConnection(user, pw) for logins
             <application-managed-security/>
             -->
            
             <!-- Use the security domain defined in conf/login-config.xml -->
             <security-domain>HsqlDbRealm</security-domain>
            
             <!-- Use the security domain defined in conf/login-config.xml or the
             getConnection(user, pw) for logins. The security domain takes precedence.
             <security-domain-and-application>HsqlDbRealm</security-domain-and-application>
             -->
            
             <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
             <metadata>
             <type-mapping>Hypersonic SQL</type-mapping>
             </metadata>
            
             <!-- This mbean can be used when using in process persistent hypersonic -->
             <!-- <depends>jboss:service=Hypersonic,database=localDB</depends> -->
             <depends>jboss:service=Hypersonic</depends>
             </local-tx-datasource>
            
             <!-- This mbean should be used only when using tcp connections. Uncomment
             when the tcp based connection-url is used. -->
             <mbean code="org.jboss.jdbc.HypersonicDatabase"
             name="jboss:service=Hypersonic">
             <attribute name="Port">1701</attribute>
             <attribute name="Silent">true</attribute>
             <attribute name="Database">default</attribute>
             <attribute name="Trace">false</attribute>
             <attribute name="No_system_exit">true</attribute>
             </mbean>
            
             <!-- This mbean can be used when using in process persistent db
             <mbean code="org.jboss.jdbc.HypersonicDatabase"
             name="jboss:service=Hypersonic,database=localDB">
             <attribute name="Database">localDB</attribute>
             <attribute name="InProcessMode">true</attribute>
             </mbean> -->
            </datasources>


            • 3. Re: User not found: SA
              112358

              line
              <connection-url>jdbc:hsqldb:.</connection-url>
              should read
              connection-url>jdbc:hsqldb:hsql://localhost:1701</connection-url>

              • 4. Re: User not found: SA
                sabelorin

                That section (for in-memory DB) is commented out, although the locahost:1701 connection url is used for TCP:

                <!-- for tcp connection, allowing other processes to use the hsqldb
                 database. This requires the org.jboss.jdbc.HypersonicDatabase mbean. -->
                 <connection-url>jdbc:hsqldb:hsql://localhost:1701</connection-url>
                
                 <!-- for totally in-memory db, not saved when jboss stops.
                 The org.jboss.jdbc.HypersonicDatabase mbean necessary
                 <connection-url>jdbc:hsqldb:.</connection-url>
                -->
                


                Just to be sure, I made the change, but the message still appears.

                • 5. Re: User not found: SA
                  zjim01

                  At the bottom of the file make sure that you do not comment out the original section. Both sections need to be there. Here is what both sections should look like:
                  <!-- This mbean should be used only when using tcp connections. Uncomment
                  when the tcp based connection-url is used.
                  -->

                  1701
                  true
                  default
                  false
                  true


                  <!-- This mbean can be used when using in process persistent db -->

                  localDB
                  true

                  • 6. Re: User not found: SA
                    zjim01

                    (Sorry about previous post. First time on the forum. Hope this looks better.)
                    At the bottom of the file make sure that you don not comment out the original section. Both sections need to be there.
                    Here is what both sections should look like:

                    <!-- This mbean should be used only when using tcp connections. Uncomment
                     when the tcp based connection-url is used.
                     -->
                     <mbean code="org.jboss.jdbc.HypersonicDatabase"
                     name="jboss:service=Hypersonic">
                     <attribute name="Port">1701</attribute>
                     <attribute name="Silent">true</attribute>
                     <attribute name="Database">default</attribute>
                     <attribute name="Trace">false</attribute>
                     <attribute name="No_system_exit">true</attribute>
                     </mbean>
                    
                     <!-- This mbean can be used when using in process persistent db -->
                     <mbean code="org.jboss.jdbc.HypersonicDatabase"
                     name="jboss:service=Hypersonic,database=localDB">
                     <attribute name="Database">localDB</attribute>
                     <attribute name="InProcessMode">true</attribute>
                     </mbean>
                    </datasources>


                    • 7. Re: User not found: SA
                      lindner

                      And make sure you enter "sa" as username.
                      You can view the settings of your hsqldb mbean by visiting URL http://localhost:8080/jmx-console/HtmlAdaptor?action=inspectMBean&name=jboss%3Aservice%3DHypersonic%2Cdatabase%3DlocalDB

                      • 8. Re: User not found: SA
                        sai_nukala

                        The possible reason could be that your script is deleted..

                        Make sure if you valid "localDB.script" file under $JBOSS_HOME/server/all/data/hypersonic and it should not be empty;;

                        Here is the script from 4.0.3 SP1 on windows:

                        CREATE SCHEMA PUBLIC AUTHORIZATION DBA
                        CREATE MEMORY TABLE TIMERS(TIMERID VARCHAR(80) NOT NULL,TARGETID VARCHAR(80) NOT NULL,INITIALDATE TIMESTAMP NOT NULL,TIMERINTERVAL BIGINT,INSTANCEPK VARBINARY,INFO VARBINARY,CONSTRAINT TIMERS_PK PRIMARY KEY(TIMERID,TARGETID))
                        CREATE MEMORY TABLE JMS_USERS(USERID VARCHAR(32) NOT NULL PRIMARY KEY,PASSWD VARCHAR(32) NOT NULL,CLIENTID VARCHAR(128))
                        CREATE MEMORY TABLE JMS_ROLES(ROLEID VARCHAR(32) NOT NULL,USERID VARCHAR(32) NOT NULL,PRIMARY KEY(USERID,ROLEID))
                        CREATE MEMORY TABLE JMS_SUBSCRIPTIONS(CLIENTID VARCHAR(128) NOT NULL,SUBNAME VARCHAR(128) NOT NULL,TOPIC VARCHAR(255) NOT NULL,SELECTOR VARCHAR(255),PRIMARY KEY(CLIENTID,SUBNAME))
                        CREATE CACHED TABLE JMS_MESSAGES(MESSAGEID INTEGER NOT NULL,DESTINATION VARCHAR(255) NOT NULL,TXID INTEGER,TXOP CHAR(1),MESSAGEBLOB OBJECT,PRIMARY KEY(MESSAGEID,DESTINATION))
                        CREATE INDEX JMS_MESSAGES_TXOP_TXID ON JMS_MESSAGES(TXOP,TXID)
                        CREATE INDEX JMS_MESSAGES_DESTINATION ON JMS_MESSAGES(DESTINATION)
                        CREATE CACHED TABLE JMS_TRANSACTIONS(TXID INTEGER NOT NULL PRIMARY KEY)
                        CREATE MEMORY TABLE HILOSEQUENCES(SEQUENCENAME VARCHAR(50) NOT NULL,HIGHVALUES INTEGER NOT NULL,CONSTRAINT HILO_PK PRIMARY KEY(SEQUENCENAME))
                        SET TABLE JMS_MESSAGES INDEX'1936 1936 1936 0'
                        CREATE USER SA PASSWORD ""
                        GRANT DBA TO SA
                        SET WRITE_DELAY 20
                        SET SCHEMA PUBLIC
                        INSERT INTO JMS_USERS VALUES('dynsub','dynsub',NULL)
                        INSERT INTO JMS_USERS VALUES('guest','guest',NULL)
                        INSERT INTO JMS_USERS VALUES('j2ee','j2ee',NULL)
                        INSERT INTO JMS_USERS VALUES('john','needle','DurableSubscriberExample')
                        INSERT INTO JMS_USERS VALUES('nobody','nobody',NULL)
                        INSERT INTO JMS_ROLES VALUES('durpublisher','dynsub')
                        INSERT INTO JMS_ROLES VALUES('publisher','dynsub')
                        INSERT INTO JMS_ROLES VALUES('guest','guest')
                        INSERT INTO JMS_ROLES VALUES('j2ee','guest')
                        INSERT INTO JMS_ROLES VALUES('john','guest')
                        INSERT INTO JMS_ROLES VALUES('durpublisher','john')
                        INSERT INTO JMS_ROLES VALUES('publisher','john')
                        INSERT INTO JMS_ROLES VALUES('subscriber','john')
                        INSERT INTO JMS_ROLES VALUES('noacc','nobody')
                        INSERT INTO HILOSEQUENCES VALUES('general',0)

                        Hope this helps..You might have to confirm if index is ok...