1 Reply Latest reply on Jun 9, 2006 8:59 PM by Lance Drake

    Simple Entity Bean - Help to complete

    jklanka Newbie

      I have setup JBoss-IDE with Eclipse with Jboss. The Jboss Version I use jboss-4.0.2RC1.

      1. I have configured MySQL version 5.0.21 to Jboss. and I followed the URL
      to configure the database with JBoss.

      2. I made a small table with MySQL

      CREATE TABLE `fortunedb`.`test` (
      `id` varchar(10) NOT NULL,
      `name` varchar(45) NOT NULL,
      PRIMARY KEY (`id`)

      3. I made a simple Entity Bean Call Test bean to connect to the test table as follow


      <![CDATA[Description for Test]]>
      <display-name>Name for Test</display-name>




      <cmp-field >
      <cmp-field >









      4. I am running a Servlet Client to get the connection

      public void init(ServletConfig config) throws ServletException {
      try {
      Context context = new InitialContext();
      Object ref = context.lookup("java:comp/env/ejb/Test");
      home = (TestHome) PortableRemoteObject.narrow(ref, TestHome.class);
      } catch (Exception e) {
      throw new ServletException("Lookup of java:/comp/env/ failed" + e);

      protected void doGet(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException,
      IOException {

      PrintWriter out=resp.getWriter();

      try {

      Test bean = home.findByPrimaryKey("jk");
      } catch (Exception e) {

      5. But when I run this Servlet it gives me the following error

      "javax.ejb.FinderException: Find failed: java.sql.SQLException: Syntax error or access violation message from server: "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 'FROM test t0_Test WHERE' at line 1""

      Please help me to go further on this. I am totally stuck here and I coukld not realise where I made the mistake.

        • 1. Re: Simple Entity Bean - Help to complete
          Lance Drake Newbie


          The SAME problem has defied solution in my project, as well.

          So... what is the root cause for this complaint, pray tell?

          Really, what I'd like to know is "What are the requirements in the jboss XML files that would allow for a successful connection and access to a MySQL database?" I've seen the Connection/J docs - I've queried this site and others - they all offer a smattering of detail - but never get down to the statement, "You MUST - at LEAST - do this - or the game will not start".

          Any vectors to a good JBoss/MySQL sample project I can learn from?

          THANK YOU!