Deploy Web applications on WebSphere

Source: Internet
Author: User

1. Install the WebSphere for window version and start it in the service. Access http: // localhost: 9060/IBM/console. If it is normal, it indicates no problem.

2. Install db28.1 and create the sample library sample

3. Create a data source

    • Select menu-> environment-> WebSphere variable, find the db2_jdbc_driver_path variable, and set the DB2 JDBC driver path. my options are C:/IBM/sqllib/Java/
    • Choose> resource> JDBC provider to enter the DB2 legacy cli-based type 2 JDBC driver connection, enter the "Data Source" connection, and select new, set the name, JNDI name, and database name. The key is the JNDI name and database name. This is the key to connecting to the database. Remove the option "use this data source for container management persistence (CMP)", click the application, and select "J2EE Connector Architecture (j2c) certified data entry" and set relevant information, go back to the data source and select "authentication alias for Component Management"
    • Test whether the data source connection is successful

4. If the data source is set successfully, deploy the applicationProgramBecause WebSphere needs to deploy the ear file, we can first create an shell J2EE application, such as regionmanager, for convenience. After the ear is successfully deployed, we can directly access C: /program files/IBM/WebSphere/appserver/profiles/nvirv01/installedapps/zhoucgnode01cell/regionmanager. ear/regionmanagerweb. the war directory is developed according to the normal Web application process.

5. On the test page, we can connect the data source. Suppose that the JNDI name is JDBC/db2_local, then the followingCodeWrite

Datasource DS = NULL; connection conn = NULL; Context CTX = new initialcontext (); DS = (datasource) CTX. lookup ("JDBC/db2_local"); Conn = Ds. getconnection (); statement stmt = Conn. createstatement ();

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.