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 http://www.cotsec.com/documentation/installation/j2ee_jboss_mysql/index.html#3.%20Add%20the%20Java%20MySQL%20Library 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`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 3. I made a simple Entity Bean Call Test bean to connect to the test table as follow ejb-jar.xml:::: <![CDATA[Description for Test]]> <display-name>Name for Test</display-name> <ejb-name>Test</ejb-name> com.account.TestHome com.account.Test <ejb-class>com.account.TestCMP</ejb-class> <persistence-type>Container</persistence-type> <prim-key-class>java.lang.String</prim-key-class> False <cmp-version>2.x</cmp-version> <abstract-schema-name>Test</abstract-schema-name> <cmp-field > <![CDATA[]]> <field-name>id</field-name> </cmp-field> <cmp-field > <![CDATA[]]> <field-name>name</field-name> </cmp-field> jboss.xml:::::: <ejb-name>Test</ejb-name> <jndi-name>ejb/Test</jndi-name> jbosscmp-jdbc.xml:::: java:/MySqlDS <datasource-mapping>mySQL</datasource-mapping> <enterprise-beans> <ejb-name>Test</ejb-name> <table-name>test</table-name> <cmp-field> <field-name>id</field-name> <column-name>id</column-name> </cmp-field> <cmp-field> <field-name>name</field-name> <column-name>name</column-name> </cmp-field> </enterprise-beans> 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 { resp.setContentType("text/html"); PrintWriter out=resp.getWriter(); try { Test bean = home.findByPrimaryKey("jk"); out.print(bean.getName()); } catch (Exception e) { out.print(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. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3946462#3946462 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3946462 ------------------------------------------------------- All the advantages of Linux Managed Hosting--Without the Cost and Risk! Fully trained technicians. The highest number of Red Hat certifications in the hosting industry. Fanatical Support. Click to learn more http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642 _______________________________________________ JBoss-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/jboss-user
