/projects/derby-10.9.1.0/db-derby-10.9.1.0-src/java/stubs/jdbc3/java/sql/Driver.java

https://gitlab.com/essere.lab.public/qualitas.class-corpus · Java · 113 lines · 11 code · 10 blank · 92 comment · 0 complexity · 89b215a2b1458fc63da36bc4667f11dc MD5 · raw file

  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one or more
  3. * contributor license agreements. See the NOTICE file distributed with
  4. * this work for additional information regarding copyright ownership.
  5. * The ASF licenses this file to You under the Apache License, Version 2.0
  6. * (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. package java.sql;
  18. import java.util.Properties;
  19. /**
  20. * An Interface to a JDBC Driver.
  21. * <p>
  22. * The JDBC Driver uses URLs to specify the location of specific data. URL
  23. * format typically takes the form "xxxx:yyyy:SpecificData", where "xxxx:yyyy"
  24. * is termed the subprotocol and is normally the same for all uses of a
  25. * particular driver. "SpecificData" is a string which identifies the particular
  26. * data source that the driver should use.
  27. *
  28. */
  29. public interface Driver {
  30. /**
  31. * Returns whether the driver thinks that it can open a connection to the
  32. * given URL.
  33. *
  34. * @param url
  35. * the URL to connect to.
  36. * @return true if the driver thinks that is can open a connection to the
  37. * supplied URL, false otherwise. Typically, the driver will respond
  38. * true if it thinks that it can handle the subprotocol specified by
  39. * the driver.
  40. * @throws SQLException
  41. */
  42. public boolean acceptsURL(String url) throws SQLException;
  43. /**
  44. * Attempts to make a database connection to a datasource specified by a
  45. * supplied URL.
  46. *
  47. * @param url
  48. * the url to connect.
  49. * @param info
  50. * some properties that should be used in establishing the
  51. * connection. The properties consist of name/value pairs of
  52. * Strings. Normally, a connection to a database requires at
  53. * least two properties - for "user" and "password" in order to
  54. * pass authentication to the database.
  55. * @return a Connection object representing the connection to the database.
  56. * @throws SQLException
  57. * if a database error occurs
  58. */
  59. public Connection connect(String url, Properties info) throws SQLException;
  60. /**
  61. * Gets the driver's major version number.
  62. *
  63. * @return the major version number of the Driver - typically starts at 1.
  64. */
  65. public int getMajorVersion();
  66. /**
  67. * Gets the driver's minor version number.
  68. *
  69. * @return the minor version number of the Driver - typically starts at 0.
  70. */
  71. public int getMinorVersion();
  72. /**
  73. * Gets information about possible properties for this driver.
  74. * <p>
  75. * This method is intended to provide a listing of possible properties that
  76. * the user of the driver may need to supply in order to correct connect to
  77. * a database. Note that the returned array of Properties may change
  78. * depending on the supplied list of property values.
  79. *
  80. * @param url
  81. * the url of the database. A using program may call this method
  82. * iteratively as the property list is built up - for example,
  83. * when displaying a dialog to an end-user as part of the
  84. * database login process.
  85. * @param info
  86. * @return an array of DriverPropertyInfo records which provide detail on
  87. * each property that the driver will accept.
  88. * @throws SQLException
  89. */
  90. public DriverPropertyInfo[] getPropertyInfo(String url, Properties info)
  91. throws SQLException;
  92. /**
  93. * Reports whether this driver is a genuine JDBC CompliantTM driver. The
  94. * driver may only return true from this method if it passes all the JDBC
  95. * Compliance tests.
  96. * <p>
  97. * A driver may not be fully compliant if the underlying database has
  98. * limited functionality.
  99. *
  100. * @return true if the driver is fully JDBC compliant, false otherwise.
  101. */
  102. public boolean jdbcCompliant();
  103. }