|
XP Problem Solution and Debugging Site by Webmaster JAMAL
MYSQL install This page Contains detail about how to install "MYSQL" database and connect it with "DBBrowser" for GUI InterfaceYou can Download mysql from www.mysql.com You can download DBBrowser from http://databasebrowser.sourceforge.net Steps to install MYSQL1.Double click the downloaded rar file 2.Double Click mysql-nt.exe file to start install 3.After install Configure the MYSql using configuration wizard from start->allprograms->MYSQL server->mysql instance configwizard 4.Choose standard configuration 5.Check include bin to directory path 6.Give user name and password click ok 7.Now you can able to create table using mysql. Steps to run a Jdbc Program using MYSQL1.Copy paste the myjdbc-connector in to MYSQL Installed folder 2.Set classpath to that Path. ex:set classpath=C:/Program Files/MySQL/MySQL Server 5.0/ mysql-connector-java-5.1.6/ Example MYSQL JAVA JDBC PROGRAMimport java.sql.*; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; public class mysql { public static void main(String[] args) { Statement stmt = null; ResultSet rs = null; try { // The newInstance() call is a work around for some // broken Java implementations Class.forName("com.mysql.jdbc.Driver").newInstance(); } catch (Exception ex) { // handle the error } try { Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/test?" + "user=root&password=*****"); stmt = conn.createStatement(); rs = stmt.executeQuery("SELECT * FROM one"); // or alternatively, if you don't know ahead of time that // the query will be a SELECT... if (stmt.execute("SELECT * FROM one")) { rs = stmt.getResultSet(); // Do something with the Connection while(rs.next()) { String name=rs.getString("name"); System.out.println(name); } } } catch (SQLException ex) { // handle any errors System.out.println("SQLException: " + ex.getMessage()); System.out.println("SQLState: " + ex.getSQLState()); System.out.println("VendorError: " + ex.getErrorCode()); } } } DBBrowser Sofware Connection setup waysChoose the Name : MyDatabase Select the Dbms type :oracle or MySQL Choose jdbc jar file in bin of Mysql installation or Mysql connector folder Database ur :jdbc:mysql://localhost:3306/ username:root password:***** click test connection and save Now click on top the connection and click connect Now You can view your table values from dbbrowser itself. Any queries type your question on "Questions" page |