com.ibm.as400.vaccess
Class SQLConnection
- java.lang.Object
-
- com.ibm.as400.vaccess.SQLConnection
-
- All Implemented Interfaces:
- java.io.Serializable
Deprecated.Use Java Swing instead, along with the classes in package com.ibm.as400.access
public class SQLConnection extends java.lang.Object implements java.io.Serializable
SQLConnection objects represent a SQL Connection. A SQLConnection object encapsulates the properties needed to make a JDBC Connection into a Java Bean. A connection can only be made once. Once a connection is closed, it cannot be opened again.The actual connection is made when getConnection() is called.
Users should call close() when the connection is no longer needed.
Properties cannot be changed once a connection is made.
Note that the password is not serialized if it is provided by the password parameter on the constructor or setPassword(), or if it is provided using the 'password' property in the constructor 'properties' parameter or using setProperties(). If the password is supplied via the URL or other property, it will be serialized.
SQLConnection objects generate the following events:
- PropertyChangeEvent
- WorkingEvent
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description SQLConnection()
Deprecated.Creates a SQLConnection object.SQLConnection(java.lang.String URL)
Deprecated.Creates a SQLConnection object.SQLConnection(java.lang.String URL, java.util.Properties properties)
Deprecated.Creates a SQLConnection object.SQLConnection(java.lang.String URL, java.lang.String userName)
Deprecated.Creates a SQLConnection object.SQLConnection(java.lang.String URL, java.lang.String userName, java.lang.String password)
Deprecated.Creates a SQLConnection object.
-
Method Summary
Methods Modifier and Type Method and Description void
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Deprecated.Adds a listener to be notified when the value of any bound property is changed.void
addVetoableChangeListener(java.beans.VetoableChangeListener listener)
Deprecated.Adds a listener to be notified when the value of any constrained property is changed.void
addWorkingListener(WorkingListener listener)
Deprecated.Adds a listener to be notified when work starts and stops on potentially long-running operations.void
close()
Deprecated.Closes the SQL connection, if it is open.java.sql.Connection
getConnection()
Deprecated.Returns a JDBC connection.java.util.Properties
getProperties()
Deprecated.Returns the properties for this connection.java.lang.String
getURL()
Deprecated.Returns the URL for this connection.java.lang.String
getUserName()
Deprecated.Returns the user name for this connection.void
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Deprecated.Removes a listener from being notified when the value of any bound property is changed.void
removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
Deprecated.Removes a listener from being notified when the value of any constrained property is changed.void
removeWorkingListener(WorkingListener listener)
Deprecated.Removes a listener from being notified when work starts and stops on potentially long-running operations.void
setPassword(java.lang.String password)
Deprecated.Sets the password used to connect to the database.void
setProperties(java.util.Properties properties)
Deprecated.Sets the properties used to connect to the database.void
setURL(java.lang.String URL)
Deprecated.Sets the URL used to connect to the database.void
setUserName(java.lang.String userName)
Deprecated.Sets the user name used to connect to the database.
-
-
-
Constructor Detail
-
SQLConnection
public SQLConnection()
Deprecated.Creates a SQLConnection object.
-
SQLConnection
public SQLConnection(java.lang.String URL)
Deprecated.Creates a SQLConnection object.- Parameters:
URL
- The URL used to connect to the database.
-
SQLConnection
public SQLConnection(java.lang.String URL, java.lang.String userName)
Deprecated.Creates a SQLConnection object.- Parameters:
URL
- The URL used to connect to the database.userName
- The user name used to connect to the database.
-
SQLConnection
public SQLConnection(java.lang.String URL, java.lang.String userName, java.lang.String password)
Deprecated.Creates a SQLConnection object.- Parameters:
URL
- The URL used to connect to the database.userName
- The user name used to connect to the database.password
- The password used to connect to the database.
-
SQLConnection
public SQLConnection(java.lang.String URL, java.util.Properties properties)
Deprecated.Creates a SQLConnection object.- Parameters:
URL
- The URL used to connect to the database.properties
- The properties used to connect to the database.
-
-
Method Detail
-
addPropertyChangeListener
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Deprecated.Adds a listener to be notified when the value of any bound property is changed. The listener's propertyChange() method will be called.- Parameters:
listener
- The listener.
-
addVetoableChangeListener
public void addVetoableChangeListener(java.beans.VetoableChangeListener listener)
Deprecated.Adds a listener to be notified when the value of any constrained property is changed. The listener's vetoableChange() method will be called.- Parameters:
listener
- The listener.
-
addWorkingListener
public void addWorkingListener(WorkingListener listener)
Deprecated.Adds a listener to be notified when work starts and stops on potentially long-running operations.- Parameters:
listener
- The listener.
-
close
public void close() throws java.sql.SQLException
Deprecated.Closes the SQL connection, if it is open. Once a connection is closed, it cannot be opened again.- Throws:
java.sql.SQLException
- If there is an error closing the connection.
-
getConnection
public java.sql.Connection getConnection() throws java.sql.SQLException
Deprecated.Returns a JDBC connection. If a successful connection has not yet been made, a new connection will be made. Subsequent invocations will reuse the connection. It is up to the user to close the connection, or allow garbage collection to do so.- Returns:
- The connection.
- Throws:
java.sql.SQLException
- If there is an error connecting to the database.
-
getProperties
public java.util.Properties getProperties()
Deprecated.Returns the properties for this connection. This method will return the properties as set by the constructor or the last setProperties() call, minus the 'password' property, if included.- Returns:
- The properties for this connection.
-
getURL
public java.lang.String getURL()
Deprecated.Returns the URL for this connection. If a connection has not yet been made, this method will return the URL supplied on the constructor or the last setURL() call. If a connection has been made, the URL will be the URL for the connection.- Returns:
- The URL for this connection.
-
getUserName
public java.lang.String getUserName()
Deprecated.Returns the user name for this connection. If a connection has not yet been made, this method will return the user name supplied on the constructor or the last setUserName() call. If a connection has been made, the user name will be the user name being used for the connection.- Returns:
- The user name for this connection.
-
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Deprecated.Removes a listener from being notified when the value of any bound property is changed.- Parameters:
listener
- The listener.
-
removeVetoableChangeListener
public void removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
Deprecated.Removes a listener from being notified when the value of any constrained property is changed.- Parameters:
listener
- The listener.
-
removeWorkingListener
public void removeWorkingListener(WorkingListener listener)
Deprecated.Removes a listener from being notified when work starts and stops on potentially long-running operations.- Parameters:
listener
- The listener.
-
setPassword
public void setPassword(java.lang.String password) throws java.beans.PropertyVetoException
Deprecated.Sets the password used to connect to the database. This property cannot be changed after a connection is made by calling getConnection(). This property is bound and constrained. The events will always have null and an empty string for the old and new value, respectively.- Parameters:
password
- The password used to connect to the database.- Throws:
java.beans.PropertyVetoException
- If the change is vetoed.
-
setProperties
public void setProperties(java.util.Properties properties) throws java.beans.PropertyVetoException
Deprecated.Sets the properties used to connect to the database. This property cannot be changed after a connection is made by calling getConnection(). This property is bound and constrained.- Parameters:
properties
- The properties used to connect to the database.- Throws:
java.beans.PropertyVetoException
- If the change is vetoed.
-
setURL
public void setURL(java.lang.String URL) throws java.beans.PropertyVetoException
Deprecated.Sets the URL used to connect to the database. This property cannot be changed after a connection is made by calling getConnection(). This property is bound and constrained.- Parameters:
URL
- The URL used to connect to the database.- Throws:
java.beans.PropertyVetoException
- If the change is vetoed.
-
setUserName
public void setUserName(java.lang.String userName) throws java.beans.PropertyVetoException
Deprecated.Sets the user name used to connect to the database. This property cannot be changed after a connection is made by calling getConnection(). This property is bound and constrained.- Parameters:
userName
- The user name used to connect to the database.- Throws:
java.beans.PropertyVetoException
- If the change is vetoed.
-
-