public class IlvSDOConnection extends Object implements IlvPersistentObject
IlvSDOConnection
object stores the parameters used to open an
Oracle connection. The parameters are the JDBC URL, the user name, and optionally,
the password of the connection. You have to call createConnection
to
create the current JDBC Connection. You should extend this class to use your
own connection mechanism. For instance, in order to use Connection Pools, extend this
class and override the getConnection
method.getConnection()
,
Serialized FormConstructor and Description |
---|
IlvSDOConnection(IlvInputStream stream)
Reads an
IlvSDOConnection from an IlvInputStream . |
IlvSDOConnection(String url,
String user,
String password)
Initializes an instance of
IlvSDOConnection . |
Modifier and Type | Method and Description |
---|---|
boolean |
createConnection()
This method opens the Oracle connection using the parameters of the
IlvSDOConnection . |
Connection |
getConnection()
Returns the encapsulated
java.sql.Connection . |
static IlvSDOConnectionFactory |
GetConnectionFactory()
Returns the installed connection factory.
|
String |
getPassword()
Returns the current password if
isSavingPassword returns true . |
String |
getUrl()
Returns the URL of the JDBC connection.
|
String |
getUser()
Returns the current user.
|
boolean |
isSavingPassword()
Returns
true if the password is saved in an .ivl file. |
static void |
SetConnectionFactory(IlvSDOConnectionFactory factory)
Installs a connection factory.
|
void |
setPassword(String passwd)
Sets the current password.
|
void |
setSavingPassword(boolean savePassword)
Specifies whether the password should be saved in an
.ivl file. |
void |
setUrl(String url)
Sets the URL for the connection.
|
void |
setUser(String user)
Sets the current user.
|
void |
write(IlvOutputStream stream)
Writes the
IlvSDOConnection into an IlvOutputStream . |
public IlvSDOConnection(String url, String user, String password)
IlvSDOConnection
.url
- A database URL of the form jdbc:subprotocol:subname. Examples follow:
jdbc:oracle:oci7:@[sid], where [sid] is the server id for the oci7
driver. Or for the thin driver: jdbc:oracle:thin:@[host]:[port]:[sid],
where [host] is the hostname of the machine Oracle is running on, [port] is the
connection port number and [sid] is the server id.user
- The name of the user of the Oracle session.password
- The password to open the Oracle session. This argument
can have a null
value.setSavingPassword(boolean)
public IlvSDOConnection(IlvInputStream stream) throws IlvReadFileException
IlvSDOConnection
from an IlvInputStream
.IlvReadFileException
public void write(IlvOutputStream stream) throws IOException
IlvSDOConnection
into an IlvOutputStream
.write
in interface IlvPersistentObject
stream
- the output streamIOException
- if an error occurred while writing this object.public boolean createConnection() throws SQLException
IlvSDOConnection
. This method is called by the
connection factories when they have restored the connection parameters.false
if the connection is already connected and returns
true
if the connection is successfully made.SQLException
- if the connection could not be opened.IlvSDOConnectionFactory
public boolean isSavingPassword()
true
if the password is saved in an .ivl
file.public void setSavingPassword(boolean savePassword)
.ivl
file.
By default, the password is not saved.savePassword
- If set to true
, the password
will be saved with the connection.
Otherwise, it is not saved in an .ivl
file and the
internal value for the password is set to null
.public String getUrl()
public String getUser()
public String getPassword()
isSavingPassword
returns true
.
Otherwise, it returns a null
pointer.public Connection getConnection()
java.sql.Connection
.
You can extend IlvSDOConnection
and override this method to use
your own mechanism of connection creation (the connection Pools for instance).public void setUrl(String url)
public void setUser(String user)
public void setPassword(String passwd)
public static final IlvSDOConnectionFactory GetConnectionFactory()
public static final void SetConnectionFactory(IlvSDOConnectionFactory factory)
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.