On this occasion I will share about how to make a connection with MySQL Java. What we need here is NetBeans as the IDE, which would free version of what happened to me using NetBeans 7.0, but that we also need the XAMPP for MySQL database. Immediately, I explain codingnya below:
1. First we make a Java class in NetBeans with the name "Koneksi.java"
2. Then type in the script as below :
-------------------------------------------------------------------------------
public class Koneksi {
Connection con;
String driver,url,user,pass;
public Koneksi() {
this.driver="com.mysql.jdbc.Driver";
this.url="jdbc:mysql://localhost:3306/kuliah";
this.user="root";
this.pass="root";
}
public Koneksi(Connection con, String driver, String url, String user, String pass) {
this.con = con;
this.driver = driver;
this.url = url;
this.user = user;
this.pass = pass;
}
public void BukaKoneksi(){
try {
Class.forName(driver).newInstance();
con = DriverManager.getConnection(url,user,pass);
} catch (SQLException ex) {
Logger.getLogger(Koneksi.class.getName()).log(Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
Logger.getLogger(Koneksi.class.getName()).log(Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
Logger.getLogger(Koneksi.class.getName()).log(Level.SEVERE, null, ex);
} catch (ClassNotFoundException ex) {
Logger.getLogger(Koneksi.class.getName()).log(Level.SEVERE, null, ex);
}
}
public Connection getCon() {
return con;
}
public void setCon(Connection con) {
this.con = con;
}
}
-------------------------------------------------------------------------------
+ comments + 25 comments
Thank you for posting an excellent content, this is the best content I have never seen which is related to current technology. Refer me for IT studies and language courses.
Regards:
Big Data Hadoop Training in Chennai
Best hadoop training institute in chennai
I have read your blog and i got a very useful and knowledgeable information from your blog. You have done a great job.
Java Training in Chennai | Java Training Institute in Chennai
Your good knowledge and kindness in playing with all the pieces were very useful. I don’t know what I would have done if I had not encountered such a step like this.
Devops Training in Chennai
Devops Training in Bangalore
Devops Training in pune
Very good brief and this post helped me alot. Say thank you I searching for your facts. Thanks for sharing with us!
python training institute in chennai
python training in Bangalore
python training in pune
python online training
The post is written in very a good manner and it entails many useful information for me. I am happy to find your distinguished way of writing the post. Now you make it easy for me to understand and implement the concept.
Blueprism training in Pune
Blueprism online training
Blue Prism Training in Pune
Thanks for splitting your comprehension with us. It’s really useful to me & I hope it helps the people who in need of this vital information.
Data science training in tambaram | Data Science training in anna nagar
Data Science training in chennai | Data science training in Bangalore
Data Science training in marathahalli | Data Science training in btm
The knowledge of technology you have been sharing thorough this post is very much helpful to develop new idea. here by i also want to share this.
java training in omr | oracle training in chennai
java training in annanagar | java training in chennai
Do you mind if I quote a couple of your posts as long as I provide credit and sources back to your blog?
safety course in chennai
Well Said, you have furnished the right information that will be useful to anyone at all time. Thanks for sharing your Ideas. block chain training in chennai | Selenium training in chennai
This is really impressive post, I am inspired with your post, do post more blogs like this.
Devops Training in Chennai | Devops Training Institute in Chennai
Amazing post.Thanks for your details and explanations..I want more information from your side.Thank you
Article submission sites
Guest posting sites
Thanks for your informative article, Your post helped me to understand the future and career prospects & Keep on updating your blog with such awesome article.
Microsoft Azure online training
Selenium online training
Java online training
Java Script online training
Share Point online training
I appreciate your efforts because it conveys the message of what you are trying to say. It's a great skill to make even the person who doesn't know about the subject could able to understand the subject . Your blogs are understandable and also elaborately described. I hope to read more and more interesting articles from your blog. All the best.
devops online training
aws online training
data science with python online training
data science online training
rpa online training
Hey, would you mind if I share your blog with my twitter group? There’s a lot of folks that I think would enjoy your content. Please let me know. Thank you.
Top SAS Training in Chennai |Advanced SAS Training in Chennai
Top SAS Training in Chennai |Advanced SAS Training in Chennai
Top Data Science With R Training in Chennai |Advanced Data Science With R Training in Chennai
Top Data Science With Python Training in Chennai |Advanced Data Science With Python Training in Chennai
Top Data Science With Machine Learning Training in Chennai |Advanced Data Science With Machine Learning Training in Chennai
It’s really a Great Post .Looking for Some More Stuff
salesforce Training in Bangalore
uipath Training in Bangalore
blueprism Training in Bangalore
Thanks for the well-written post and I will follow your updates regularly and this is really helpful. Keep posting more like this.
salesforce Training in Bangalore
uipath Training in Bangalore
blueprism Training in Bangalore
Thank you for your post. This is excellent information. It is amazing and wonderful to visit your site.
aws Training in Bangalore
python Training in Bangalore
hadoop Training in Bangalore
angular js Training in Bangalore
bigdata analytics Training in Bangalore
Its an fantastic blog...
BEST ANGULAR JS TRAINING IN CHENNAI WITH PLACEMENT
https://www.acte.in/angular-js-training-in-chennai
https://www.acte.in/angular-js-training-in-annanagar
https://www.acte.in/angular-js-training-in-omr
https://www.acte.in/angular-js-training-in-porur
https://www.acte.in/angular-js-training-in-tambaram
https://www.acte.in/angular-js-training-in-velachery
Your good thoughts and kindness play with all hearts.
AngularJS training in chennai | AngularJS training in anna nagar | AngularJS training in omr | AngularJS training in porur | AngularJS training in tambaram | AngularJS training in velachery
very nice blog!!!Thanks for your information!!!
android training in chennai
android online training in chennai
android training in bangalore
android training in hyderabad
android Training in coimbatore
android training
android online training
Awesome blog. I enjoyed reading your articles. This is truly a great read for me. oracle training in chennai
It’s awesome that you want to share those tips with us. It is a very useful post Keep it up and thanks to the writer.
Angular js Training in Chennai
Angular js Training in Velachery
Angular js Training in Tambaram
Angular js Training in Porur
Angular js Training in Omr
Angular js Training in Annanagar
Thanks for the well-written post and I will follow your updates regularly and this is really helpful. Keep posting more like this.
IELTS Coaching in chennai
German Classes in Chennai
GRE Coaching Classes in Chennai
TOEFL Coaching in Chennai
Spoken english classes in chennai | Communication training
I really enjoy the article.Thanks Again. Fantastic.
best online java corse
java online classes
very informative blog. very useful.
SQL course in Pune
Post a Comment