0 Replies Latest reply on Sep 17, 2003 2:29 AM by shen

    About could not create connection!!

    shen Newbie

      org.apache.jasper.JasperException: Could not create connection; - nested throwable: (java.sql.SQLException: Server configuration denies access to data source); - nested throwable: (org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (java.sql.SQLException: Server configuration denies access to data source))

      My client's code looking for the Mysql datasource successful!
      But , I can't create connection~~ happen preceding exception!

      client's code:

      <%@page import = "java.sql.*,javax.naming.*,javax.sql.*" contentType="text/html;charset=Big5" %>
      Access
      <%!
      Statement stmt = null;
      ResultSet rs = null;
      int count;
      %>
      <%

      InitialContext initctx = new InitialContext();
      DataSource ds = (DataSource)initctx.lookup("java:/MySqlDS");
      Connection con = ds.getConnection();
      out.println("hi");

      try
      {
      stmt = con.createStatement();
      rs = stmt.executeQuery("select * from test");
      while(rs.next())
      {
      out.println("number&#65306;"+rs.getInt("id")+"");
      out.println("name&#65306;"+rs.getString("name")+"");
      out.println("");
      }
      }
      catch (Exception e)
      {
      out.println("SQLException caught: " + e.getMessage());
      }
      finally
      {
      try
      {
      rs.close();
      stmt.close();
      }
      catch (Exception s) {}
      }
      %>