Package org.compiere.db
Class CConnection
java.lang.Object
org.compiere.db.CConnection
- All Implemented Interfaces:
Serializable
,Cloneable
Adempiere DB Connection Descriptor
- Version:
- $Id: CConnection.java,v 1.5 2006/07/30 00:55:13 jjanke Exp $
- Author:
- Jorg Janke, Marek Mosiewicz<marek.mosiewicz@jotel.com.pl> - support for RMI over HTTP
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionclone()
convertStatement
(String origStatement) Convert Statementboolean
Equalsstatic CConnection
get()
Get/Set default client/server Connectionstatic CConnection
Deprecated.static CConnection
Get specific connectionstatic CConnection
Get specific client connectionGet Application HostgetConnection
(boolean autoCommit, int transactionIsolation) Get Connection.Get Connection URLGet Database AdapterGet Database Exception of last connection attemptGet DB data sourceGet Database Host nameGet DB Version InfoGet Database Name (Service Name)int
Get DB PortgetDbPwd()
Get Database PasswordgetDbUid()
Get Database UserGet fire wall hostint
Get Firewall portgetInfo()
Get Info.
- Database, Driver, Status InfogetInitialContext
(boolean useCache) Deprecated, for removal: This API element is subject to removal in a future version.getName()
Get NameGet Apps Server Versionint
Get Status Infostatic String
getTransactionIsolationInfo
(int transactionIsolation) Get Transaction Isolation InfogetType()
Get Database Typeint
int
hashCode()
Hashcodeboolean
Is it a bequeath connectionboolean
Is Database Connection OKboolean
Has DB data sourceboolean
isOracle()
Is Oracle DBboolean
Is PostgreSQL DBboolean
Deprecated.boolean
Deprecated.boolean
Deprecated.boolean
Deprecated.boolean
Is DB via Firewallvoid
readInfo
(Connection conn) Read DB info from connectionvoid
setAppsHost
(String apps_host) Set Application Hostvoid
setBequeath
(boolean bequeath) Set Bequeathvoid
setBequeath
(String bequeathString) Set Bequeathboolean
Create DB data sourceboolean
Set DB Data Sourcevoid
Set Database host namevoid
Set Database Name (Service Name)void
setDbPort
(int db_port) Set DB Portvoid
Set DB Portvoid
Set DB passwordvoid
Set Database Uservoid
Set fire wall hostvoid
setFwPort
(int fw_port) Set Firewall portvoid
Set Firewall portvoid
setName()
Set Namevoid
Set Namevoid
setSSLPort
(int sslPort) set ssl portvoid
setSSLPort
(String sslPortString) Set SSL Portvoid
Set Database Type and default settings.void
setViaFirewall
(boolean viaFirewall) Method setViaFirewallvoid
setViaFirewall
(String viaFirewallString) Method setViaFirewallvoid
setWebPort
(int webPort) set web portvoid
setWebPort
(String webPortString) Set Web Portboolean
Supports BLOBtestDatabase
(boolean retest) Test Database Connection.toString()
Short String representationDetail InfoString representation.toStringLong
(boolean includePass) String representation.
-
Constructor Details
-
CConnection
- Parameters:
host
- optional application/db host
-
-
Method Details
-
get
Get/Set default client/server Connection- Returns:
- Connection Descriptor
-
get
Deprecated.Get/Set default client/server Connection- Parameters:
apps_host
- optional apps host for new connections- Returns:
- Connection Descriptor
-
get
Get specific connection- Parameters:
type
- database Type, e.g. Database.DB_ORACLEdb_host
- db hostdb_port
- db portdb_name
- db name- Returns:
- connection
-
get
public static CConnection get(String type, String db_host, int db_port, String db_name, String db_uid, String db_pwd) Get specific client connection- Parameters:
type
- database Type, e.g. Database.DB_ORACLEdb_host
- db hostdb_port
- db portdb_name
- db namedb_uid
- db user iddb_pwd
- db user password- Returns:
- connection
-
getName
Get Name- Returns:
- connection name
-
setName
Set Name- Parameters:
name
- connection name
-
setName
public void setName()Set Name -
getAppsHost
Get Application Host- Returns:
- apps host
-
setAppsHost
Set Application Host- Parameters:
apps_host
- apps host
-
getWebPort
public int getWebPort()- Returns:
- web port
-
setWebPort
public void setWebPort(int webPort) set web port- Parameters:
webPort
-
-
setWebPort
Set Web Port- Parameters:
webPortString
- web port as String
-
getSSLPort
public int getSSLPort()- Returns:
- ssl port
-
setSSLPort
public void setSSLPort(int sslPort) set ssl port- Parameters:
sslPort
-
-
setSSLPort
Set SSL Port- Parameters:
sslPortString
- web port as String
-
getServerVersion
Get Apps Server Version- Returns:
- db host name
-
getDbHost
Get Database Host name- Returns:
- db host name
-
setDbHost
Set Database host name- Parameters:
db_host
- db host
-
getDbName
Get Database Name (Service Name)- Returns:
- db name
-
setDbName
Set Database Name (Service Name)- Parameters:
db_name
- db name
-
getDbPort
public int getDbPort()Get DB Port- Returns:
- port
-
setDbPort
public void setDbPort(int db_port) Set DB Port- Parameters:
db_port
- db port
-
setDbPort
Set DB Port- Parameters:
db_portString
- db port as String
-
getDbPwd
Get Database Password- Returns:
- db password
-
setDbPwd
Set DB password- Parameters:
db_pwd
- db user password
-
getDbUid
Get Database User- Returns:
- db user
-
setDbUid
Set Database User- Parameters:
db_uid
- db user id
-
isRMIoverHTTP
public boolean isRMIoverHTTP()Deprecated.RMI over HTTP Deprecated, always return false- Returns:
- true if RMI over HTTP (Wan Connection Profile)
-
isServerObjects
public boolean isServerObjects()Deprecated.Should objects be created on Server ?- Returns:
- true if client and VPN/WAN
-
isServerProcess
public boolean isServerProcess()Deprecated.Should objects be created on Server ?- Returns:
- true if client and Terminal/VPN/WAN
-
isTerminalServer
public boolean isTerminalServer()Deprecated.Is this a Terminal Server ?- Returns:
- true if client and Terminal
-
isViaFirewall
public boolean isViaFirewall()Is DB via Firewall- Returns:
- true if via firewall
-
setViaFirewall
public void setViaFirewall(boolean viaFirewall) Method setViaFirewall- Parameters:
viaFirewall
- boolean
-
setViaFirewall
Method setViaFirewall- Parameters:
viaFirewallString
- String
-
getFwHost
Get fire wall host- Returns:
- fire wall host
-
setFwHost
Set fire wall host- Parameters:
fw_host
- String
-
getFwPort
public int getFwPort()Get Firewall port- Returns:
- firewall port
-
setFwPort
public void setFwPort(int fw_port) Set Firewall port- Parameters:
fw_port
- firewall port
-
setFwPort
Set Firewall port- Parameters:
fw_portString
- firewall port as String
-
isBequeath
public boolean isBequeath()Is it a bequeath connection- Returns:
- true if bequeath connection
-
setBequeath
public void setBequeath(boolean bequeath) Set Bequeath- Parameters:
bequeath
- bequeath connection
-
setBequeath
Set Bequeath- Parameters:
bequeathString
- bequeath connection as String (true/false)
-
getType
Get Database Type- Returns:
- database type
-
setType
Set Database Type and default settings. Checked against installed databases- Parameters:
type
- database Type, e.g. Database.DB_ORACLE
-
supportsBLOB
public boolean supportsBLOB()Supports BLOB- Returns:
- true if BLOB is supported
-
isOracle
public boolean isOracle()Is Oracle DB- Returns:
- true if Oracle
-
isPostgreSQL
public boolean isPostgreSQL()Is PostgreSQL DB- Returns:
- true if PostgreSQL
-
isDatabaseOK
public boolean isDatabaseOK()Is Database Connection OK- Returns:
- true if database connection is OK
-
setDataSource
public boolean setDataSource()Create DB data source- Returns:
- data source != null
-
setDataSource
Set DB Data Source- Parameters:
ds
- data source- Returns:
- data source != null
-
getDataSource
Get DB data source- Returns:
- DataSource
-
isDataSource
public boolean isDataSource()Has DB data source- Returns:
- true if DataSource exists
-
testDatabase
Test Database Connection.-- Example -- Database: PostgreSQL - 7.1.3 Driver: PostgreSQL Native Driver - PostgreSQL 7.2 JDBC2 -- Example -- Database: Oracle - Oracle8i Enterprise Edition Release 8.1.7.0.0 - Production With the Partitioning option JServer Release 8.1.7.0.0 - Production Driver: Oracle JDBC driver - 9.0.1.1.0
- Parameters:
retest
-- Returns:
- Exception or null
-
readInfo
Read DB info from connection- Parameters:
conn
-- Throws:
SQLException
-
toString
Short String representation -
toStringDetail
Detail Info- Returns:
- info
-
getDBInfo
Get DB Version Info- Returns:
- info
-
toStringLong
String representation. Used also for Instantiation- Returns:
- string representation
- See Also:
-
setAttributes
-
toStringLong
String representation. Used also for Instantiation- Parameters:
includePass
- flag to include the password in the String- Returns:
- string representation
- See Also:
-
setAttributes
-
equals
Equals -
getInfo
Get Info.
- Database, Driver, Status Info- Returns:
- info
-
hashCode
public int hashCode()Hashcode -
getDatabase
Get Database Adapter- Returns:
- database adapter instance
-
getConnectionURL
Get Connection URL- Returns:
- connection URL
-
getConnection
Get Connection. Setsm_dbException
.- Parameters:
autoCommit
- true if autocommit connectiontransactionIsolation
- transaction isolation level- Returns:
- Connection
-
getDatabaseException
Get Database Exception of last connection attempt- Returns:
- Exception or null
-
getInitialContext
Deprecated, for removal: This API element is subject to removal in a future version.Get Application Server Initial Context- Parameters:
useCache
- if true, use existing cache- Returns:
- Initial Context or null
-
convertStatement
Convert Statement- Parameters:
origStatement
- original statement (Oracle syntax)- Returns:
- converted Statement
- Throws:
Exception
-
getStatus
Get Status Info- Returns:
- info
-
getTransactionIsolationInfo
Get Transaction Isolation Info- Parameters:
transactionIsolation
- trx iso- Returns:
- transaction isolation level
-
clone
- Overrides:
clone
in classObject
- Throws:
CloneNotSupportedException
-