|
por este dispositivo também tem outras instruções :
Facilidade de uso
1. Creating an instance of the DataSource class.
2. Setting the properties of the DataSource object.
3. Registering the DataSource object with a naming service that uses the Java Naming and Directory Interface (JNDI)
API.
An instance of the DataSource class and the DataSource object properties are usually set by an application developer or
system administer using a GUI tool as part of the installation of the data source. If you are using an installed data source, skip
to topic Programmatically Creating an Instance of a DataSource Object.
The subsequent topics show an example of performing these tasks programmatically
For more information about using data sources, see The JDBC Tutorial: Chapter 3- Advanced Tutorial
(http://java.sun.com/developer/Books/JDBCTutorial/index.html) or other information available in the field.
DataSource Object Properties
A DataSource object has properties that identify and describe the actual data source that the object represents. These
properties include such information as the URL for the MXCS association server, the database schema and catalog names, the
location of the database server, the name of the database, and so forth.
Note: When a JDBC application uses any server data source, the data source must be started before using it. Therefore, if
your application uses the default server data source, the server (MXCS) data source, ensure this data source is started
before attempting to make a connection. For more information, see the SQL/MX Connectivity Service Manual.
For details about Type 4 driver properties that you can use with the DataSource object, see the Type 4 Driver Properties
chapter.
Programmatically Creating an Instance of the DataSource Class
A JDBC application can set DataSource properties programmatically and register with a DataSource object.
To get or set DataSource object properties programmatically, use the appropriate getter or setter methods on the
SQLMXDataSource object or the SQLMXConnectionPoolDataSource object. For example,
SQLMXDataSource temp = new SQLMXDataSource(); temp.setCatalog("abc");
In the following example, the code fragment illustrates the methods that a DataSource object ds needs to include if the
object supports the property serverName.
ds.setServerName("my_database_server");
In the following example, the code shows setting properties for the SQLMXDataSource object to use the Type 4 driver to
access an SQL/MX database:
SQLMXDataSource ds = new SQLMXDataSource();
ds.setUrl("jdbc:t4sqlmx://mynode.mycompanynetwork.net:port_number/";
ds.setCatalog("mycat");
ds.setSchema("myschema");
ds.setUser("lee");
ds.setPassword("safeguard password");
// Properties relevant for Type 4 connection pooling.
// Set ds.setMaxPoolSize(-1) for turning OFF connection pooling
ds.setMaxPoolSize("10000");
ds.setMinPoolSize("1000");
// Properties relevant for Type 4 statement pooling.
// Set ds.setMaxStatement(0) for turning statement pooling OFF
// Statement pooling is enabled only when connection pooling is
... Este manual também é adequado para os modelos :
Computadores - HP Integrity NonStop J-Series (381.44 kb)