Your xyz pool has the wrong type.
The "resource-type" is supposed to be javax.sql.DataSource
You have it set to javax.sql.ConnectionPoolDataSource
Why don't you try all over again (leave everything as is -- add a new Pool, JDBC resource, Realm).
Follow the instructions in my blog:
http://blogs.sun.com/foo/entry/mort_learns_jdbc_for_glassfish
If you follow those steps, you should be able to access the DB from a simple servlet.
I.e. follow the blog instructions, then create a simple servlet. Put these lines in the servlet's process-request method and deploy it to the server with the jdbc resource.
Once the servlet works, you know your jdbc-resource is OK and we can move to the next step: Realm
I {
List<Integer> fromDB = new ArrayList<Integer>();
Exception keepException = null;
try
{
InitialContext ctx = new InitialContext();
DataSource ds = (DataSource) ctx.lookup("jdbc/userauth");
Connection connection = ds.getConnection();
Statement statement = connection.createStatement();
statement.execute("CREATE TABLE FOO(ID int)");
statement.execute("insert into foo values(20)");
statement.execute("insert into foo values(200)");
ResultSet rs = statement.executeQuery("select * from foo");
while(rs.next())
fromDB.add(rs.getInt(1));
}
catch (Exception ex)
{
keepException = ex;
ex.printStackTrace();
}
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet TestServlet</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>Servlet TestServlet at " + request.getContextPath () + "</h1>");
if(keepException != null)
out.println("<h2>Got an Exception: " + keepException + "</h2>");
for(Integer i : fromDB)
out.println("<h2This value from the DB should be 20 or 200: " + i + "</h2>");
out.println("</body>");
out.println("</html>");
out.close();
}
[Message sent by forum member 'bnevins' (bnevins)]
http://forums.java.net/jive/thread.jspa?messageID=238346