control keymgr.dll
Developers Incidents
Monday, 7 October 2013
Monday, 30 September 2013
Remove error or virus home page from chrome
C:\Users\KMT\AppData\Local\Google\Chrome\User Data\Default
Thursday, 22 August 2013
Tuesday, 2 July 2013
Connect MySql with Java and eclipse
Download and install the eclipse, java and Mysql
Open eclipse
File-->New-->Class
give the class name as JDBCExample
then copy the follwing code
package testPkg;
import java.sql.*;
//import com.mysql.jdbc.Driver;
public class JDBCExample {
public static void main(String[] args) throws ClassNotFoundException,
SQLException {
String username = "root";
String password = "root";
String tablename = "login";
String fieldname = "uname";
String query = "SELECT " + fieldname + " FROM " + tablename + ";";
/* this chunk of code can appear more or less verbatim */
String url = "jdbc:mysql://localhost:3306/database";
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection(url, username, password);
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(query);
System.out.println("The contents of field " + fieldname + ":");
while (rs.next())
System.out.print(rs.getString(1) + ", ");
// note that getString anomalously starts counting at 1, not 0
System.out.println();
rs.close();
stmt.close();
con.close();
}
}
It will show the error that com.mysql.jdbc.Driver not found.
To resolve this issue use the following step.
right Click on project-->Build Path-->Use external Archives-->then path that mysql-connector-java-5.1.25-bin File
Then Execute the code.
Friday, 17 May 2013
Subscribe to:
Comments (Atom)