Mysql-please help me ..... Thank you !!!!!!

Source: Internet
Author: User
& Quot; packageedu. jju. jdbc. example. dao; importcom. mchange. v2.c3p0. comboPooledDataSource; importjava. SQL. SQLException; importjava. util. map; importjavax. SQL. dataSource; importorg. apache. commons. dbutils. queryRunner; importorg. apache. commons. dbut... mysqljdbc

Package edu. jju. jdbc. example. dao; import com. mchange. v2.c3p0. comboPooledDataSource; import java. SQL. SQLException; import java. util. map; import javax. SQL. dataSource; import org. apache. commons. dbutils. queryRunner; import org. apache. commons. dbutils. handlers. keyedHandler;/***** @ author Administrator */public class ResultSetTest09 {public static DataSource ds = null; // initialize the C3P0 data source static {ComboPooledDataSource cpds = new ComboPooledDataSource (); ds = cpd;} public static void testKeyedHandler () throws SQLException {String SQL = "select id, name, password from user"; QueryRunner qr = new QueryRunner (ds); Map
   
    
> Map = qr. query (SQL, new KeyedHandler
    ("Id"); Map umap = (Map) map. get (new Integer (1); String uname = (String) umap. get ("name"); String upassword = (String) umap. get ("password"); System. out. println (uname + ":" + upassword);} public static void main (String [] args) throws SQLException {testKeyedHandler ();}}

// Some JAR packages I added

**
// My XML file **

// An error occurred while running .... After I finished the code, I followed the code in the book for a long time. it was the same, but the running results were annoying... My book is The Book of Chuanzhi podcast

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.