This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
It is not clear what exactly you are trying to do. Which IDE/deployment tool/appserver are you using?
Regardless, you will need mysql jdbc driver added to your server's classpath (if it is not there already). Just drop the jar in its lib folder.
Next, from the admin GUI of the app server, configure a connectionpool and datasource that uses your database. While creating datasource, use the JNDI name that you have used in your persistence.xml. For example, if you have used <jta-data-source>jdbc/ejbplus</jta-data-source> in persistence.xml, use name the datasource as ejbplus.
If you want to create entities corresponding to existing tables in your database, you will need to configure a database connection (that points you the database that you want) in your IDE and then use its GUI to generate the entities for the tables. You will still need to configure datasource in appserver when you deploy the application.
Hi Paul, Thanks for reply I am using J2EE RI. I had copied MySql from my friend's PC. I think i didnt copied any drivers for MySql. In that case, i will download driver. I dont know (my friend too) username and password for MySql. He was starting database and running command Mysql -console from bin folder in MySql directory, and we get MySql prompt. How to provide information about MySql to Entity Bean while deploying in the deploytool of J2EE RI?
Thanks and Regards,
Enthuware Software Support
Originally posted by KRK Gowda: [QB]Hi Paul, I dont know (my friend too) username and password for MySql. He was starting database and running command Mysql -console from bin folder in MySql directory, and we get MySql prompt. [QB]
So are you able to run mysql the same way on your machine? Are you able to fire sqls on mysql cmd window? (e.g. try "show databases"). If you are able to do that, that means your db is working and you are using default username and password which, if I remember correctly, is "root" and password is empty. Anyhow, just create a new user from the mysql command window: mysql> GRANT ALL ON *.* TO gowda@localhost IDENTIFIED BY 'mypassword';
Use this user name and password and follow the steps described in my previous post.