public final class Driver extends Object implements Driver
An application should not use this class directly. The application (if standalone)
should use DriverManager
only. For example:
Connection conn = DriverManager.getConnection("jdbc:simon:oracle:thin:...", "scott", "tiger");Simon driver has following format of JDBC connection string:
jdbc:simon:<real driver conn string>;<param1>=<value1>;...
Simon driver recognizes two parameters:
SIMON_REAL_DRV
- if you don't want or can't register real driver for any
reason, you can use this parameter and Simon proxy driver will do the registration
for you. You don't need to specify real driver parameter for some well known databases.
Simon proxy driver recognize database by first key word after JDBC and register.
SIMON_PREFIX
- setting this parameter you can choose different prefix
for all monitors for one instance of driver. For example, setting
SIMON_PREFIX=com.foo
will ensure that all proxy related Simons are located
under the subtree specified by the prefix, e.g. com.foo.conn
, com.foo.stmt
,
com.foo.select
, etc. If no prefix is set, default org.javasimon.jdbc
prefix
is used.
DriverManager
).
If this is not a case for any reason, you need to register Simon proxy driver at least.
For real driver Simon proxy driver contains following procedure for find and register it:
Class.forName("oracle.jdbc.driver.OracleDriver"); // loads real driver Class.forName("org.javasimon.jdbc4.Driver"); // loads Simon proxy driver Connection conn = DriverManager.getConnection( "jdbc:simon:oracle:thin:...", "scott", "tiger");
DriverManager.getConnection(String)
Constructor and Description |
---|
Driver()
Class constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
acceptsURL(String url) |
Connection |
connect(String simonUrl,
Properties info)
Opens new Simon proxy driver connection associated with real connection to the specified database.
|
int |
getMajorVersion() |
int |
getMinorVersion() |
Logger |
getParentLogger() |
DriverPropertyInfo[] |
getPropertyInfo(String s,
Properties properties) |
boolean |
jdbcCompliant() |
public Driver()
public Connection connect(String simonUrl, Properties info) throws SQLException
connect
in interface Driver
simonUrl
- JDBC connection string (i.e. jdbc:simon:h2:file:test)info
- properties for connectionSQLException
- if there is no real driver registered/recognized or opening real connection failsDriver
public boolean acceptsURL(String url) throws SQLException
acceptsURL
in interface Driver
SQLException
public DriverPropertyInfo[] getPropertyInfo(String s, Properties properties) throws SQLException
getPropertyInfo
in interface Driver
SQLException
public int getMajorVersion()
getMajorVersion
in interface Driver
public int getMinorVersion()
getMinorVersion
in interface Driver
public boolean jdbcCompliant()
jdbcCompliant
in interface Driver
public Logger getParentLogger() throws SQLFeatureNotSupportedException
getParentLogger
in interface Driver
SQLFeatureNotSupportedException
Copyright © 2019. All rights reserved.