JDBC简介

JDBC简介

  • SUN公司为了简化、统一对数据库的操作,定义了一套Java操作数据库的规范,称之为JDBC。JDBC就是就是使用java代码(程序)发送sql语句的技术 !

  • JDBC全称为:Java Data Base Connectivity(java数据库连接), 它主要由接口组成。

  • 组成JDBC的2个包 : java.sql , javax.sql, 以上2个包已经包含在J2SE中,所以不用导入,开发这只需要导入JDBC的实现类即数据库驱动包。开发JDBC应用需要以上2个包的支持外,还需要导入相应JDBC的数据库实现(即数据库驱动)

  • 没有JDBC之前操作数据 :
    1)通过mysql的客户端工具,登录数据库服务器 (mysql -u root -p 密码)
    2)编写sql语句
    3)发送sql语句到数据库服务器执行

  • 使用JDBC发送sql前提:

    1. 登录数据库服务器(连接数据库服务器)
    2. 数据库的IP地址
    3. 端口
    4. 数据库用户名
    5. 密码

JDBC的使用

  • 第一个JDBC程序 : 编写一个程序,这个程序从user表中读取数据,并打印在命令行窗口中:
    1. 搭建实验环境 :
    • mysql中创建一个库,并创建user表和插入表的数据。
    • 新建一个Java工程,并导入数据驱动。
    1. 编写程序,在程序中加载数据库驱动 : DriverManager. registerDriver(Driver driver)
    2. 建立连接(Connection) : Connection conn = DriverManager.getConnection(url, user, pass);
    3. 创建用于向数据库发送SQL的Statement对象 : Statement st = conn.createStatement();
    4. 发送sql语句 : ResultSet rs = st.excuteQuery(sql);
    5. 从代表结果集的ResultSet中取出数据,打印到命令行窗口
    6. 断开与数据库的连接,并释放相关资源
//连接数据库的URL
  private  String url = "jdbc:mysql://localhost:3306/User";
                     // jdbc协议:数据库子协议:主机:端口/连接的数据库   //

  private  String user = "root";//用户名
  private  String password = "root";//密码
 
 /**
  * 第一种方法
  *   @throws   Exception
  */
 @Test
  public  void  test1()  throws  Exception{
  //1.创建驱动程序类对象
  Driver driver =  new  com.mysql.jdbc.Driver(); //新版本
  //Driver driver = new org.gjt.mm.mysql.Driver(); //旧版本
  
  //设置用户名和密码
  Properties props =  new  Properties();
  props.setProperty("user", user);
  props.setProperty("password", password);
  
  //2.连接数据库,返回连接对象
  Connection conn = driver.connect(url, props);
  System.out.println(conn);
 }

