java.lang.ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource - Websphere

This is a discussion on java.lang.ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource - Websphere ; Hello,all I am using WDSC 5 for my development environment. I am trying to setup WAS5.0.2.10 to manage the JDBC connection pooling. And I've succeeded in testing the datasource connection in WAS console. My database is oracle 9i,and the driver ...

+ Reply to Thread
Results 1 to 9 of 9

Thread: java.lang.ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource

  1. java.lang.ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource

    Hello,all
    I am using WDSC 5 for my development environment. I am trying to
    setup WAS5.0.2.10 to manage the JDBC
    connection pooling.
    And I've succeeded in testing the datasource connection in WAS console.
    My database is oracle 9i,and the driver I used is classes12.jar.
    I setup the JDBC datasource using the server/datasource facility in the
    WDSC. In my jsp code I did:
    ----------------------------------------------------------------------------
    ------------------------------
    <%@ page import="java.util.*"%>
    <%@ page import="javax.sql.*"%>
    <%@ page import="java.sql.*"%>
    <%@ page import="javax.naming.*"%>
    <%@ page import="oracle.jdbc.pool.*"%>

    <%@ page
    language="java"
    contentType="text/html; charset=GB18030"
    pageEncoding="GB18030"
    %>
    &ltTITLE&gttestdbpool.jsp

    &ltBODY>
    <%
    InitialContext ic = new InitialContext();
    OracleConnectionPoolDataSource ds =
    (OracleConnectionPoolDataSource)ic.lookup("jdbc/oradb");
    PooledConnection pconn=ds.getPooledConnection();
    Connection conn=pconn.getConnection();
    Statement stmt=conn.createStatement();
    ResultSet rs=stmt.executeQuery("select * from addressbook");
    while (rs.next())
    {
    String name=rs.getString(1);
    java.util.Date date=rs.getDate(2);
    out.println(name+date);
    }
    rs.close();
    stmt.close();
    conn.close();
    %>


    ----------------------------------------------------------------------------
    ---------------------------------------------
    I am getting error message on systemout.log
    [05-3-23 15:56:27:614 CST] 33d2fb80 WebGroup E SRVE0026E: Servlet
    errorݣ*com.ibm.ws.rsadapter.jdbc.WSJdbcDataSou rceݣ
    java.lang.ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource
    at org.apache.jsp._testdbpool._jspService(_testdbpool .java:102)
    at
    com.ibm.ws.webcontainer.jsp.runtime.HttpJspBase.se rvice(HttpJspBase.java:89)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:853)
    at
    com.ibm.ws.webcontainer.jsp.servlet.JspServlet$Jsp ServletWrapper.service(Jsp
    Servlet.java:365)
    at
    com.ibm.ws.webcontainer.jsp.servlet.JspServlet.ser viceJspFile(JspServlet.jav
    a:715)
    at
    com.ibm.ws.webcontainer.jsp.servlet.JspServlet.ser vice(JspServlet.java:813)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:853)

    if I use the javax.sql.Datasource instead of
    oracle.jdbc.pool.OracleConnectionPoolDataSource,it works!

    DataSource ds = (DataSource)ic.lookup("jdbc/oradb");
    Connection conn= ds.getConnection("system","admin");

    But I want to know why? and through this way I had to write the
    username*password in the code,it's not safe.



  2. Re: java.lang.ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource

    WAS uses WSJdbcDataSource to create datasources. internally it uses Oracle
    jdbc classes for implementation.
    Casting it to javax.sql.Datasource is the right thing to do. You should be
    creating a authentication alias and assign it to data source for
    authentication to database instead of passing user/password in the code.


    "Betty" wrote in message
    news:d1rcga$4ttu$1@news.boulder.ibm.com...
    > Hello,all
    > I am using WDSC 5 for my development environment. I am trying to
    > setup WAS5.0.2.10 to manage the JDBC
    > connection pooling.
    > And I've succeeded in testing the datasource connection in WAS console.
    > My database is oracle 9i,and the driver I used is classes12.jar.
    > I setup the JDBC datasource using the server/datasource facility in the
    > WDSC. In my jsp code I did:
    > --------------------------------------------------------------------------

    --
    > ------------------------------
    > <%@ page import="java.util.*"%>
    > <%@ page import="javax.sql.*"%>
    > <%@ page import="java.sql.*"%>
    > <%@ page import="javax.naming.*"%>
    > <%@ page import="oracle.jdbc.pool.*"%>
    >
    > <%@ page
    > language="java"
    > contentType="text/html; charset=GB18030"
    > pageEncoding="GB18030"
    > %>
    > &ltTITLE&gttestdbpool.jsp
    >
    > &ltBODY>
    > <%
    > InitialContext ic = new InitialContext();
    > OracleConnectionPoolDataSource ds =
    > (OracleConnectionPoolDataSource)ic.lookup("jdbc/oradb");
    > PooledConnection pconn=ds.getPooledConnection();
    > Connection conn=pconn.getConnection();
    > Statement stmt=conn.createStatement();
    > ResultSet rs=stmt.executeQuery("select * from addressbook");
    > while (rs.next())
    > {
    > String name=rs.getString(1);
    > java.util.Date date=rs.getDate(2);
    > out.println(name+date);
    > }
    > rs.close();
    > stmt.close();
    > conn.close();
    > %>
    >
    >
    > --------------------------------------------------------------------------

    --
    > ---------------------------------------------
    > I am getting error message on systemout.log
    > [05-3-23 15:56:27:614 CST] 33d2fb80 WebGroup E SRVE0026E: Servlet
    > errorݣ*com.ibm.ws.rsadapter.jdbc.WSJdbcDataSou rceݣ
    > java.lang.ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource
    > at org.apache.jsp._testdbpool._jspService(_testdbpool .java:102)
    > at
    >

    com.ibm.ws.webcontainer.jsp.runtime.HttpJspBase.se rvice(HttpJspBase.java:89)
    > at javax.servlet.http.HttpServlet.service(HttpServlet .java:853)
    > at
    >

    com.ibm.ws.webcontainer.jsp.servlet.JspServlet$Jsp ServletWrapper.service(Jsp
    > Servlet.java:365)
    > at
    >

    com.ibm.ws.webcontainer.jsp.servlet.JspServlet.ser viceJspFile(JspServlet.jav
    > a:715)
    > at
    >

    com.ibm.ws.webcontainer.jsp.servlet.JspServlet.ser vice(JspServlet.java:813)
    > at javax.servlet.http.HttpServlet.service(HttpServlet .java:853)
    >
    > if I use the javax.sql.Datasource instead of
    > oracle.jdbc.pool.OracleConnectionPoolDataSource,it works!
    >
    > DataSource ds = (DataSource)ic.lookup("jdbc/oradb");
    > Connection conn= ds.getConnection("system","admin");
    >
    > But I want to know why? and through this way I had to write the
    > username*password in the code,it's not safe.
    >
    >




  3. Re: java.lang.ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource

    hi,I've created the j2c authentication data item
    named"suyah/suyah/oracleAlias"
    in WAS concole:JDBC provider > Oracle JDBC Thin Driver > datasource > oradb
    ,
    and set the container managed authentication alias to the alias just
    created.

    But I still have to provide my connect username and password in my
    getconnection() code,otherwise it'll throw an java.sql.SQLException about
    invalid parameters.

    thanks for your help!

    "Srinivas Badveli" дʼ
    news:d1scks$4fru$1@news.boulder.ibm.com...
    > WAS uses WSJdbcDataSource to create datasources. internally it uses

    Oracle
    > jdbc classes for implementation.
    > Casting it to javax.sql.Datasource is the right thing to do. You should be
    > creating a authentication alias and assign it to data source for
    > authentication to database instead of passing user/password in the code.
    >
    >
    > "Betty" wrote in message
    > news:d1rcga$4ttu$1@news.boulder.ibm.com...
    > > Hello,all
    > > I am using WDSC 5 for my development environment. I am trying to
    > > setup WAS5.0.2.10 to manage the JDBC
    > > connection pooling.
    > > And I've succeeded in testing the datasource connection in WAS console.
    > > My database is oracle 9i,and the driver I used is classes12.jar.
    > > I setup the JDBC datasource using the server/datasource facility in the
    > > WDSC. In my jsp code I did:

    >
    > --------------------------------------------------------------------------
    > --
    > > ------------------------------
    > > <%@ page import="java.util.*"%>
    > > <%@ page import="javax.sql.*"%>
    > > <%@ page import="java.sql.*"%>
    > > <%@ page import="javax.naming.*"%>
    > > <%@ page import="oracle.jdbc.pool.*"%>
    > >
    > > <%@ page
    > > language="java"
    > > contentType="text/html; charset=GB18030"
    > > pageEncoding="GB18030"
    > > %>
    > > &ltTITLE&gttestdbpool.jsp
    > >
    > > &ltBODY>
    > > <%
    > > InitialContext ic = new InitialContext();
    > > OracleConnectionPoolDataSource ds =
    > > (OracleConnectionPoolDataSource)ic.lookup("jdbc/oradb");
    > > PooledConnection pconn=ds.getPooledConnection();
    > > Connection conn=pconn.getConnection();
    > > Statement stmt=conn.createStatement();
    > > ResultSet rs=stmt.executeQuery("select * from addressbook");
    > > while (rs.next())
    > > {
    > > String name=rs.getString(1);
    > > java.util.Date date=rs.getDate(2);
    > > out.println(name+date);
    > > }
    > > rs.close();
    > > stmt.close();
    > > conn.close();
    > > %>
    > >
    > >

    >
    > --------------------------------------------------------------------------
    > --
    > > ---------------------------------------------
    > > I am getting error message on systemout.log
    > > [05-3-23 15:56:27:614 CST] 33d2fb80 WebGroup E SRVE0026E: Servlet
    > > errorݣ*com.ibm.ws.rsadapter.jdbc.WSJdbcDataSou rceݣ
    > > java.lang.ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource
    > > at org.apache.jsp._testdbpool._jspService(_testdbpool .java:102)
    > > at
    > >

    >

    com.ibm.ws.webcontainer.jsp.runtime.HttpJspBase.se rvice(HttpJspBase.java:89)
    > > at javax.servlet.http.HttpServlet.service(HttpServlet .java:853)
    > > at
    > >

    >

    com.ibm.ws.webcontainer.jsp.servlet.JspServlet$Jsp ServletWrapper.service(Jsp
    > > Servlet.java:365)
    > > at
    > >

    >

    com.ibm.ws.webcontainer.jsp.servlet.JspServlet.ser viceJspFile(JspServlet.jav
    > > a:715)
    > > at
    > >

    >

    com.ibm.ws.webcontainer.jsp.servlet.JspServlet.ser vice(JspServlet.java:813)
    > > at javax.servlet.http.HttpServlet.service(HttpServlet .java:853)
    > >
    > > if I use the javax.sql.Datasource instead of
    > > oracle.jdbc.pool.OracleConnectionPoolDataSource,it works!
    > >
    > > DataSource ds = (DataSource)ic.lookup("jdbc/oradb");
    > > Connection conn= ds.getConnection("system","admin");
    > >
    > > But I want to know why? and through this way I had to write the
    > > username*password in the code,it's not safe.
    > >
    > >

    >
    >




  4. Re: java.lang.ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource

    Set the alias to component managed authentication alias also. That may solve
    that issue.

    "Betty" wrote in message
    news:d1tbu4$4c2e$1@news.boulder.ibm.com...
    > hi,I've created the j2c authentication data item
    > named"suyah/suyah/oracleAlias"
    > in WAS concole:JDBC provider > Oracle JDBC Thin Driver > datasource >

    oradb
    > ,
    > and set the container managed authentication alias to the alias just
    > created.
    >
    > But I still have to provide my connect username and password in my
    > getconnection() code,otherwise it'll throw an java.sql.SQLException about
    > invalid parameters.
    >
    > thanks for your help!
    >
    > "Srinivas Badveli" дʼ
    > news:d1scks$4fru$1@news.boulder.ibm.com...
    > > WAS uses WSJdbcDataSource to create datasources. internally it uses

    > Oracle
    > > jdbc classes for implementation.
    > > Casting it to javax.sql.Datasource is the right thing to do. You should

    be
    > > creating a authentication alias and assign it to data source for
    > > authentication to database instead of passing user/password in the

    code.
    > >
    > >
    > > "Betty" wrote in message
    > > news:d1rcga$4ttu$1@news.boulder.ibm.com...
    > > > Hello,all
    > > > I am using WDSC 5 for my development environment. I am trying

    to
    > > > setup WAS5.0.2.10 to manage the JDBC
    > > > connection pooling.
    > > > And I've succeeded in testing the datasource connection in WAS

    console.
    > > > My database is oracle 9i,and the driver I used is classes12.jar.
    > > > I setup the JDBC datasource using the server/datasource facility in

    the
    > > > WDSC. In my jsp code I did:

    > >

    >
    > --------------------------------------------------------------------------
    > > --
    > > > ------------------------------
    > > > <%@ page import="java.util.*"%>
    > > > <%@ page import="javax.sql.*"%>
    > > > <%@ page import="java.sql.*"%>
    > > > <%@ page import="javax.naming.*"%>
    > > > <%@ page import="oracle.jdbc.pool.*"%>
    > > >
    > > > <%@ page
    > > > language="java"
    > > > contentType="text/html; charset=GB18030"
    > > > pageEncoding="GB18030"
    > > > %>
    > > > &ltTITLE&gttestdbpool.jsp
    > > >
    > > > &ltBODY>
    > > > <%
    > > > InitialContext ic = new InitialContext();
    > > > OracleConnectionPoolDataSource ds =
    > > > (OracleConnectionPoolDataSource)ic.lookup("jdbc/oradb");
    > > > PooledConnection pconn=ds.getPooledConnection();
    > > > Connection conn=pconn.getConnection();
    > > > Statement stmt=conn.createStatement();
    > > > ResultSet rs=stmt.executeQuery("select * from addressbook");
    > > > while (rs.next())
    > > > {
    > > > String name=rs.getString(1);
    > > > java.util.Date date=rs.getDate(2);
    > > > out.println(name+date);
    > > > }
    > > > rs.close();
    > > > stmt.close();
    > > > conn.close();
    > > > %>
    > > >
    > > >

    > >

    >
    > --------------------------------------------------------------------------
    > > --
    > > > ---------------------------------------------
    > > > I am getting error message on systemout.log
    > > > [05-3-23 15:56:27:614 CST] 33d2fb80 WebGroup E SRVE0026E:

    Servlet
    > > > errorݣ*com.ibm.ws.rsadapter.jdbc.WSJdbcDataSou rceݣ
    > > > java.lang.ClassCastException:

    com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource
    > > > at org.apache.jsp._testdbpool._jspService(_testdbpool .java:102)
    > > > at
    > > >

    > >

    >

    com.ibm.ws.webcontainer.jsp.runtime.HttpJspBase.se rvice(HttpJspBase.java:89)
    > > > at javax.servlet.http.HttpServlet.service(HttpServlet .java:853)
    > > > at
    > > >

    > >

    >

    com.ibm.ws.webcontainer.jsp.servlet.JspServlet$Jsp ServletWrapper.service(Jsp
    > > > Servlet.java:365)
    > > > at
    > > >

    > >

    >

    com.ibm.ws.webcontainer.jsp.servlet.JspServlet.ser viceJspFile(JspServlet.jav
    > > > a:715)
    > > > at
    > > >

    > >

    >

    com.ibm.ws.webcontainer.jsp.servlet.JspServlet.ser vice(JspServlet.java:813)
    > > > at javax.servlet.http.HttpServlet.service(HttpServlet .java:853)
    > > >
    > > > if I use the javax.sql.Datasource instead of
    > > > oracle.jdbc.pool.OracleConnectionPoolDataSource,it works!
    > > >
    > > > DataSource ds = (DataSource)ic.lookup("jdbc/oradb");
    > > > Connection conn= ds.getConnection("system","admin");
    > > >
    > > > But I want to know why? and through this way I had to write the
    > > > username*password in the code,it's not safe.
    > > >
    > > >

    > >
    > >

    >
    >




  5. Re: java.lang.ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource

    It really works!
    thank you!

    Why should I Set the alias to component managed authentication instead of
    container managed authentication?


    "Srinivas Badveli" дʼ
    news:d1unr9$3o0s$1@news.boulder.ibm.com...
    > Set the alias to component managed authentication alias also. That may

    solve
    > that issue.
    >
    > "Betty" wrote in message
    > news:d1tbu4$4c2e$1@news.boulder.ibm.com...
    > > hi,I've created the j2c authentication data item
    > > named"suyah/suyah/oracleAlias"
    > > in WAS concole:JDBC provider > Oracle JDBC Thin Driver > datasource >

    > oradb
    > > ,
    > > and set the container managed authentication alias to the alias just
    > > created.
    > >
    > > But I still have to provide my connect username and password in my
    > > getconnection() code,otherwise it'll throw an java.sql.SQLException

    about
    > > invalid parameters.
    > >
    > > thanks for your help!
    > >
    > > "Srinivas Badveli" дʼ
    > > news:d1scks$4fru$1@news.boulder.ibm.com...
    > > > WAS uses WSJdbcDataSource to create datasources. internally it uses

    > > Oracle
    > > > jdbc classes for implementation.
    > > > Casting it to javax.sql.Datasource is the right thing to do. You

    should
    > be
    > > > creating a authentication alias and assign it to data source for
    > > > authentication to database instead of passing user/password in the

    > code.
    > > >
    > > >
    > > > "Betty" wrote in message
    > > > news:d1rcga$4ttu$1@news.boulder.ibm.com...
    > > > > Hello,all
    > > > > I am using WDSC 5 for my development environment. I am

    trying
    > to
    > > > > setup WAS5.0.2.10 to manage the JDBC
    > > > > connection pooling.
    > > > > And I've succeeded in testing the datasource connection in WAS

    > console.
    > > > > My database is oracle 9i,and the driver I used is classes12.jar.
    > > > > I setup the JDBC datasource using the server/datasource facility in

    > the
    > > > > WDSC. In my jsp code I did:
    > > >

    > >

    >
    > --------------------------------------------------------------------------
    > > > --
    > > > > ------------------------------
    > > > > <%@ page import="java.util.*"%>
    > > > > <%@ page import="javax.sql.*"%>
    > > > > <%@ page import="java.sql.*"%>
    > > > > <%@ page import="javax.naming.*"%>
    > > > > <%@ page import="oracle.jdbc.pool.*"%>
    > > > >
    > > > > <%@ page
    > > > > language="java"
    > > > > contentType="text/html; charset=GB18030"
    > > > > pageEncoding="GB18030"
    > > > > %>
    > > > > &ltTITLE&gttestdbpool.jsp
    > > > >
    > > > > &ltBODY>
    > > > > <%
    > > > > InitialContext ic = new InitialContext();
    > > > > OracleConnectionPoolDataSource ds =
    > > > > (OracleConnectionPoolDataSource)ic.lookup("jdbc/oradb");
    > > > > PooledConnection pconn=ds.getPooledConnection();
    > > > > Connection conn=pconn.getConnection();
    > > > > Statement stmt=conn.createStatement();
    > > > > ResultSet rs=stmt.executeQuery("select * from addressbook");
    > > > > while (rs.next())
    > > > > {
    > > > > String name=rs.getString(1);
    > > > > java.util.Date date=rs.getDate(2);
    > > > > out.println(name+date);
    > > > > }
    > > > > rs.close();
    > > > > stmt.close();
    > > > > conn.close();
    > > > > %>
    > > > >
    > > > >
    > > >

    > >

    >
    > --------------------------------------------------------------------------
    > > > --
    > > > > ---------------------------------------------
    > > > > I am getting error message on systemout.log
    > > > > [05-3-23 15:56:27:614 CST] 33d2fb80 WebGroup E SRVE0026E:

    > Servlet
    > > > > errorݣ*com.ibm.ws.rsadapter.jdbc.WSJdbcDataSou rceݣ
    > > > > java.lang.ClassCastException:

    > com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource
    > > > > at org.apache.jsp._testdbpool._jspService(_testdbpool .java:102)
    > > > > at
    > > > >
    > > >

    > >

    >

    com.ibm.ws.webcontainer.jsp.runtime.HttpJspBase.se rvice(HttpJspBase.java:89)
    > > > > at javax.servlet.http.HttpServlet.service(HttpServlet .java:853)
    > > > > at
    > > > >
    > > >

    > >

    >

    com.ibm.ws.webcontainer.jsp.servlet.JspServlet$Jsp ServletWrapper.service(Jsp
    > > > > Servlet.java:365)
    > > > > at
    > > > >
    > > >

    > >

    >

    com.ibm.ws.webcontainer.jsp.servlet.JspServlet.ser viceJspFile(JspServlet.jav
    > > > > a:715)
    > > > > at
    > > > >
    > > >

    > >

    >

    com.ibm.ws.webcontainer.jsp.servlet.JspServlet.ser vice(JspServlet.java:813)
    > > > > at javax.servlet.http.HttpServlet.service(HttpServlet .java:853)
    > > > >
    > > > > if I use the javax.sql.Datasource instead of
    > > > > oracle.jdbc.pool.OracleConnectionPoolDataSource,it works!
    > > > >
    > > > > DataSource ds = (DataSource)ic.lookup("jdbc/oradb");
    > > > > Connection conn= ds.getConnection("system","admin");
    > > > >
    > > > > But I want to know why? and through this way I had to write the
    > > > > username*password in the code,it's not safe.
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >




  6. Re: java.lang.ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource

    That is the default authentication alias. Check this article
    http://publib.boulder.ibm.com/infoce...t_ccrtpds.html


    "Betty" wrote in message
    news:d208cn$d6a$1@news.boulder.ibm.com...
    > It really works!
    > thank you!
    >
    > Why should I Set the alias to component managed authentication instead of
    > container managed authentication?
    >
    >
    > "Srinivas Badveli" дʼ
    > news:d1unr9$3o0s$1@news.boulder.ibm.com...
    > > Set the alias to component managed authentication alias also. That may

    > solve
    > > that issue.
    > >
    > > "Betty" wrote in message
    > > news:d1tbu4$4c2e$1@news.boulder.ibm.com...
    > > > hi,I've created the j2c authentication data item
    > > > named"suyah/suyah/oracleAlias"
    > > > in WAS concole:JDBC provider > Oracle JDBC Thin Driver > datasource >

    > > oradb
    > > > ,
    > > > and set the container managed authentication alias to the alias just
    > > > created.
    > > >
    > > > But I still have to provide my connect username and password in my
    > > > getconnection() code,otherwise it'll throw an java.sql.SQLException

    > about
    > > > invalid parameters.
    > > >
    > > > thanks for your help!
    > > >
    > > > "Srinivas Badveli" дʼ
    > > > news:d1scks$4fru$1@news.boulder.ibm.com...
    > > > > WAS uses WSJdbcDataSource to create datasources. internally it uses
    > > > Oracle
    > > > > jdbc classes for implementation.
    > > > > Casting it to javax.sql.Datasource is the right thing to do. You

    > should
    > > be
    > > > > creating a authentication alias and assign it to data source for
    > > > > authentication to database instead of passing user/password in the

    > > code.
    > > > >
    > > > >
    > > > > "Betty" wrote in message
    > > > > news:d1rcga$4ttu$1@news.boulder.ibm.com...
    > > > > > Hello,all
    > > > > > I am using WDSC 5 for my development environment. I am

    > trying
    > > to
    > > > > > setup WAS5.0.2.10 to manage the JDBC
    > > > > > connection pooling.
    > > > > > And I've succeeded in testing the datasource connection in WAS

    > > console.
    > > > > > My database is oracle 9i,and the driver I used is classes12.jar.
    > > > > > I setup the JDBC datasource using the server/datasource facility

    in
    > > the
    > > > > > WDSC. In my jsp code I did:
    > > > >
    > > >

    > >

    >
    > --------------------------------------------------------------------------
    > > > > --
    > > > > > ------------------------------
    > > > > > <%@ page import="java.util.*"%>
    > > > > > <%@ page import="javax.sql.*"%>
    > > > > > <%@ page import="java.sql.*"%>
    > > > > > <%@ page import="javax.naming.*"%>
    > > > > > <%@ page import="oracle.jdbc.pool.*"%>
    > > > > >
    > > > > > <%@ page
    > > > > > language="java"
    > > > > > contentType="text/html; charset=GB18030"
    > > > > > pageEncoding="GB18030"
    > > > > > %>
    > > > > > &ltTITLE&gttestdbpool.jsp
    > > > > >
    > > > > > &ltBODY>
    > > > > > <%
    > > > > > InitialContext ic = new InitialContext();
    > > > > > OracleConnectionPoolDataSource ds =
    > > > > > (OracleConnectionPoolDataSource)ic.lookup("jdbc/oradb");
    > > > > > PooledConnection pconn=ds.getPooledConnection();
    > > > > > Connection conn=pconn.getConnection();
    > > > > > Statement stmt=conn.createStatement();
    > > > > > ResultSet rs=stmt.executeQuery("select * from addressbook");
    > > > > > while (rs.next())
    > > > > > {
    > > > > > String name=rs.getString(1);
    > > > > > java.util.Date date=rs.getDate(2);
    > > > > > out.println(name+date);
    > > > > > }
    > > > > > rs.close();
    > > > > > stmt.close();
    > > > > > conn.close();
    > > > > > %>
    > > > > >
    > > > > >
    > > > >
    > > >

    > >

    >
    > --------------------------------------------------------------------------
    > > > > --
    > > > > > ---------------------------------------------
    > > > > > I am getting error message on systemout.log
    > > > > > [05-3-23 15:56:27:614 CST] 33d2fb80 WebGroup E SRVE0026E:

    > > Servlet
    > > > > > errorݣ*com.ibm.ws.rsadapter.jdbc.WSJdbcDataSou rceݣ
    > > > > > java.lang.ClassCastException:

    > > com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource
    > > > > > at org.apache.jsp._testdbpool._jspService(_testdbpool .java:102)
    > > > > > at
    > > > > >
    > > > >
    > > >

    > >

    >

    com.ibm.ws.webcontainer.jsp.runtime.HttpJspBase.se rvice(HttpJspBase.java:89)
    > > > > > at javax.servlet.http.HttpServlet.service(HttpServlet .java:853)
    > > > > > at
    > > > > >
    > > > >
    > > >

    > >

    >

    com.ibm.ws.webcontainer.jsp.servlet.JspServlet$Jsp ServletWrapper.service(Jsp
    > > > > > Servlet.java:365)
    > > > > > at
    > > > > >
    > > > >
    > > >

    > >

    >

    com.ibm.ws.webcontainer.jsp.servlet.JspServlet.ser viceJspFile(JspServlet.jav
    > > > > > a:715)
    > > > > > at
    > > > > >
    > > > >
    > > >

    > >

    >

    com.ibm.ws.webcontainer.jsp.servlet.JspServlet.ser vice(JspServlet.java:813)
    > > > > > at javax.servlet.http.HttpServlet.service(HttpServlet .java:853)
    > > > > >
    > > > > > if I use the javax.sql.Datasource instead of
    > > > > > oracle.jdbc.pool.OracleConnectionPoolDataSource,it works!
    > > > > >
    > > > > > DataSource ds = (DataSource)ic.lookup("jdbc/oradb");
    > > > > > Connection conn= ds.getConnection("system","admin");
    > > > > >
    > > > > > But I want to know why? and through this way I had to write the
    > > > > > username*password in the code,it's not safe.
    > > > > >
    > > > > >
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >




  7. Re: java.lang.ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource

    Srinivas Badveli wrote:

    > That is the default authentication alias. Check this article
    > http://publib.boulder.ibm.com/infoce...t_ccrtpds.html


    This is just downright wrong. In fact, it is preferable to use
    container-managed authentication aliases as they are more secure.

    This may be the key info that you're missing:

    "If your resource authentication (res-auth) is set to Application, set
    the alias in the Component-managed Authentication Alias. If your
    res-auth is set to Container, set the Container-managed Authentication
    Alias."



  8. Re: java.lang.ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource

    I don't see anything wrong with my statement. Probably you already know what
    happens when there is no resource-ref specified in your web application. It
    is the Component-managed Authentication Alias that will be used.

    "Paul Ilechko" wrote in message
    news:d2hnej$46ue$1@news.boulder.ibm.com...
    > Srinivas Badveli wrote:
    >
    > > That is the default authentication alias. Check this article
    > >

    http://publib.boulder.ibm.com/infoce...t_ccrtpds.html
    >
    > This is just downright wrong. In fact, it is preferable to use
    > container-managed authentication aliases as they are more secure.
    >
    > This may be the key info that you're missing:
    >
    > "If your resource authentication (res-auth) is set to Application, set
    > the alias in the Component-managed Authentication Alias. If your
    > res-auth is set to Container, set the Container-managed Authentication
    > Alias."
    >
    >




  9. Re: java.lang.ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource

    Srinivas Badveli wrote:

    > I don't see anything wrong with my statement. Probably you already know what
    > happens when there is no resource-ref specified in your web application. It
    > is the Component-managed Authentication Alias that will be used.


    But there *should* be a resource ref specified. That's the J2EE way.


+ Reply to Thread