• JavaEE(1)


    JBoss下载:

    http://jbossas.jboss.org/downloads

    http://www.cnblogs.com/xw-cnblogs/articles/2439969.html

    WebLogic下载:

    http://www.oracle.com/technetwork/middleware/weblogic/downloads/wls-main-097127.html

    WebLogic安装:http://blog.csdn.net/shimiso/article/details/8120650

    1. 启动

    Method No.1: 开始-->Oracle Weblogic(Oracle Enterprise Package for Eclipse)-->User Projects-->base_domain-->Start Admin Server for Weblogic Server.

    Method No.2: D:domainsase_domainstartWeblogic.cmd

    http://localhost:7001/console

    2. 修改端口(如果必要)

    base_domain-->Enviroment-->Servers-->AdminServer(admin)

    3. 数据源配置

    Method No.1: base_domain-->Services-->Data Sources.

    Method No.2: D:domainsase_domainconfigjdbcdatasource_name-jdbc.xml

    前置条件:

    #1. 拷贝数据库驱动程序(sqljdbc4.jar等)到:C:OracleMiddlewarewlserver_10.3serverlib

    #2. 修改配置文件(D:domainsase_domaininsetDomainEnv.cmd):在文件最后添加

    set CLASSPATH=%PRE_CLASSPATH%;%WEBLOGIC_CLASSPATH%;%POST_CLASSPATH%;%WLP_POST_CLASSPATH%;%WL_HOME%serverlibsqljdbc4.jar;

    配置数据源:(D:domainsase_domainconfigconfig.xml)

      <jdbc-system-resource>
        <name>fundamental</name>
        <target>AdminServer</target>
        <descriptor-file-name>jdbc/fundamental-jdbc.xml</descriptor-file-name>
      </jdbc-system-resource>

    D:domainsase_domainconfigjdbcfundamental-jdbc.xml:

    <?xml version='1.0' encoding='UTF-8'?>
    <jdbc-data-source xmlns="http://xmlns.oracle.com/weblogic/jdbc-data-source" xmlns:sec="http://xmlns.oracle.com/weblogic/security" xmlns:wls="http://xmlns.oracle.com/weblogic/security/wls" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/weblogic/jdbc-data-source http://xmlns.oracle.com/weblogic/jdbc-data-source/1.2/jdbc-data-source.xsd">
      <name>fundamental</name>
      <jdbc-driver-params>
        <url>jdbc:sqlserver://localhost:1433</url>
        <driver-name>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver-name>
        <properties>
          <property>
            <name>user</name>
            <value>javaweb</value>
          </property>
          <property>
            <name>databaseName</name>
            <value>TSQLFundamentals2008</value>
          </property>
        </properties>
        <password-encrypted>{AES}mC7MZTOcXIpmDSxDMdd7saPHBF01+jvvWuyeGNcUsc8=</password-encrypted>
      </jdbc-driver-params>
      <jdbc-connection-pool-params>
        <test-table-name>SQL SELECT 1</test-table-name>
      </jdbc-connection-pool-params>
      <jdbc-data-source-params>
        <jndi-name>fundamental</jndi-name>
        <global-transactions-protocol>OnePhaseCommit</global-transactions-protocol>
      </jdbc-data-source-params>
    </jdbc-data-source>

    4. NetBeans 创建web project: (index.jsp)

    <%@page contentType="text/html" pageEncoding="UTF-8"%>
    <%@page import="java.sql.ResultSet"%>
    <%@page import="java.sql.Statement"%>
    <%@page import="java.sql.Connection"%>
    <%@page import="javax.sql.DataSource"%>
    <%@page import="javax.naming.InitialContext"%>
    <%@page import="javax.naming.Context"%>
    <!DOCTYPE html>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>测试容器管理的数据源</title>
        </head>
        <body>
            <h1>测试容器管理的数据源</h1>
            <% 
                Context ctx = new InitialContext();
                DataSource ds = (DataSource)ctx.lookup("fundamental");
                Connection conn = ds.getConnection();
                Statement stmt = conn.createStatement();
                ResultSet rs = stmt.executeQuery("select * from HR.Employees");
                
                while (rs.next()) {
                    out.println(rs.getString(1) + ", " + rs.getString(2) + "<br/>");
                }
                
                rs.close();
                stmt.close();
                conn.close();
            %>
        </body>
    </html>

    5. 部署到weblogic: (D:domainsase_domainconfigconfig.xml)

      <app-deployment>
        <name>dsTest</name>
        <target>AdminServer</target>
        <module-type>war</module-type>
        <source-path>D:DocumentsJIRANetBeansWebJavaEE Traditionalch04dsTestuildweb</source-path>
        <security-dd-model>DDOnly</security-dd-model>
        <staging-mode>nostage</staging-mode>
      </app-deployment>

    6. 浏览器访问:http://localhost:7001/dsTest/index.jsp

  • 相关阅读:
    树状数组和线段树
    N皇后问题(函数式编程与过程式)
    单例模式
    BitSet
    蓄水池抽样问题
    关于动态规划的一些感想
    53最大子序和
    5最长回文子串
    139单词拆分
    91.解码方法
  • 原文地址:https://www.cnblogs.com/thlzhf/p/4066092.html
Copyright © 2020-2023  润新知