JDBC接口核心的API : java.sql.*javax.sql.*

  • DriverManager : 表示java驱动程序接口。所有的具体的数据库厂商要来实现此接口

    • Jdbc程序中的DriverManager用于加载驱动,并创建与数据库的链接,这个API的常用方法 :
      1. DriverManager.registerDriver(new Driver())
      2. DriverManager.getConnection(url, user, password)
      • url语法 : jdbc协议:数据库子协议://主机:端口/数据库;
      • user : 数据库的用户名 ;
      • password : 数据库用户密码
      • 常用数据库URL地址的写法:
        1. Oracle:jdbc:oracle:thin:@localhost:1521:sid
        2. SqlServer : jdbc:microsoft:sqlserver://localhost:1433; DatabaseName=sid
        3. MySql : jdbc:mysql://localhost:3306/sid
    • 注意:在实际开发中并不推荐采用registerDriver方法注册驱动。原因有二:
      1. 查看Driver的源代码可以看到,如果采用此种方式,会导致驱动程序注册两次,也就是在内存中会有两个Driver对象。
      2. 程序依赖mysql的api,脱离mysql的jar包,程序将无法编译,将来程序切换底层数据库将会非常麻烦
    • 推荐方式 : Class.forName(“com.mysql.jdbc.Driver”); 采用此种方式不会导致驱动对象在内存中重复出现,并且采用此种方式,程序仅仅只需要一个字符串,不需要依赖具体的驱动,使程序的灵活性更高。同样,在开发中也不建议采用具体的驱动类型指向getConnection方法返回的connection对象
  • Connection接口 : 表示java程序和数据库的连接对象

    • Jdbc程序中的Connection,它用于代表数据库的链接,Collection是数据库编程中最重要的一个对象,客户端与数据库所有交互都是通过connection对象完成的,这个对象的常用方法:
      1. createStatement() : 创建向数据库发送sql的statement对象
      2. prepareStatement(sql) : 创建向数据库发送预编译sql的PrepareSatement对象
      3. prepareCall(sql) : 创建执行存储过程的CallableStatement对象
      4. setAutoCommit(boolean autoCommit) : 设置事务是否自动提交
      5. commit() : 在链接上提交事务
      6. rollback() : 在此链接上回滚事务
  • Statement接口 : 用于执行静态的sql语句

    • Jdbc程序中的Statement对象用于向数据库发送SQL语句, Statement对象常用方法:
      1. executeQuery(String sql) :用于向数据发送查询语句。
      2. executeUpdate(String sql):用于向数据库发送insert、update或delete语句
      3. execute(String sql):用于向数据库发送任意sql语句
      4. addBatch(String sql) :把多条sql语句放到一个批处理中。
      5. executeBatch():向数据库发送一批sql语句执行。
  • PreparedStatement接口 : 用于执行预编译sql语句

    • PreperedStatement 是 Statement 的孩子, PreperedStatement的实例对象可以通过调用 Connection.preparedStatement()方法获得,相对于Statement对象而言:
      1. PreperedStatement 可以避免SQL注入的问题
      2. Statement会使数据库频繁编译SQL,可能造成数据库缓冲区溢出。
      3. PreparedStatement 可对SQL进行预编译,从而提高数据库的执行效率。
      4. 并且PreperedStatement对于sql中的参数,允许使用占位符的形式进行替换,简化sql语句的编写
  • ResultSet接口 : 用于封装查询出来的数据

    • Jdbc程序中的ResultSet用于代表SQL语句的执行结果。Resultset封装执行结果时,采用的类似于表格的方式。ResultSet 对象维护了一个指向表格数据行的游标,初始的时候,游标在第一行之前,调用ResultSet.next() 方法,可以使游标指向具体的数据行,进行调用方法获取该行的数据。
    • ResultSet既然用于封装执行结果的,所以该对象提供的都是用于获取数据的get方法:
      • 获取任意类型的数据 : getObject(int index), getObject(string columnName)
      • 获取指定类型的数据 : getString(int index), getString(String columnName)
    • 如果数据库中列的类型是varchar,获取该列的数据调用什么方法?Int类型呢?bigInt类型呢?Boolean类型?
    • 注意:列的索引从1开始。
    • ResultSet还提供了对结果集进行滚动的方法:
      1. next():移动到下一行
      2. previous():移动到前一行
      3. absolute(int row):移动到指定行
      4. beforeFirst():移动resultSet的最前面
      5. afterLast() :移动到resultSet的最后面
  • 释放资源

    • Jdbc程序运行完后,切记要释放程序在运行过程中,创建的那些与数据库进行交互的对象,这些对象通常是ResultSet, Statement和Connection对象
    • 特别是Connection对象,它是非常稀有的资源,用完后必须马上释放,如果Connection不能及时、正确的关闭,极易导致系统宕机。Connection的使用原则是尽量晚创建,尽量早的释放。(使用原则:尽量晚的创建,尽量早的释放)
    • 为确保资源释放代码能运行,资源释放代码也一定要放在finally语句中
  • 使用JDBC对数据库进行CRUD

    • Jdbc中的statement对象用于向数据库发送SQL语句,想完成对数据库的增删改查,只需要通过这个对象向数据库发送增删改查语句即可
  • Statement对象的executeUpdate方法,用于向数据库发送增、删、改的sql语句,executeUpdate执行完后,将会返回一个整数(即增删改语句导致了数据库几行数据发生了变化)

    • Statement.executeQuery方法用于向数据库发送查询语句,executeQuery方法返回代表查询结果的ResultSet对象

使用Statement执行sql语句(具体使用方法)

  1. 执行DDL语句
