JDBC_DriverManager

来源:互联网 发布:伟嘉猫粮怎么样 知乎 编辑:程序博客网 时间:2024/06/16 03:56
1.DriverManager :

Its use for Connec to Database by method getConnection();

Example : Connection connection = DriverManager.getConnection(url,iuser,password);

Methods :  

@deregisterDriver(Driver driver);  //  its use for Delete the JDBCDriver.

Example :  Class.forName(com.mysql.jdbc.Driver);

                    String url = "jdbc:mysql://localhost:3306/Database";

                    Driver driver = DriverManager.getDriver(url);

                    DriverManager.deregisterDriver(driver);



@getDrivers();    // its use for print name of the jdbc.  ]

Examle  :    Enumation em  =  Driver.getDrivers();

                    while(em.hasMoreElement()){

                    Driver d = em.nextElement();

                    System.out.println(getClass().getName());       

 }



@getLoginTimeOut();  //  its use for time out

System.out.println(getLoginTimeOut());



@getLogWriter();    //  print some message

PrintWriter out   = null;

out = DriverManager.getLogWriter();

if(out != null){
    System.out.println(message);

    out.close();

}



Note : There are some methods in @DriverManager , if you familiar with these and you can say I know jdbc for 20% Good luck all fo you .

Iparhan_Java  



1 0
原创粉丝点击