1. What is JDBC, JNDI?
JDBC – Java Database Connectivity
JNDI – Java Naming and Directory Interface
A connection pool is a cache of database
connections maintained by the database so that the connections can be reused when
the database receives future requests for data. Connection pools are used to
enhance the performance of executing commands on a database. Opening and
maintaining a database connection for each user, especially requests made to a
dynamic database-driven website application, is costly and wastes resources. In
connection pooling, after a connection is created, it is placed in the pool and
it is used over again so that a new connection does not have to be established.
If all the connections are being used, a new connection is made and is added to
the pool. Connection pooling also cuts down on the amount of time a user must
wait to establish a connection to the database
JDBC – Java Database Connectivity
JNDI – Java Naming and Directory Interface
2. What type of driver you are
using? Type 4 driver ?
Type 1 driver: JDBC-ODBC Bridge
This driver called as
JDBC-ODBC bridge.The Java Statements converts to JDBC statements.JDBC statements calls ODBC by using JDBC-ODBC bridge. ODBC drivers convert into the
requirements of databases.
Java--->JDBCStat-->JDBC-ODBC
bridge-->ODBC-->Databases.
Type 2 driver:
Native-API/partly Java driver
This driver is called as
Native Driver where it requires the some native code to connect to the databases.
Type 3 Driver:
Net-protocol/all-Java driver
This driver is called as
Protocal driver where
Java-->JDBC
statements-->SQLStatements--> databases.
Type 4 Driver: This driver
directly converts the java statements to SQl Statements which require to
databases. It wont convert to JDBC statement
3. what is meant by connection
pooling?
4. What is JNDI ?
We can register
resources in the application server’s java naming and directory interface
(jndi) namespace. Client applications can then obtain the references to these
resource objects in their programs.
Configuring a
JDBC provider using the administrative console
- Open the administrative console.
- Click Resources > JDBC
Providers.
- Select the scope at which applications can
use the JDBC provider. (This scope becomes the scope of your data source.)
You can choose a cell, node, cluster, or server
- Click New.
- Use the first drop-down list to select the database type of the
JDBC provider you need to create.
If the list of database types does not include the
product that you want to use, select User-Defined. This selection triggers the console to display your provider type as User-defined JDBC provider, and your implementation type as User-defined.
From the second drop-down list, select your JDBC
provider type.
- From the third drop-down list, select the implementation type that
is necessary for your application. If your application does not require
that connections support two-phase commit transactions, choose Connection
Pool Data Source. Choose XA Data Source,
however, if your application requires connections that support two-phase
commit transactions. Applications that use this data source configuration
have the benefit of container-managed transaction recovery.
- Click Next to view the general
property settings page for your JDBC provider.
- Ensure that all required properties have valid values.
- Click Apply to view the page with
your new JDBC provider settings. Note that two active data source links
now appear under the Additional Properties heading
on this page. To set up a data source, click the link that corresponds to
the type required by your application
- Click OK to return to the JDBC
providers page, where your new JDBC provider appears in the list.
Remember: If you modify the class path or
native library path of a JDBC provider, click OK and then restart
every application server within the scope of that JDBC provider. Otherwise, the
new configuration does not work, and you receive data source failure messages
Configuring a
data source using the administrative console
- Open the administrative console.
- Click Resources > JDBC
Providers.
- Choose the JDBC resource provider under which you want to create
your data source. The detail page for this provider is displayed.
- Under Additional Properties, click the Data
Sources link that is appropriate for your application. The
Data sources or Data sources (Version 4) page is displayed.
- Click New to display the Data source
settings page.
- Verify that all the required properties have valid values.
The following
steps guide you through supplying the property values, a process that is
basically the same for both data source types:
- Select a DataStoreHelper class name.
- You can choose a
DataStoreHelper class name from the list that is provided. The
application server provides a class called DataStoreHelpers, or you can
keep the default selection.
- To use a data store
helper other than what is provided, click Specify
a user-defined DataStoreHelper. Type a fully qualified class name
in the field that is provided.
- The next section of properties varies according
to the database selection, provider type, and implementation that you
chose for your JDBC provider. These properties are either required or
highly recommended for your data source. Provide valid values for these
settings if you do not want to accept the default values.
- Click Component-managed Authentication Alias
if your database requires a user ID and password for a connection. This
alias is used only when the application resource reference is using res-auth = Application.
Important:(For components with res-auth=Container) Both the Container-managed
Authentication Alias and Mapping-Configuration Alias settings are deprecated.
They are superseded by the specification of a login configuration on the
resource-reference mapping at deployment time. You must now use this login setting
to define the aliases at deployment.
- If you chose XA Data Source as the
implementation type of your JDBC provider, you need to specify the alias
used during transaction recovery processing. An additional section
entitled Authentication Alias for XA Recovery is available. Select either
Use Application Authentication Alias to use the
same value that you chose for component-managed authentication, or select
Specify: to choose a different alias from the
drop-down list.
- Click Apply to view a page with your
new data source settings. Additional properties and Related items sections
are now available on this page. Additional properties contains the
Connection pool, Custom properties, and WebSphere Application Server data
source properties choices. (If you are using a Version 4 data source,
however, you see only the Connection pool and Custom properties links.)
- Click on the first link to define settings that
affect the behavior of the Java 2 Connector (J2C)
- Use the WebSphere
Application Server data source properties page to input settings that
exclusively affect the application server's connection to the database.
- Go to the Custom
properties page to view and modify additional properties that the
database vendor might require or recommend for the connection of its
product to an application server.
- The Related items section (applicable only to
later version data sources, not Version 4 data sources) contains the J2C
Authentication data entries choice. Here, you can specify a list of
user IDs and passwords for J2C security to use.
- Click Save.
- Return to the data source page to confirm that your new data source
is displayed in the list
Trace strings for JDBC data sources
Identify your database type by selecting the
trace group WAS.database and typing one of the following trace strings in the
console:
- com.ibm.ws.database.logwriter Trace string for databases that use the
GenericDataStoreHelper. You can also use this trace string for unsupported
databases.
- com.ibm.ws.db2.logwriter Trace string for DB2 databases.
- com.ibm.ws.oracle.logwriter Trace string for Oracle databases
1 comments:
Business intelligence Analyst
SQIAR (http://www.sqiar.com/services/bi-strategy/) is a leading Business Intelligence company.Sqiar Provide business intelligence Services Which help the company to present Information in Meaningful form. - See more at: http://www.icmmexico.com/4/post/2012/09/mejora-tus-bsquedas-en-internet.html?#sthash.8AFQeMe6.dpuf
Post a Comment