/* * Created on Jul 29, 2004 * @authore Ed Soniat * @version $Revision: $ * version author $Author: $ * Tag $Name: $ * */ package com.nsaglobal.analytics; import java.sql.Driver; import java.sql.DriverPropertyInfo; import java.sql.SQLException; import java.util.Properties; /** * * * PrintDriverInfo Using the static main with a jdbc url as * the first (and only) argument get a driver for the argument as the url. * * @author esoniat * @version $Revision: $ $Date: $ * @version author $Author: $ * Tag $Name $ * * */ public class PrintDriverInfo { /** * Instantiate a Connector/J driver and print its info * for a hard coded url * @param args ignored */ public static void main(String[] args) { try { final String url = args[0]; if ( (url == null) || ( url.length() <= 0 )) { System.out.println("Must provide a jdbc url as first argument"); System.exit(1); } System.out.println("Howdy!"); System.out.println("url:"+url); Driver driver = (Driver)Class.forName("com.mysql.jdbc.Driver") .newInstance(); System.out.println("MajorVersion :"+driver.getMajorVersion()); System.out.println("MinorVersion :"+driver.getMinorVersion()); System.out.println("JDPC Compliant:"+driver.jdbcCompliant()); DriverPropertyInfo info[] = driver.getPropertyInfo(url,new Properties()); for ( int i=0; i < info.length;i++) { System.out.println("description:"+info[i].description); System.out.println("name: "+info[i].name); String choices[] = info[i].choices; if (choices != null) for (int j=0; j < choices.length;j++) System.out.println("choice: "+choices[j]); } } catch (InstantiationException e) { System.out.println(e); } catch (ClassNotFoundException e) { System.out.println(e); } catch (IllegalAccessException e) { System.out.println(e); } catch(SQLException e) { System.out.println(e); } } }