/**
  * 执行DDL语句(创建表)
  */
 @Test
 public void test1(){
  Statement stmt = null;
  Connection conn = null;
  try {
   //1.驱动注册程序
   Class.*forName*("com.mysql.jdbc.Driver");
   
   //2.获取连接对象
   conn = DriverManager.*getConnection*(url, user, password);
   
   //3.创建Statement
   stmt = conn.createStatement();
   
   //4.准备sql
   String sql = "CREATE TABLE student(id INT PRIMARY KEY AUTO_INCREMENT,NAME VARCHAR(20),gender VARCHAR(2))";
   
   //5.发送sql语句,执行sql语句,得到返回结果
   int count = stmt.executeUpdate(sql);

   //6.输出
   System.out.println("影响了"+count+"行!");
  } catch (Exception e) {
   e.printStackTrace();
   throw new RuntimeException(e);
  } finally{
   //7.关闭连接(顺序:后打开的先关闭)
   if(stmt!=null)
    try {
     stmt.close();
    } catch (SQLException e) {
     e.printStackTrace();
     throw new RuntimeException(e);
    }
   if(conn!=**null**)
    try {
     conn.close();
    } catch (SQLException e) {
     e.printStackTrace();
     throw new RuntimeException(e);
    }
  }
 }
  1. 执行DML语句
/**
 * 使用Statement执行DML语句
 * @author APPle
 *
 */
public class Demo2 {
    private String url = "jdbc:mysql://localhost:3306/day17";
    private String user = "root";
    private String password = "root";

    /**
     * 增加
     */
    @Test
    public void testInsert(){
        Connection conn = null;
        Statement stmt = null;
        try {
            //通过工具类获取连接对象
            conn = JdbcUtil.getConnection();
            
            //3.创建Statement对象
            stmt = conn.createStatement();
            
            //4.sql语句
            String sql = "INSERT INTO student(NAME,gender) VALUES('李四','女')";
            
            //5.执行sql
            int count = stmt.executeUpdate(sql);
            
            System.out.println("影响了"+count+"行");
            
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException(e);
        } finally{
            //关闭资源
            /*if(stmt!=null)
                try {
                    stmt.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                    throw new RuntimeException(e);
                }
            if(conn!=null)
                try {
                    conn.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                    throw new RuntimeException(e);
                }*/
            JdbcUtil.close(conn, stmt);
        }
    }
    
    /**
     * 修改
     */
    @Test
    public void testUpdate(){
        Connection conn = null;
        Statement stmt = null;
        //模拟用户输入
        String name = "陈六";
        int id = 3;
        try {
            /*//1.注册驱动
            Class.forName("com.mysql.jdbc.Driver");
            
            //2.获取连接对象
            conn = DriverManager.getConnection(url, user, password);*/
            //通过工具类获取连接对象
            conn = JdbcUtil.getConnection();
            
            //3.创建Statement对象
            stmt = conn.createStatement();
            
            //4.sql语句
            String sql = "UPDATE student SET NAME='"+name+"' WHERE id="+id+"";
            
            System.out.println(sql);
            
            //5.执行sql
            int count = stmt.executeUpdate(sql);
            
            System.out.println("影响了"+count+"行");
            
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException(e);
        } finally{
            //关闭资源
            /*if(stmt!=null)
                try {
                    stmt.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                    throw new RuntimeException(e);
                }
            if(conn!=null)
                try {
                    conn.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                    throw new RuntimeException(e);
                }*/
            JdbcUtil.close(conn, stmt);
        }
    }
    
    /**
     * 删除
     */
    @Test
    public void testDelete(){
        Connection conn = null;
        Statement stmt = null;
        //模拟用户输入
        int id = 3;
        try {
            /*//1.注册驱动
            Class.forName("com.mysql.jdbc.Driver");
            
            //2.获取连接对象
            conn = DriverManager.getConnection(url, user, password);*/
            //通过工具类获取连接对象
            conn = JdbcUtil.getConnection();
            
            //3.创建Statement对象
            stmt = conn.createStatement();
            
            //4.sql语句
            String sql = "DELETE FROM student WHERE id="+id+"";
            
            System.out.println(sql);
            
            //5.执行sql
            int count = stmt.executeUpdate(sql);
            
            System.out.println("影响了"+count+"行");
            
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException(e);
        } finally{
            //关闭资源
            /*if(stmt!=null)
                try {
                    stmt.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                    throw new RuntimeException(e);
                }
            if(conn!=null)
                try {
                    conn.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                    throw new RuntimeException(e);
                }*/
            JdbcUtil.close(conn, stmt);
        }
    }
}
  1. 执行DQL语句
/**
 * 使用Statement执行DQL语句(查询操作)
 */
public class Demo {

