users@glassfish.java.net

Re: MYSQL DataSource with Glassfish under Netbeans 6.9

From: <forums_at_java.net>
Date: Thu, 14 Apr 2011 22:58:45 -0500 (CDT)

the steps for creating the datasource and using it in the loginform in order
to take the *username/password *and match it(using the authentification
entity)with the entered one in this form
*
1)After setting up the JDBC with Mysql and created a table authentification
where I put the password and user names
2)I choose create entity from database wizard which ask for jndi, I put
Mysql/datasource and used the url configured
"jdbc:mysql://localhost:3306/mysql [root on Default schema]"which is listed
in drop down box, I also checked  "Create persistance Unit" and I have
choosen authentification table and moved in the text area name  selected
tables.
3)This step generates entity class called authentification
4) For the mapping step of the wizard I have chosen the default
*In the code of loginform Class then  I have imported the required
persistence package in this class and used the follwing code snippet
*1)EntityManagerFactory emf=
Persistence.createEntityManagerFactory("ejbPU");     // succeeded without
error and I emf is not empty
2)Authentification em = (Authentification)
emf.createEntityManager();*                  // Here I get
an error :* Cannot acquire [Mysql/datasource]*

After this I intend to use *"em" *and select the *username/passwordand do a**
select** from authentification
*


--
[Message sent by forum member 'Miloud_j2ee']
View Post: http://forums.java.net/node/789364