DriverPropertyInfo: value : DriverPropertyInfo « java.sql « Java by API






DriverPropertyInfo: value

 

import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.DriverPropertyInfo;

public class Main {
  public static void main(String[] argv) throws Exception {
    String driverName = "org.gjt.mm.mysql.Driver";
    Class.forName(driverName);

    String url = "jdbc:mysql://a/b";
    Driver driver = DriverManager.getDriver(url);

    DriverPropertyInfo[] info = driver.getPropertyInfo(url, null);
    for (int i = 0; i < info.length; i++) {
      String name = info[i].name;
      boolean isRequired = info[i].required;
      String value = info[i].value;
      String desc = info[i].description;
      String[] choices = info[i].choices;
    }
  }
}

   
  








Related examples in the same category

1.DriverPropertyInfo.choices
2.DriverPropertyInfo.description
3.DriverPropertyInfo.name
4.DriverPropertyInfo.required