JDCConnectionDriver.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. namespace System.Data.Common
  2. {
  3. using java.sql;
  4. using java.util;
  5. class JDCConnectionDriver : Driver
  6. {
  7. public static readonly String URL_PREFIX = "jdbc:jdc:";
  8. private static readonly int MAJOR_VERSION = 1;
  9. private static readonly int MINOR_VERSION = 0;
  10. private JDCConnectionPool pool;
  11. public JDCConnectionDriver(String driver, String url,
  12. String user, String password)
  13. //throws ClassNotFoundException,
  14. // InstantiationException, IllegalAccessException,
  15. //SQLException
  16. {
  17. DriverManager.registerDriver(this);
  18. java.lang.Class.forName(driver).newInstance();
  19. pool = new JDCConnectionPool(url, user, password);
  20. }
  21. public Connection connect(String url, Properties props)
  22. // throws SQLException
  23. {
  24. if(!url.StartsWith(URL_PREFIX))
  25. {
  26. return null;
  27. }
  28. return pool.getConnection();
  29. }
  30. public bool acceptsURL(String url)
  31. {
  32. return url.StartsWith(URL_PREFIX);
  33. }
  34. public int getMajorVersion()
  35. {
  36. return MAJOR_VERSION;
  37. }
  38. public int getMinorVersion()
  39. {
  40. return MINOR_VERSION;
  41. }
  42. public DriverPropertyInfo[] getPropertyInfo(String str, Properties props)
  43. {
  44. return new DriverPropertyInfo[0];
  45. }
  46. public bool jdbcCompliant()
  47. {
  48. return false;
  49. }
  50. }
  51. }