 @Test
 public void test1(){
  Connection conn = null;
  Statement stmt = null;
  try{
   //获取连接
   conn = JdbcUtil.getConnection();
   //创建Statement
   stmt = conn.createStatement();
   //准备sql
   String sql = "SELECT * FROM student";
   //执行sql
   ResultSet rs = stmt.executeQuery(sql);
   
   //移动光标
   /*boolean flag = rs.next();
   
   flag = rs.next();
   flag = rs.next();
   if(flag){
    //取出列值
    //索引
    int id = rs.getInt(1);
    String name = rs.getString(2);
    String gender = rs.getString(3);
    System.out.println(id+","+name+","+gender);
    
    //列名称
    int id = rs.getInt("id");
    String name = rs.getString("name");
    String gender = rs.getString("gender");
    System.out.println(id+","+name+","+gender);
   }*/
   
   //遍历结果
   while(rs.next()){
    int id = rs.getInt("id");
    String name = rs.getString("name");
    String gender = rs.getString("gender");
    System.out.println(id+","+name+","+gender);
   }
  }catch(Exception e){
   e.printStackTrace();
   throw new RuntimeException(e);
  } finally {
   JdbcUtil.close(conn, stmt);
  }
 }
}
  1. 使用PreparedStatement执行sql语句
public class Demo1 {

   /**
    * 增加
    */
   @Test
   public void testInsert() {
       Connection conn = null;
       PreparedStatement stmt = null;
       try {
           //1.获取连接
           conn = JdbcUtil.getConnection();
           
           //2.准备预编译的sql
           String sql = "INSERT INTO student(NAME,gender) VALUES(?,?)"; //?表示一个参数的占位符
           
           //3.执行预编译sql语句(检查语法)
           stmt = conn.prepareStatement(sql);
           
           //4.设置参数值
           /**
            * 参数一: 参数位置  从1开始
            */
           stmt.setString(1, "李四");
           stmt.setString(2, "男");
           
           //5.发送参数,执行sql
           int count = stmt.executeUpdate();
           
           System.out.println("影响了"+count+"行");
           
       } catch (Exception e) {
           e.printStackTrace();
           throw new RuntimeException(e);
       } finally {
           JdbcUtil.close(conn, stmt);
       }
   }
   
   /**
    * 修改
    */
   @Test
   public void testUpdate() {
       Connection conn = null;
       PreparedStatement stmt = null;
       try {
           //1.获取连接
           conn = JdbcUtil.getConnection();
           
           //2.准备预编译的sql
           String sql = "UPDATE student SET NAME=? WHERE id=?"; //?表示一个参数的占位符
           
           //3.执行预编译sql语句(检查语法)
           stmt = conn.prepareStatement(sql);
           
           //4.设置参数值
           /**
            * 参数一: 参数位置  从1开始
            */
           stmt.setString(1, "王五");
           stmt.setInt(2, 9);
           
           //5.发送参数,执行sql
           int count = stmt.executeUpdate();
           
           System.out.println("影响了"+count+"行");
           
       } catch (Exception e) {
           e.printStackTrace();
           throw new RuntimeException(e);
       } finally {
           JdbcUtil.close(conn, stmt);
       }
   }
   
   /**
    * 删除
    */
   @Test
   public void testDelete() {
       Connection conn = null;
       PreparedStatement stmt = null;
       try {
           //1.获取连接
           conn = JdbcUtil.getConnection();
           
           //2.准备预编译的sql
           String sql = "DELETE FROM student WHERE id=?"; //?表示一个参数的占位符
           
           //3.执行预编译sql语句(检查语法)
           stmt = conn.prepareStatement(sql);
           
           //4.设置参数值
           /**
            * 参数一: 参数位置  从1开始
            */
           stmt.setInt(1, 9);
           
           //5.发送参数,执行sql
           int count = stmt.executeUpdate();
           
           System.out.println("影响了"+count+"行");
           
       } catch (Exception e) {
           e.printStackTrace();
           throw new RuntimeException(e);
       } finally {
           JdbcUtil.close(conn, stmt);
       }
   }
   
