Package virtuoso.jdbc4

## Class Driver

- java.lang.Object
- - virtuoso.jdbc4.Driver

All Implemented Interfaces:
  `java.sql.Driver`

    public class Driver
    extends java.lang.Object
    implements java.sql.Driver

The Virtuoso DBMS Driver class is an implementation of the Driver interface in the JDBC API. It can be loaded in an application by :

       Class.forName("virtuoso.jdbc4.Driver")

, or statically with the -Djdbc.drivers=virtuoso.jdbc4.Driver on the java interpreter command line, or in the java properties files with an entry like before. Hints :

- You can see the version of the current Virtuoso DBMS JDBC driver accessible in the CLASSPATH with the java virtuoso.jdbc4.Driver

See Also:
  `Driver`, `DriverManager`, `VirtuosoConnection`

### Field Summary

Fields
`protected static int` `major`
`protected static int` `minor`

### Constructor Summary

Constructors
`Driver​()` Constructs a Virtuoso DBMS Driver instance.

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`boolean` `acceptsURL​(java.lang.String url)` Returns true if the driver thinks that it can open a connection to the given URL.
`java.sql.Connection` `connect​(java.lang.String url, java.util.Properties info)` Attempts to make a database connection to the given URL.
`int` `getMajorVersion​()` Gets the driver's major version number.
`int` `getMinorVersion​()` Gets the driver's minor version number.
`java.util.logging.Logger` `getParentLogger​()` Return the parent Logger of all the Loggers used by this driver.
`java.sql.DriverPropertyInfo[]` `getPropertyInfo​(java.lang.String url, java.util.Properties info)` Gets information about the possible properties for this driver.
`boolean` `jdbcCompliant​()` Reports whether this driver is a genuine JDBC COMPLIANT driver.
`static void` `main​(java.lang.String[] args)`
`protected java.util.Properties` `urlToInfo​(java.lang.String url, java.util.Properties _info)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### major

    protected static final int major

See Also:
  Constant Field Values

#### minor

    protected static final int minor

See Also:
  Constant Field Values

### Constructor Detail

#### Driver

    public Driver​()
           throws java.sql.SQLException

Constructs a Virtuoso DBMS Driver instance. This function has not to be called directly, this function is called only during the DriverManager registration done with :

       Class.forName("virtuoso.jdbc4.Driver")

Throws:
  `java.sql.SQLException` - an error occurred in registering

### Method Detail

#### connect

    public java.sql.Connection connect​(java.lang.String url,
                                       java.util.Properties info)
                                throws VirtuosoException

Attempts to make a database connection to the given URL. The driver returns "null" if the URL given is not a Virtuoso DBMS JDBC URL. A URL under the Virtuoso DBMS JDBC driver should be :

       jdbc:virtuoso://host:port , or
       jdbc:virtuoso://host:port/UID=username/PWD=userpassword

This function is only called through the DriverManager.getConnection function.

Specified by:
  `connect` in interface `java.sql.Driver`
Parameters:
  `url` - the URL of the database to which to connect
  `info` - a list of arbitrary string tag/value pairs as connection arguments. Normally at least a "user" and "password" property should be included.
Returns:
  a `Connection` object that represents a connection to the URL
Throws:
  `VirtuosoException` - it is the right driver to connect to the given URL, but has trouble connecting to the database.
See Also:
  `Driver.connect(java.lang.String, java.util.Properties)`

#### acceptsURL

    public boolean acceptsURL​(java.lang.String url)
                       throws VirtuosoException

Returns true if the driver thinks that it can open a connection to the given URL. Typically drivers will return true if they understand the subprotocol specified in the URL and false if they do not.

Specified by:
  `acceptsURL` in interface `java.sql.Driver`
Parameters:
  `url` - the URL of the database
Returns:
  true if this driver can connect to the given URL
Throws:
  `VirtuosoException` - An internal error occurred.
See Also:
  `Driver.acceptsURL(java.lang.String)`

#### urlToInfo

    protected java.util.Properties urlToInfo​(java.lang.String url,
                                             java.util.Properties _info)

#### getPropertyInfo

    public java.sql.DriverPropertyInfo[] getPropertyInfo​(java.lang.String url,
                                                         java.util.Properties info)
                                                  throws VirtuosoException

Gets information about the possible properties for this driver.

The getPropertyInfo method is intended to allow a generic GUI tool to discover what properties it should prompt a human for in order to get enough information to connect to a database. Note that depending on the values the human has supplied so far, additional values may become necessary, so it may be necessary to iterate though several calls to getPropertyInfo.

Specified by:
  `getPropertyInfo` in interface `java.sql.Driver`
Parameters:
  `url` - the URL of the database to which to connect
  `info` - a proposed list of tag/value pairs that will be sent on connect open
Returns:
  an array of DriverPropertyInfo objects describing possible properties. This array may be an empty array if no properties are required.
Throws:
  `VirtuosoException` - An internal error occurred.
See Also:
  `Driver.getPropertyInfo(java.lang.String, java.util.Properties)`

#### getMajorVersion

    public int getMajorVersion​()

Gets the driver's major version number.

Specified by:
  `getMajorVersion` in interface `java.sql.Driver`
Returns:
  this driver's major version number

#### getMinorVersion

    public int getMinorVersion​()

Gets the driver's minor version number.

Specified by:
  `getMinorVersion` in interface `java.sql.Driver`
Returns:
  this driver's minor version number

#### jdbcCompliant

    public boolean jdbcCompliant​()

Reports whether this driver is a genuine JDBC COMPLIANT driver.

Specified by:
  `jdbcCompliant` in interface `java.sql.Driver`
Returns:
  true if the JDBC Driver is compliant, false otherwise ... but our Virtuoso DBMS JDBC driver is compliant, so true is always returned.

#### main

    public static void main​(java.lang.String[] args)

#### getParentLogger

    public java.util.logging.Logger getParentLogger​()
                                             throws java.sql.SQLFeatureNotSupportedException

Return the parent Logger of all the Loggers used by this driver. This should be the Logger farthest from the root Logger that is still an ancestor of all of the Loggers used by this driver. Configuring this Logger will affect all of the log messages generated by the driver. In the worst case, this may be the root Logger.

Specified by:
  `getParentLogger` in interface `java.sql.Driver`
Returns:
  the parent Logger for this driver
Throws:
  `java.sql.SQLFeatureNotSupportedException` - if the driver does not use `java.util.logging`.
Since:
  1.7