Frist section I mention how to configure netbeans
with apache server and connect MySQL with Netbeans.
Part
I: download netbeans and setup apache server
Go to netbeans URL and download Java EE package
When you install IDE It appear this kind of screen,
make sure you click Apache Tomcat 8.0.15 check box and continue.
After complete installation you can open Netbeans
IDE.
Go to WindowàServices and you
can see Services tab in left side corner.
Expand Servers and you can see Apache Tomcat and
GlassFish server inside it.
You can start server,
Right Click Apache Tomcat or TomEEàStart
-------------------------------------------------------------------------------------------------------
If you don’t see any server in there you
need to download Apache server and setup in netbeans.
Download Apache Tomcat 8.0
Extract it into C drive (you can use any place you
want).
Again Go to NetbeansàServicesàRight
Click ServeràAdd
Server
Select Apache Tomcat or TomEE and Click Next.
Make sure you give correct path to both location and
click Finish.
Then you can see Apache Tomcat or TomEE server in
servers list. Right Click it and Start server.
--------------------------------------------------------------------------------------------------------
Still you have Errors in your server you
need to
Right Click Apache Tomcat or TomEE àEdit
server.xml and change port numbers in line 69, 71, 91 to something else.
Part
II: How to connect Netbeans with MySQL Databases
Create Database Using MySQL. (I’ve done database
creation in my previous lesson. Make sure you run wamp server)
Again go to NetbeansàServicesàDatabasesàDrivers
Expand it and Right Click MySQL (Connector/J driver)
and Click Connect Using…
Put correct Host, Port, Database Name, Username and
Password and Click Finish.
Then you can see jdbc URL like show in below
picture.
We
are successfully connecting MySQL database with Netbeans.
You can check connection Right Click jdbc:mysql://..
àExecute
Command.
Write SQL query to check connection. I write select
query to retrieve table information and result appear in bottom of page as
shown here.
-----------------------------------------------------------------------------------------------------
Sometimes ServicesàDatabasesàDriversà MySQL(Connector/J driver) Not Shown. So you need to install that
driver to your computer. You can use this link.
Next Section I discuss about simple application
using Java Servlet how to insert data to MySQL database...To be Continue
Really good
ReplyDeletegreat
ReplyDelete