Showing posts with label Java for Beginners. Show all posts
Showing posts with label Java for Beginners. Show all posts

Thursday 20 February 2014

java mysql connection example easily

Connect to MySQL with JDBC driver



Here’s an example to show you how to connect to MySQL database via a JDBC driver. First, get a MySQL JDBC driver from here -MySQL JDBC Driver Download Here.

MySQL JDBC Driver  should be in same folder where you save your project.

1. Java JDBC connection example

Code snippets to use a JDBC driver to connect a MySQL database.
Class.forName("com.mysql.jdbc.Driver");
Connection conn = null;
conn = DriverManager.getConnection("jdbc:mysql://hostname:port/dbname","username", "password");
conn.close();

---------------------------------------------------------------------------------------------------------

Java & MySQL - Basic connection and insert values (NetBeans)  

 

Wednesday 19 February 2014

How to open a web page by using java code?


  java code to open a web page in program



 import java.io.*;
public class mani {
public static void main(String args[])throws IOException{
    try
{
Process p=Runtime.getRuntime().exec("cmd /c start http://gossipbollywoodreviews.blogspot.in/");
}
catch(IOException e1) {System.out.println(e1);}
}
}

Thursday 18 April 2013

BEST SITE TO LEARN COMPUTER AND COMPUTER LANGUAGE

home and learn www.homeandlearn.co.uk
BEST SITE TO LEARN COMPUTER AND COMPUTER LANGUAGE LIKE Microsoft Word, Microsoft Excel, Web Design, PowerPoint, Javascript , Visual Basic .NET, Visual C# .NET, Beginners PHP, Java for Beginners,
GO HERE www.homeandlearn.co.uk Qualifications and Certificates