How can I configure persistence.xml file to connect to my SQL Server. Some information is connected as: Host, DatabaseName, UserName, Password, Port, …
How can I configure persistence.xml file to connect to my SQL Server. Some information
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Setting up a connection pool to MySQL database using a configuration
.xmlfile can be pretty troublesome to someone who has just started like you.In my opinion, you should take a look at this short guide. You simply need to start Glassfish server, open the browser and surf to
http://yourdomain.com:4848to access the Admin panel. After that, just follow the instruction in that article and to create theJDBC Connection poolandJDBC Resource. At this point, you only need to open thepersistence.xmlfile with your IDE (NetBeans, etc.) and set theData Sourceproperty with name of yourJDBC Resourceand you’re done.One thing to note is that you must download the latest MySQL Connector/J and copy the file
into the folder
Otherwise, you will run into the expcetion
Class name is wrong or classpath is not set for : com.mysql.jdbc.jdbc2.optional.MysqlDataSourceif you try to ping the database after creating theJDBC Connection pool.