title: Derby authentication error from Glassfish console but same credentials work from ij
body: <p>I am trying, for the first time, to run a java EE 7 web app without an IDE and struggling through the learning curve. To keep things simple I have started with Glassfish 4.1 and Derby 10.11.1.2 which is what I used for development.</p>
  
  <p>My current problem is an error configuring the connection pool on the Glassfish web interface. The error is 'Connection authentication failure occurred. Reason: Userid or password invalid'. However I have ij runing in a dos prompt and the Glashfish web console in Chrome.</p>
  
  <p>from ij I can type 'connect 'jdbc:derby:localhost:1527/databasename;user=username;password=password'; and I connect fine and can look at tables, etc.  In the Glassfish web console I have name/value pairs with the same 'user' and 'password' values and it fails (exact same letters &amp; case). I've tried changing the 'databaseName' property to make sure the error wasn't misleading and confirmed it has found the database correctly.</p>
  
  <p>At face value, the error message seems wrong as I have proven from the DOS window. I am sure I am doing something wrong but am lost at how to diagnose it. Any suggestions?</p>
  
  <hr>
  
  <p>More details of the steps taken: (Although I am sure some of these steps superceed others my lack of success has me in the mindset that redundancy is better than omission - all-in-all it seems much more complicated than it needs to be for a basic setup). My target is Wildfly but Glassfish documentation is better so I figured I would start there.</p>
  
  <ol>
  <li><p>relevant Windows environment variables: </p>
  
  <pre><code>JAVA_HOME=C:\Program Files\Java\jdk1.8.0_40
  DERBY_HOME=%JAVA_HOME%\db
  DERBY_INSTALL=%DERBY_HOME%
  JAVADB_HOME=%DERBY_HOME%
  GLASSFISH=C:\Program Files\Java\GlassFish-4.1
  Path=%JAVA_HOME%\bin;%DERBY_HOME%\bin;%GLASSFISH%\bin;%GLASSFISH%\glassfish
  CLASSPATH=%DERBY_HOME%\lib\derbynet.jar;%DERBY_HOME%\lib\derbytools.jar;%DERBY_HOME%\derbyclient.jar;%DERBY_HOME%\lib\derbyrun.jar
  WILDFLY_HOME=C:\program files\java\wildfly\8.2.0.Final
  </code></pre></li>
  <li><p>sysinfo shows all the right paths and versions</p></li>
  <li>Copied many of the derby jars from %derby_home%\lib to %glassfish%\glassfish\domains\domain1\lib\ext per a post by BalusC. I think classpath duplicates this it but can't hurt</li>
  <li>Started Domain 'asadmin start-domain' defaulting to domain 1</li>
  <li><p>Started DB by changing directories and using java. Wanted to use 'asadmin start-database --dbhome <em>DB path</em>' but this always started the wrong version. Glassfish and JDK both package derby/javadb and I couldn't figure out how to upgrade Glassfish or start the correct version any other way</p>
  
  <pre><code>cd \users\john\.netbeans-derby (root of the DB created by Netbeans)
  Java –jar “%derby_home%\lib\derbyrun.jar" server start
  </code></pre></li>
  <li>connect browser to 'localhost:4848' to create JDBC connection pool and resource</li>
  </ol>
  
  <p>connection pool: pool name=connectionPool, resource type=javax.sql.DataSource, DB driver Vendor=Derby, introspect was not enabled (found very little documentation to explain what it is) - step 2 was left as defaults
  editing connectionPool - enabled Ping on General tab to identify errors, Additional Properties tab: changed User to DB username, left other attributes as default, added... password=db password, databaseName=ClubScoring
  errors were presented along the way which prompted setting each attribute. No error was presented for lack of URL but tested steps below with and without URL=jdbc:derby://localhost:1527/ClubScoring</p>
  
  <p>jdbc resources. Added jdbc/ClubScoring, pool=connectionPool => selected and enabled</p>
  
  <ol start="7">
  <li>starting db from correct directory using 'asadmin start-database' does let the application find the correct DB but it crashes since the DB was created with version 10.11.1.2 and this command starts the Glassfish version of 10.10.2.0</li>
  </ol>
  
  <p>Sorry for making this so long but I haven't found anywhere that lays out all of the steps in a simple fashion and figured the details would save time in the long run.</p>