   /**
    * 查询
    */
   @Test
   public void testQuery() {
       Connection conn = null;
       PreparedStatement stmt = null;
       ResultSet rs = null;
       try {
           //1.获取连接
           conn = JdbcUtil.getConnection();
           
           //2.准备预编译的sql
           String sql = "SELECT * FROM student"; 
           
           //3.预编译
           stmt = conn.prepareStatement(sql);
           
           //4.执行sql
           rs = stmt.executeQuery();
           
           //5.遍历rs
           while(rs.next()){
               int id = rs.getInt("id");
               String name = rs.getString("name");
               String gender = rs.getString("gender");
               System.out.println(id+","+name+","+gender);
           }
           
       } catch (Exception e) {
           e.printStackTrace();
           throw new RuntimeException(e);
       } finally {
           //关闭资源
           JdbcUtil.close(conn,stmt,rs);
       }
   }
}
  1. PreparedStatement 与 Statment ( 推荐使用PreparedStatement)

  2. 语法不同 : PreparedStatement可以使用预编译的sql,而Statment只能使用静态的sql

  3. 效率不同 : PreparedStatement可以使用sql缓存区,效率比Statment高

  4. 安全性不同 : PreparedStatement可以有效防止sql注入,而Statment不能防止sql注入

  5. CallableStatement执行存储过程

/**
 * 使用CablleStatement调用存储过程
 * @author APPle
 *
 */
public class Demo1 {

    /**
     * 调用带有输入参数的存储过程
     * CALL pro_findById(4);
     */
    @Test
    public void test1(){
        Connection conn = null;
        CallableStatement stmt = null;
        ResultSet rs = null;
        try {
            //获取连接
            conn = JdbcUtil.getConnection();
            
            //准备sql
            String sql = "CALL pro_findById(?)"; //可以执行预编译的sql
            
            //预编译
            stmt = conn.prepareCall(sql);
            
            //设置输入参数
            stmt.setInt(1, 6);
            
            //发送参数
            rs = stmt.executeQuery(); //注意: 所有调用存储过程的sql语句都是使用executeQuery方法执行!!!
            
            //遍历结果
            while(rs.next()){
                int id = rs.getInt("id");
                String name = rs.getString("name");
                String gender = rs.getString("gender");
                System.out.println(id+","+name+","+gender);
            }
            
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException(e);
        } finally {
            JdbcUtil.close(conn, stmt ,rs);
        }
    }
    
    /**
     * 执行带有输出参数的存储过程
     * CALL pro_findById2(5,@NAME);
     */
    @Test
    public void test2(){
        Connection conn = null;
        CallableStatement stmt = null;
        ResultSet rs = null;
        try {
            //获取连接
            conn = JdbcUtil.getConnection();
            //准备sql
            String sql = "CALL pro_findById2(?,?)"; //第一个?是输入参数,第二个?是输出参数
            
            //预编译
            stmt = conn.prepareCall(sql);
            
            //设置输入参数
            stmt.setInt(1, 6);
            //设置输出参数(注册输出参数)
            /**
             * 参数一: 参数位置
             * 参数二: 存储过程中的输出参数的jdbc类型    VARCHAR(20)
             */
            stmt.registerOutParameter(2, java.sql.Types.VARCHAR);
            
            //发送参数,执行
            stmt.executeQuery(); //结果不是返回到结果集中,而是返回到输出参数中
            
            //得到输出参数的值
            /**
             * 索引值: 预编译sql中的输出参数的位置
             */
            String result = stmt.getString(2); //getXX方法专门用于获取存储过程中的输出参数
            
            System.out.println(result);

        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException(e);
        } finally {
            JdbcUtil.close(conn, stmt ,rs);
        }
    }
}
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 157,012评论 4 359
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 66,589评论 1 290
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 106,819评论 0 237
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 43,652评论 0 202
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 51,954评论 3 285
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 40,381评论 1 210
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 31,687评论 2 310
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 30,404评论 0 194
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 34,082评论 1 238
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 30,355评论 2 241
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 31,880评论 1 255
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 28,249评论 2 250
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 32,864评论 3 232
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 26,007评论 0 8
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 26,760评论 0 192
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 35,394评论 2 269
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 35,281评论 2 259

推荐阅读更多精彩内容

  • 本人的环境为Myeclipse10、MySQL5.7.15 本文包括:简介JDBC编程步骤打通数据库程序详解—Dr...
    廖少少阅读 3,864评论 7 39
  • 1. Java基础部分 基础部分的顺序:基本语法,类相关的语法,内部类的语法,继承相关的语法,异常的语法,线程的语...
    子非鱼_t_阅读 31,292评论 18 399
  • 一. Java基础部分.................................................
    wy_sure阅读 3,729评论 0 11
  • 本节介绍Statement接口及其子类PreparedStatement和CallableStatement。 它...
    zlb阅读 1,058评论 0 0
  • 一年其实可以有390天? 一年不是360天吗?多出来的30天哪来的? 其实一年不但可以有390天...
    捡丹阅读 1,625评论 2 7