Statement stat=DB.getConnection().createStatement();这个createStatement()是什么方法?怎么用?

解决方案 »

  1.   

    简单点  Statement stm = con.createStatement();看方法名字 猜也猜到了。。 create(建立)    statement
      

  2.   

    createStatement
    Statement createStatement()
                              throws SQLExceptionCreates a Statement object for sending SQL statements to the database. SQL statements without parameters are normally executed using Statement objects. If the same SQL statement is executed many times, it may be more efficient to use a PreparedStatement object. 
    Result sets created using the returned Statement object will by default be type TYPE_FORWARD_ONLY and have a concurrency level of CONCUR_READ_ONLY. The holdability of the created result sets can be determined by calling getHoldability(). 
    Returns:
    a new default Statement object 
    Throws: 
    SQLException - if a database access error occurs or this method is called on a closed connection
    javase文档。。
      

  3.   

    你这全是英文看起来好别扭呀,不过你真的想仔细的弄清的话确实得看看API
    文档,当你创建了一个Connection链接后,得通过这个链接来创建createStatement对象