|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.rocketsoftware.mvapi.AbstractConnection com.rocketsoftware.mvapi.MVConnection
public class MVConnection
Implements connection methods for an MV server.
Field Summary |
---|
Fields inherited from interface java.sql.Connection |
---|
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE |
Constructor Summary | |
---|---|
MVConnection()
Default constructor. |
|
MVConnection(java.lang.String host,
int port,
java.lang.String user,
java.lang.String pwd)
Constructs a connection object using a host name, port number, user and password. |
|
MVConnection(java.lang.String host,
int port,
java.lang.String user,
java.lang.String pwd,
boolean sslConnect,
boolean licEnterprise)
Constructs a connection object using a host name, port number, user and password. |
|
MVConnection(java.lang.String host,
int port,
java.lang.String user,
java.lang.String pwd,
java.lang.String account,
boolean sslConnect,
boolean licEnterprise)
Constructs a connection object using a host name, port number, user and password. |
|
MVConnection(java.lang.String host,
int port,
java.lang.String user,
java.lang.String pwd,
java.lang.String account,
boolean sslConnect,
MVConstants.LicenseType licenseType)
Constructs a connection object using a host name, port number, user and password. |
|
MVConnection(java.lang.String url,
java.util.Properties props)
Creates a connection object to the url with the provided properties. |
Method Summary | |
---|---|
java.lang.String |
call(java.lang.String name,
java.util.List<java.lang.String> arguments)
Calls a mvSub. |
java.lang.String |
call(java.lang.String name,
java.lang.String data)
Calls a mvSub. |
void |
clearSelect()
Clears an active select list. |
void |
close()
Releases this Connection object's database resources |
void |
closeConnection()
Closes the connection. |
boolean |
connect()
Connects to the server. |
int |
count(java.lang.String stringToSearch,
char charToCount)
Counts character occurances in another string. |
MVStatement |
createStatement()
Creates a Statement object for sending
AQL or TCL statements to the database. |
int |
dCount(java.lang.String dArray,
char delim)
This function returns how many elements of the type indicated by delim are contained in the given dynamic array. |
java.lang.String |
delete(java.lang.String dArray,
int attrNum)
Delete attribute from dynamic array |
java.lang.String |
delete(java.lang.String dArray,
int attrNum,
int valNum)
Deletes a value from the dynamic array. |
java.lang.String |
delete(java.lang.String dArray,
int attrNum,
int valNum,
int subValNum)
Deletes a sub value from a dynamic array. |
void |
execute(java.lang.String command)
Executes a command and populates the "capturing" and "returning" results. |
void |
execute(java.lang.String command,
java.lang.String data)
Executes a command and populates the "capturing" and "returning" results. |
MVResultSet |
executeQuery(java.lang.String query)
Queries the MV database. |
java.lang.String |
extract(java.lang.String dArray,
int attrNum)
Dynamic array reference |
java.lang.String |
extract(java.lang.String dArray,
int attrNum,
int valNum)
Dynamic array reference |
java.lang.String |
extract(java.lang.String dArray,
int attrNum,
int valNum,
int subValNum)
Dynamic array references |
java.lang.String |
field(java.lang.String dArray,
java.lang.String delim,
int pos)
Extracts a substring from the dynamic array. |
boolean |
fileCacheRelease(java.lang.String path)
Releases the associated file cache entry for the specified opened file on the MVSP server. |
java.lang.String |
fileDelete(java.lang.String path,
java.lang.String itemId)
Deletes an item from the file. |
java.lang.String |
fileRead(java.lang.String path,
java.lang.String itemId)
Reads an item from the file. |
java.lang.String |
fileReadNext()
Gets the next item ID from the current fileSELECT list. |
java.lang.String |
fileReadU(java.lang.String path,
java.lang.String itemId)
Reads an item from the file, setting an itemlock. |
java.lang.String |
fileReadV(java.lang.String path,
java.lang.String itemId,
int attribute)
Reads an item's attribute value from the file. |
java.lang.String |
fileReadVU(java.lang.String path,
java.lang.String itemId,
int attribute)
Reads an item's attribute value from the file, setting an item lock. |
java.lang.String |
fileRelease(java.lang.String path,
java.lang.String itemId)
Releases an item lock set by a prior fileReadU. |
boolean |
fileSelect(java.lang.String path)
Selects the file specified by path for a subsequent fileReadNext. |
java.lang.String |
fileWrite(java.lang.String path,
java.lang.String itemId,
java.lang.String itemBody)
Writes an item to the file, releasing the update lock set by a previous fileReadU of the same item. |
java.lang.String |
fileWriteU(java.lang.String path,
java.lang.String itemId,
java.lang.String itemBody)
Writes an item to the file, keeping update lock set by a previous fileReadU of the same item. |
java.lang.String |
fileWriteV(java.lang.String path,
java.lang.String itemId,
java.lang.String attributeValue,
int attribute)
Writes a value to an item's attribute. |
java.lang.String |
fileWriteVU(java.lang.String path,
java.lang.String itemId,
java.lang.String attributeValue,
int attribute)
Writes a value to an item's attribute, keeping update lock set by a previous fileReadU/fileReadVU of the same item. |
java.lang.String |
getConnectionProperties()
|
MVConnector |
getConnector()
Returns the connector object. |
java.lang.String |
getCurrentAccount()
Gets the current logged to account. |
java.lang.String |
getCurrentAccountPwd()
Gets the current logged to account password. |
boolean |
getEol()
Checks for end of list, i.e., will READNEXT fail. |
java.lang.String |
getExecuteCapturing()
Returns the captured result of an execute statement (execute command capturing result). |
java.lang.String |
getExecuteReturning()
Returns the returning result of an execute statement (execute command returning result). |
int |
getFileStatusCode()
|
java.lang.String |
getFileStatusMessage()
If getFileStatusCode returns non-zero, mvCall this to get a textual error message. |
java.lang.String |
getRuleModule()
Gets the rulename you had set via setRuleName |
java.lang.String |
getServerEnvironment()
Gets the server's environment setting. |
java.lang.String |
getServerPlatform()
Gets the server's platform name. |
java.lang.String |
getServerPort()
Gets the server connect information (port number on D3/MV). |
java.lang.String |
getServerVersion()
Gets the MVSP version. |
java.lang.String |
insert(java.lang.String dArray,
int attrNum,
int valNum,
int subValNum,
java.lang.String subValue)
Inserts a sub value into a dynamic array. |
java.lang.String |
insert(java.lang.String dArray,
int attrNum,
int valNum,
java.lang.String value)
Inserts a value into a dynamic array. |
java.lang.String |
insert(java.lang.String dArray,
int attrNum,
java.lang.String attribute)
Inserts an attribute into a dynamic array. |
boolean |
isClosed()
|
boolean |
isConnected()
Checks current connection state. |
boolean |
isConnectionPooled()
Determines if the connection is pooled. |
boolean |
isConnectionPoolingSupported()
|
boolean |
isFileExistCmdSupported()
Checks if the server supports the FILEEXISTS command. |
boolean |
isQueryKeywordsSupported()
Checks if the server supports the queryKeywords parameter on the executeQuery method. |
void |
logTo(java.lang.String account,
java.lang.String password)
Logs the connection to the requested account. |
java.lang.String |
mvCall(java.lang.String RuleParams)
Executes the business rule set by setRuleName |
java.lang.String |
MVSPClientVersion()
Returns the MVSP client version. |
MVSubroutine |
mvSub(java.lang.String subName)
Creates a mvSub object. |
MVSubroutine |
mvSub(java.lang.String subName,
int arguments)
Creates a mvSub object. |
java.lang.String |
ping()
Sends a command on the connection to assert liveliness. |
java.lang.String |
readFromServer(boolean all,
boolean isConnecting)
Read from server socket |
java.lang.String |
replace(java.lang.String dArray,
int attrNum,
int valNum,
int subValNum,
java.lang.String subValue)
Replaces a sub value in a dynamic array. |
java.lang.String |
replace(java.lang.String dArray,
int attrNum,
int valNum,
java.lang.String value)
Replaces a value in a dynamic array. |
java.lang.String |
replace(java.lang.String dArray,
int attrNum,
java.lang.String attribute)
Replaces an attribute in a dynamic array. |
boolean |
reset()
Resets the connection by closing the socket and reopening the connection. |
void |
setRuleModule(java.lang.String rule)
Sets the rule name for subsequent mvCall |
java.lang.String |
swap(java.lang.String array,
java.lang.String oldStr,
java.lang.String newStr)
Replace every occurrence of oldStr with newStr in array. |
boolean |
transactionBegin()
Begins a transaction in the database. |
boolean |
transactionCommit()
Commits a transaction in the database. |
boolean |
transactionRollback()
Rolls back a transaction in the database. |
boolean |
transactionStatus()
Gets the current database transaction status. |
void |
writeToServer(java.lang.String data)
Writes data to the server. |
Methods inherited from class com.rocketsoftware.mvapi.AbstractConnection |
---|
clearWarnings, commit, createArrayOf, createBlob, createClob, createStatement, createStatement, createStruct, getAutoCommit, getCatalog, getClientInfo, getClientInfo, getHoldability, getMetaData, getTransactionIsolation, getTypeMap, getWarnings, isReadOnly, isValid, isWrapperFor, nativeSQL, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, releaseSavepoint, rollback, rollback, setAutoCommit, setCatalog, setHoldability, setReadOnly, setSavepoint, setSavepoint, setTransactionIsolation, setTypeMap, unwrap |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MVConnection()
public MVConnection(java.lang.String url, java.util.Properties props) throws MVException
url
- url of the server.
The url must be in the following format:
jdbc:mv:vendor:host:port
where:
jdbc:mv identifies this connection as a Multivalue server connection
vendor Multivalue vendor name: D3, mvBase, U2.
host TCP/IP hostname or IP address
port TCP/IP port number
Note: the Telnet server must be configured and started to listen for connections on this port
Example url:
A connection to a D3 server at localhost and port 9000 would be specified as:
jdbc:mv:d3:localhost:9000
props
- connection properties including username and password:
example:
Properties props = new Properties();
props.setProperty("username", user);
props.setProperty("password", password);
MVException
public MVConnection(java.lang.String host, int port, java.lang.String user, java.lang.String pwd, java.lang.String account, boolean sslConnect, boolean licEnterprise) throws MVException
host
- hostname to connectport
- port numberuser
- user namepwd
- user passwordaccount
- default accountsslConnect
- true if using an SSL connectionlicEnterprise
- true if using Enterprise licensing
Note: if using Enterprise licensing, the path to d3iphelper.dll library must be provided at runtime in the java.library.path value, e.g. java -Djava.library.path="c:\d3client\libs\"
MVException
- if any errors occurpublic MVConnection(java.lang.String host, int port, java.lang.String user, java.lang.String pwd) throws MVException
host
- hostname to connectport
- port numberuser
- user namepwd
- user password
MVException
- if any errors occurpublic MVConnection(java.lang.String host, int port, java.lang.String user, java.lang.String pwd, boolean sslConnect, boolean licEnterprise) throws MVException
host
- hostname to connectport
- port numberuser
- user namepwd
- user passwordsslConnect
- true if using an SSL connectionlicEnterprise
- true if using Enterprise licensing
Note: if using Enterprise licensing, the path to d3iphelper.dll library must be provided at runtime in the java.library.path value, e.g. java -Djava.library.path="c:\d3client\libs\"
MVException
- if any errors occurpublic MVConnection(java.lang.String host, int port, java.lang.String user, java.lang.String pwd, java.lang.String account, boolean sslConnect, MVConstants.LicenseType licenseType) throws MVException
host
- hostname to connectport
- port numberuser
- user namepwd
- user passwordaccount
- default accountsslConnect
- true if using an SSL connectionlicenseType
- license type (User, Enterprise, or Connection Pool licensing)
MVException
- if any errors occurMethod Detail |
---|
public boolean connect() throws MVException
MVException
- if connection error occurs.public java.lang.String getConnectionProperties()
public boolean isConnectionPooled()
boolean
true if the connection is pooledpublic boolean reset() throws MVException
MVException
- if any errors occur when closing or reopening the connection.public void close() throws MVException
Connection
object's database resources
close
in interface java.sql.Connection
close
in class AbstractConnection
MVException
- if a database access error occurspublic void closeConnection() throws MVException
MVException
public java.lang.String insert(java.lang.String dArray, int attrNum, int valNum, int subValNum, java.lang.String subValue) throws MVException
dArray
- Dynamic arrayattrNum
- 1-relative Index of the attribute containing the value containing the sub value to insertvalNum
- 1-relative Index of the value containing the sub value to insertsubValNum
- 1-relative Index of the sub value to insert
MVException
public java.lang.String insert(java.lang.String dArray, int attrNum, int valNum, java.lang.String value) throws MVException
dArray
- Dynamic arrayattrNum
- 1-relative Index of the attribute containing the value containing the subvalue to insertvalNum
- 1-relative Index of the value containing the sub value to insert
MVException
public java.lang.String insert(java.lang.String dArray, int attrNum, java.lang.String attribute) throws MVException
dArray
- Dynamic arrayattrNum
- Index of the attribute to insert
MVException
public java.lang.String replace(java.lang.String dArray, int attrNum, int valNum, int subValNum, java.lang.String subValue) throws MVException
dArray
- Dynamic arrayattrNum
- 1-relative index of the attribute containing the value containing the sub value to replacevalNum
- 1-relative index of the value containing the sub value to replacesubValNum
- 1-relative index of the sub value to replace
MVException
public java.lang.String replace(java.lang.String dArray, int attrNum, int valNum, java.lang.String value) throws MVException
dArray
- Dynamic arrayattrNum
- 1-relative index of the attribute containing the value containing the subvalue to replacevalNum
- 1-relative index of the value containg the subvalue to replace
MVException
public java.lang.String replace(java.lang.String dArray, int attrNum, java.lang.String attribute) throws MVException
dArray
- Dynamic arrayattrNum
- 1-relative index of the attribute containing the value containing the subvalue to replace
MVException
public boolean isClosed() throws MVException
isClosed
in interface java.sql.Connection
isClosed
in class AbstractConnection
MVException
public MVStatement createStatement() throws MVException
Statement
object for sending
AQL or TCL statements to the database.
createStatement
in interface java.sql.Connection
createStatement
in class AbstractConnection
MVStatement
object
MVException
- if a database access error occurspublic boolean isConnected()
public void logTo(java.lang.String account, java.lang.String password) throws MVException
account
- account namepassword
- account password
MVException
- if the logto command failedpublic java.lang.String getCurrentAccount() throws MVException
MVException
public java.lang.String getCurrentAccountPwd() throws MVException
MVException
public void clearSelect() throws MVException
MVException
- if errors occurpublic java.lang.String call(java.lang.String name, java.lang.String data) throws MVException
The mvSub must be defined to take two arguments:
subname(indata, outdata)
The indata argument will receive the data parameter from this mvCall method. The mvSub must return its result in the outdata argument. The outdata argument will then be returned as the result from this method.
name
- name of mvSub, may include fullpath if supported
for example: (read.item or dev,bp, read.item)
data
- string data to pass in
MVException
- if a mvSub mvCall error occurspublic java.lang.String call(java.lang.String name, java.util.List<java.lang.String> arguments) throws MVException
The mvSub must be defined to take two arguments:
subname(indata, outdata)
The indata argument will receive the data parameter from this mvCall method. The mvSub must return it's result in the outdata argument. The outdata argument will then be returned as the result from this method.
name
- name of mvSub, may include fullpath if supported
for example: (read.item or dev,bp, read.item)
arguments
- list of arguments to pass in
MVException
- if a mvSub mvCall error occurspublic void execute(java.lang.String command) throws MVException
command
- command to execute
MVException
- raised if errors encounteredpublic void execute(java.lang.String command, java.lang.String data) throws MVException
command
- command to executedata
- data to stack to the command
MVException
- if execute errors occurpublic java.lang.String getExecuteReturning() throws MVException
MVException
- if any execute or connection errors occurpublic java.lang.String getExecuteCapturing() throws MVException
MVException
- if any execute or connection errors occurpublic MVResultSet executeQuery(java.lang.String query) throws MVException
query
- - e.g. SORT EMPLOYEES BY LASTNAME LASTNAME FIRSTNAME
MVException
- if any errors encounteredpublic MVConnector getConnector()
public java.lang.String getServerVersion()
public void setRuleModule(java.lang.String rule) throws MVException
rule
- (cataloged mvSub) name
MVException
public java.lang.String getRuleModule() throws MVException
MVException
public java.lang.String mvCall(java.lang.String RuleParams) throws MVException
RuleParams
- x'fe' delimited list of parameters
MVException
- if a mvSub mvCall error occurspublic java.lang.String extract(java.lang.String dArray, int attrNum) throws MVException
dArray
- Dynamic arrayattrNum
- - Attribute number (1-relative)
MVException
public java.lang.String extract(java.lang.String dArray, int attrNum, int valNum) throws MVException
dArray
- Dynamic arrayattrNum
- - Attribute number (1-relative)valNum
- - Value number (1-relative)
MVException
public java.lang.String extract(java.lang.String dArray, int attrNum, int valNum, int subValNum) throws MVException
dArray
- Dynamic arrayattrNum
- - Attribute number (1-relative)valNum
- - Value number (1-relative)subValNum
- - subvalue number (1-relative)
MVException
public java.lang.String field(java.lang.String dArray, java.lang.String delim, int pos) throws MVException
dArray
- Dynamic arraydelim
- - delimiter to usepos
- - occurrance number
MVException
public java.lang.String delete(java.lang.String dArray, int attrNum) throws MVException
dArray
- Dynamic arrayattrNum
- 1-relative attribute number to delete
MVException
public java.lang.String delete(java.lang.String dArray, int attrNum, int valNum) throws MVException
dArray
- Dynamic arrayattrNum
- 1-relative Index of the attribute containing the valuevalNum
- 1-relative Index of the value to delete
MVException
public java.lang.String delete(java.lang.String dArray, int attrNum, int valNum, int subValNum) throws MVException
dArray
- Dynamic arrayattrNum
- 1-relative Index of the attribute containing the value containing the sub value to deletevalNum
- 1-relative Index of the value containing the sub value to deletesubValNum
- 1-relative Index of the sub value to delete
MVException
public int count(java.lang.String stringToSearch, char charToCount) throws MVException
stringToSearch
- charToCount
-
MVException
public int dCount(java.lang.String dArray, char delim) throws MVException
dArray
- dynamic array to searchdelim
- delimiter to count
MVException
public java.lang.String swap(java.lang.String array, java.lang.String oldStr, java.lang.String newStr) throws MVException
array
- - a string containing zero or more occurrences of oldStr.oldStr
- - the string to search for in array.newStr
- - the string with which to replace every occurrence of oldStr in array.
MVException
public int getFileStatusCode() throws MVException
MVException
public boolean getEol() throws MVException
MVException
public java.lang.String getFileStatusMessage() throws MVException
MVException
public boolean fileCacheRelease(java.lang.String path) throws MVException
path
- [dict][accountName,]fileName[,sectionName]
MVException
public java.lang.String fileRead(java.lang.String path, java.lang.String itemId) throws MVException
path
- [dict][accountName,]fileName[,sectionName]itemId
- item id
MVException
public java.lang.String fileReadU(java.lang.String path, java.lang.String itemId) throws MVException
path
- [dict][accountName,]fileName[,sectionName]itemId
- item id
MVException
public java.lang.String fileReadV(java.lang.String path, java.lang.String itemId, int attribute) throws MVException
path
- [dict][accountName,]fileName[,sectionName]itemId
- item id
MVException
public java.lang.String fileReadVU(java.lang.String path, java.lang.String itemId, int attribute) throws MVException
path
- [dict][accountName,]fileName[,sectionName]itemId
- item id
MVException
public java.lang.String fileDelete(java.lang.String path, java.lang.String itemId) throws MVException
path
- [dict][accountName,]fileName[,sectionName]itemId
- item id
MVException
public java.lang.String fileRelease(java.lang.String path, java.lang.String itemId) throws MVException
path
- [dict][accountName,]fileName[,sectionName]itemId
- item id
MVException
- exception raised if any errors encounteredpublic java.lang.String fileWrite(java.lang.String path, java.lang.String itemId, java.lang.String itemBody) throws MVException
path
- [dict][accountName,]fileName[,sectionName]itemId
- item iditemBody
- item contents
MVException
- exception raised if any errors encounteredpublic java.lang.String fileWriteU(java.lang.String path, java.lang.String itemId, java.lang.String itemBody) throws MVException
path
- [dict][accountName,]fileName[,sectionName]itemId
- item iditemBody
- item contents
MVException
- exception raised if any errors encounteredpublic java.lang.String fileWriteV(java.lang.String path, java.lang.String itemId, java.lang.String attributeValue, int attribute) throws MVException
path
- [dict][accountName,]fileName[,sectionName]itemId
- item idattribute
- The attribute number to readattributeValue
- The value to write
MVException
- exception raised if any errors encounteredpublic java.lang.String fileWriteVU(java.lang.String path, java.lang.String itemId, java.lang.String attributeValue, int attribute) throws MVException
path
- [dict][accountName,]fileName[,sectionName]itemId
- item idattributeValue
- The value to writeattribute
- The attribute number to read
MVException
- exception raised if any errors encounteredpublic boolean fileSelect(java.lang.String path) throws MVException
path
- [dict][accountName,]fileName[,sectionName]
MVException
- exception raised if any errors encounteredpublic java.lang.String fileReadNext() throws MVException
MVException
public java.lang.String getServerPort() throws MVException
MVException
public java.lang.String getServerEnvironment() throws MVException
MVException
public java.lang.String getServerPlatform() throws MVException
MVException
public java.lang.String ping() throws MVException
MVException
- if connection is not usable.public MVSubroutine mvSub(java.lang.String subName, int arguments)
subName
- name of the mvSubarguments
- number of arguments
public MVSubroutine mvSub(java.lang.String subName)
subName
- name of the mvSub
public boolean isFileExistCmdSupported() throws MVException
MVException
public boolean isQueryKeywordsSupported() throws MVException
MVException
public java.lang.String MVSPClientVersion() throws MVException
MVException
public boolean transactionBegin() throws MVException
MVException
- raised if any errors encountered.public boolean transactionCommit() throws MVException
MVException
- raised if any errors encountered.public boolean transactionRollback() throws MVException
MVException
- raised if any errors encountered.public boolean transactionStatus() throws MVException
MVException
- raised if any errors encountered.public java.lang.String readFromServer(boolean all, boolean isConnecting) throws MVException
all
- read all available bytes. false means read only to end of current messageisConnecting
- true if called during logon process
MVException
- raised if any errors encounteredpublic void writeToServer(java.lang.String data) throws java.io.IOException
data
- to write
java.io.IOException
public final boolean isConnectionPoolingSupported()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |