如题,还有最新版本的可视化MySQL是哪个,可以将具体的使用JDBC驱动Java连接MySQL的具体操作具体流程说一下

解决方案 »

  1.   

    可以将Java连接MySQL的代码贴出来吗
    Import java.sql.*;public class SampleIntro
    {
      public static void main(String[] args)
      {
        try
        {
          Connection conn;
          Statement stmt;
          ResultSet res;
          //加载Connector/J驱动
          //这一句也可写为:Class.forName("com.mysql.jdbc.Driver");
          Class.forName("com.mysql.jdbc.Driver").newInstance();
          //建立到MySQL的连接
          conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test",
                                             "root", "guapo");
          //执行SQL语句
          stmt = conn.createStatement();
          res = stmt.executeQuery("select * from pet");
          //处理结果集
          while (res.next())
          {
            String name = res.getString("name");
            System.out.println(name);
          }
          res.close();    }
        catch (Exception ex)
        {
          System.out.println("Error : " + ex.toString());
        }
      }
    }
      

  2.   


    没有可视化MySQL,MYSQL只是个数据库管理系统。没有人机界面。
    你需要的GUI管理工具可以到官网下载。
    http://dev.mysql.com/downloads/gui-tools/5.0.html
      

  3.   

    什么版本的JDBC支持MySQL5.1.41
    Connector/J 5.1
    http://dev.mysql.com/downloads/connector/j/5.1.html
      

  4.   


    http://dev.mysql.com/downloads/connector/j/5.1.html
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;Connection conn = null;
    ...
    try {
        conn = 
           DriverManager.getConnection("jdbc:mysql://localhost/test?" + 
                                       "user=monty&password=greatsqldb");    // Do something with the Connection   ...
    } catch (SQLException ex) {
        // handle any errors
        System.out.println("SQLException: " + ex.getMessage());
        System.out.println("SQLState: " + ex.getSQLState());
        System.out.println("VendorError: " + ex.getErrorCode());
    }
    官方手册中就有例子。21.4.3. Connector/J Examples
    Examples of using Connector/J are located throughout this document, this section provides a summary and links to these examples. Example 21.1, “Connector/J: Obtaining a connection from the DriverManager” Example 21.2, “Connector/J: Using java.sql.Statement to execute a SELECT query” Example 21.3, “Connector/J: Calling Stored Procedures” Example 21.4, “Connector/J: Using Connection.prepareCall()” Example 21.5, “Connector/J: Registering output parameters” Example 21.6, “Connector/J: Setting CallableStatement input parameters” Example 21.7, “Connector/J: Retrieving results and output parameter values” Example 21.8, “Connector/J: Retrieving AUTO_INCREMENT column values using Statement.getGeneratedKeys()” Example 21.9, “Connector/J: Retrieving AUTO_INCREMENT column values using SELECT LAST_INSERT_ID()” Example 21.10, “Connector/J: Retrieving AUTO_INCREMENT column values in Updatable ResultSets” Example 21.11, “Connector/J: Using a connection pool with a J2EE application server” Example 21.12, “Connector/J: Example of transaction with retry logic”