ctx.bind( jdbc/itsodb , mysqlds);
On the other hand, the DB2 UDB Universal JDBC Driver and DB2 UDB type 2 
JDBC driver provide a number of data source implementations. Depending on 
your application requirement, you can use one of the following data sources with 
DB2 UDB Universal JDBC Driver:
com.ibm.db2.jcc.DB2SimpleDataSource
com.ibm.db2.jcc.DB2DataSource
COM.ibm.db2.jdbc.DB2ConnectionPoolDataSource
COM.ibm.db2.jdbc.DB2XADataSource
DB2 UDB type 2 driver provides the following data source implementations:
COM.ibm.db2.jdbc.DB2DataSource
COM.ibm.db2.jdbc.DB2ConnectionPoolDataSource
COM.ibm.db2.jdbc.DB2XADataSource
The DB2 UDB data source can be created in a similar fashion by initializing one 
of the above data sources as shown in Example 7 43. Also, the same example 
shows deployment of the data source in context for further use.
Example 7 43   DB2 UDB datasource creation and deployment
DB2SimpleDataSource db2ds = new com.ibm.db2.jcc.DB2SimpleDataSource(); 
db2ds.setDatabaseName("itsodb2"); 
db2ds.setDescription("Itso Sample Database");
db2ds.setUser("itso");
db2ds.setPassword("itso");
Context ctx=new InitialContext(); 
Ctx.bind("jdbc/itsodb",db2ds);
Once the data source is bound, subsequent JDBC programs can use the same 
data source for creating the JDBC connection. The MySQL and DB2 UDB 
programs for creating the connection remain the same. Example 7 44 shows how 
to get a data source from 
InitialContext
 and how to get a connection from the 
data source.
Example 7 44   MySQL and DB2 UDB datasource from context
Context ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup( jdbc/itsodb );// Only logical 
datasource name can change in this program.
Connection con = ds.getConnection();
196 
MySQL to DB2 UDB Conversion Guide






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

san diego web hosting

 

Our partners: PHP: Hypertext Preprocessor Cheap Web Hosting JSP Web Hosting Ontario Web Hosting  Jsp Web Hosting

Cheapest Web Hosting Java Hosting Cheapest Hosting

Visionwebhosting.net Business web hosting division of Vision Web Hosting Inc.. All rights reserved