public class ConnectionInfo
extends java.lang.Object
implements java.lang.Cloneable
| Constructor and Description |
|---|
ConnectionInfo(java.lang.String name)
Create a connection info object.
|
ConnectionInfo(java.lang.String u,
java.util.Properties info,
java.lang.String user,
java.lang.Object password)
Create a connection info object.
|
| Modifier and Type | Method and Description |
|---|---|
void |
cleanAuthenticationInfo()
Clear authentication properties.
|
ConnectionInfo |
clone() |
DbSettings |
getDbSettings() |
byte[] |
getFilePasswordHash()
Get the file password hash if it is set.
|
java.lang.String |
getName()
Get the unique and normalized database name (excluding settings).
|
org.h2.util.NetworkConnectionInfo |
getNetworkConnectionInfo()
Returns the network connection information, or
null. |
java.lang.String |
getOriginalURL()
Get the complete original database URL.
|
boolean |
getProperty(java.lang.String key,
boolean defaultValue)
Get a boolean property if it is set and return the value.
|
java.lang.String |
getProperty(java.lang.String key,
java.lang.String defaultValue)
Get the value of the given property.
|
org.h2.util.TimeZoneProvider |
getTimeZone()
Returns the time zone.
|
java.lang.String |
getURL()
Get the database URL.
|
java.lang.String |
getUserName()
Get the name of the user.
|
static boolean |
isIgnoredByParser(java.lang.String name)
Returns whether setting with the specified name should be ignored by
parser.
|
boolean |
isPersistent()
Check if the referenced database is persistent.
|
boolean |
isRemote()
Check if this is a remote connection.
|
boolean |
removeProperty(java.lang.String key,
boolean defaultValue)
Remove a boolean property if it is set and return the value.
|
void |
setBaseDir(java.lang.String dir)
Set the base directory of persistent databases, unless the database is in
the user home folder (~).
|
void |
setFileEncryptionKey(byte[] key) |
void |
setFilePasswordHash(byte[] hash)
Set the file password hash.
|
void |
setNetworkConnectionInfo(org.h2.util.NetworkConnectionInfo networkConnectionInfo)
Sets the network connection information.
|
void |
setOriginalURL(java.lang.String url)
Set the original database URL.
|
void |
setProperty(java.lang.String key,
java.lang.String value)
Overwrite a property.
|
void |
setServerKey(java.lang.String serverKey)
Switch to server mode, and set the server name and database key.
|
void |
setUserName(java.lang.String name)
Overwrite the user name.
|
void |
setUserPasswordHash(byte[] hash)
Set the user password hash.
|
public ConnectionInfo(java.lang.String name)
name - the database name (including tags), but without the
"jdbc:h2:" prefixpublic ConnectionInfo(java.lang.String u,
java.util.Properties info,
java.lang.String user,
java.lang.Object password)
u - the database URL (must start with jdbc:h2:)info - the connection properties or nulluser - the user name or nullpassword - the password as String or char[], or
nullpublic static boolean isIgnoredByParser(java.lang.String name)
name - the name of the settingpublic ConnectionInfo clone() throws java.lang.CloneNotSupportedException
clone in class java.lang.Objectjava.lang.CloneNotSupportedExceptionpublic void setBaseDir(java.lang.String dir)
dir - the new base directorypublic boolean isRemote()
public boolean isPersistent()
public boolean getProperty(java.lang.String key,
boolean defaultValue)
key - the property namedefaultValue - the default valuepublic boolean removeProperty(java.lang.String key,
boolean defaultValue)
key - the property namedefaultValue - the default valuepublic java.lang.String getName()
public byte[] getFilePasswordHash()
public java.lang.String getUserName()
public java.lang.String getProperty(java.lang.String key,
java.lang.String defaultValue)
key - the property keydefaultValue - the default valuepublic void setUserName(java.lang.String name)
name - the user namepublic void setUserPasswordHash(byte[] hash)
hash - the new hash valuepublic void setFilePasswordHash(byte[] hash)
hash - the new hash valuepublic void setFileEncryptionKey(byte[] key)
public void setProperty(java.lang.String key,
java.lang.String value)
key - the property namevalue - the valuepublic java.lang.String getURL()
public java.lang.String getOriginalURL()
public void setOriginalURL(java.lang.String url)
url - the database urlpublic org.h2.util.TimeZoneProvider getTimeZone()
public void setServerKey(java.lang.String serverKey)
serverKey - the server name, '/', and the security keypublic org.h2.util.NetworkConnectionInfo getNetworkConnectionInfo()
null.nullpublic void setNetworkConnectionInfo(org.h2.util.NetworkConnectionInfo networkConnectionInfo)
networkConnectionInfo - the network connection informationpublic DbSettings getDbSettings()
public void cleanAuthenticationInfo()