DataSource是你在服务器上配的。比如weblogic,websphere,tomcat5.0(好像不好用)都可以配自己,在那里指定你的数据库类型什么的一大堆乱七八糟的东西的。

解决方案 »

  1.   

    比如在WebLogic7控制台配置Connection Pool和Data Source后,其中的config.xml文件加了类似如下的一段:
        <JDBCConnectionPool DriverName="oracle.jdbc.driver.OracleDriver"
            LoginDelaySeconds="3" MaxCapacity="100"
            Name="MyJDBC Connection Pool" Password="{3DES}533McA2fPIk="
            Properties="user=2134" RefreshMinutes="2" Targets="myserver"
            TestConnectionsOnRelease="true" TestConnectionsOnReserve="true"
            TestTableName="tab" URL="jdbc:oracle:thin:@printer:1521:oemrep" XAPassword="{3DES}533McA2fPIk="/>
        <JDBCDataSource JNDIName="orapool" Name="MyJDBC Data Source"
            PoolName="MyJDBC Connection Pool" RowPrefetchEnabled="true" Targets="myserver"/>然后
    DataSource ds = (DataSource) ctx.lookup("orapool");