Accessing Websphere 6.1 DataSource From Stand Alone Java ClientApplication - Websphere

This is a discussion on Accessing Websphere 6.1 DataSource From Stand Alone Java ClientApplication - Websphere ; Hi, I was connecting the database with the help of Websphere 6.1 server DataSource. It was getting the DataSource fine, but while getting the Connection from DataSource, it was getting the problem. I was given the following jars in the ...

+ Reply to Thread
Results 1 to 7 of 7

Thread: Accessing Websphere 6.1 DataSource From Stand Alone Java ClientApplication

  1. Accessing Websphere 6.1 DataSource From Stand Alone Java ClientApplication

    Hi,

    I was connecting the database with the help of Websphere 6.1 server DataSource. It was getting the DataSource fine, but while getting the Connection from DataSource, it was getting the problem. I was given the following jars in the classpath



    bootstrap.jar

    com.ibm.ws.admin.client_6.1.0.jar

    com.ibm.ws.emf_2.1.0.jar

    com.ibm.ws.runtime_6.1.0.jar

    implfactory.jar

    j2ee.jar

    lmproxy.jar

    ojdbc14.jar

    rsadbutils.jar

    rsahelpers.jar

    rssutils.jar

    sas.client.props

    urlprotocols.jar



    Here i am attaching the Code Snippet.

    public static void main(String[] args){

    try{

    Properties prop = new Properties();

    prop.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory");

    prop.put(Context.PROVIDER_URL,"iiop://localhost:2809");

    InitialContext init = new InitialContext(prop);

    DataSource source = (DataSource)init.lookup("WMPDS");

    //Connection con = source.getConnection("CFEWS","CFEWS");

    Connection con = source.getConnection();

    PreparedStatement pstmt = con.prepareStatement("select * from customer_details");

    ResultSet rs = pstmt.executeQuery();

    }catch(Exception e)

    {

    e.printStackTrace();

    }

    }



    in this Code if i send source.getConnection(userid, password) it was getting the connection fine, if i access thru source.getConnection(); it was throwing an Error.



    With the Websphere DataSource we already configured the Userid and password, why it was not acessing, i was unable to understand the issue. I tried by including all the jars and properties of "setupCmdLine.bat". even it was giving the same problem.



    Here i am pasting the Error

    ============================

    Mar 25, 2008 4:08:22 PM com.ibm.ws.util.ImplFactory

    WARNING: WSVR0072W

    java.sql.SQLException: invalid arguments in callDSRA0010E: SQL State = null, Error Code = 17,433

    at oracle.jdbc.driver.DatabaseError.throwSqlException (DatabaseError.java:125)

    at oracle.jdbc.driver.DatabaseError.throwSqlException (DatabaseError.java:162)

    at oracle.jdbc.driver.DatabaseError.throwSqlException (DatabaseError.java:227)

    at oracle.jdbc.driver.T4CConnection.logon(T4CConnecti on.java:197)

    at oracle.jdbc.driver.PhysicalConnection.<init>(Physi calConnection.java:344)

    at oracle.jdbc.driver.T4CConnection.<init>(T4CConnect ion.java:148)

    at oracle.jdbc.driver.T4CDriverExtension.getConnectio n(T4CDriverExtension.java:32)

    at oracle.jdbc.driver.OracleDriver.connect(OracleDriv er.java:545)

    at oracle.jdbc.pool.OracleDataSource.getConnection(Or acleDataSource.java:194)

    at oracle.jdbc.pool.OracleConnectionPoolDataSource.ge tPhysicalConnection(OracleConnectionPoolDataSource .java:109

    )

    at oracle.jdbc.pool.OracleConnectionPoolDataSource.ge tPooledConnection(OracleConnectionPoolDataSource.j ava:77)

    at oracle.jdbc.pool.OracleConnectionPoolDataSource.ge tPooledConnection(OracleConnectionPoolDataSource.j ava:59)

    at com.ibm.ws.rsadapter.spi.InternalGenericDataStoreH elper$1.run(InternalGenericDataStoreHelper.java:89 7)

    at com.ibm.ws.security.util.AccessController.doPrivil eged(AccessController.java:118)

    at com.ibm.ws.rsadapter.spi.InternalGenericDataStoreH elper.getPooledConnection(InternalGenericDataStore Helper.ja

    va:892)

    at com.ibm.ws.rsadapter.spi.WSRdbDataSource.getPooled Connection(WSRdbDataSource.java:1180)

    at com.ibm.ws.rsadapter.spi.WSManagedConnectionFactor yImpl.createManagedConnection(WSManagedConnectionF actoryImp

    l.java:1047)

    at com.ibm.ws.rsadapter.spi.WSDefaultConnectionManage rImpl.allocateConnection(WSDefaultConnectionManage rImpl.jav

    a:81)

    at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConn ection(WSJdbcDataSource.java:431)

    at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConn ection(WSJdbcDataSource.java:400)

    at websphere.WebsphereDataSource.main(WebsphereDataSo urce.java:33)



    please revert me the possible solutions.



    Thanks and Regards

  2. Re: Accessing Websphere 6.1 DataSource From Stand Alone Java ClientApplication

    peram.ramakrishnareddy@tcs.com wrote:
    > Hi,

    > I was connecting the database with the help of Websphere 6.1 server DataSource. It was getting the DataSource fine, but while getting the Connection from DataSource, it was getting the problem. I was given the following jars in the classpath

    >

    > bootstrap.jar

    > com.ibm.ws.admin.client_6.1.0.jar

    > com.ibm.ws.emf_2.1.0.jar

    > com.ibm.ws.runtime_6.1.0.jar

    > implfactory.jar

    > j2ee.jar

    > lmproxy.jar

    > ojdbc14.jar

    > rsadbutils.jar

    > rsahelpers.jar

    > rssutils.jar

    > sas.client.props

    > urlprotocols.jar

    >

    > Here i am attaching the Code Snippet.

    > public static void main(String[] args){

    > try{

    > Properties prop = new Properties();

    > prop.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory");

    > prop.put(Context.PROVIDER_URL,"iiop://localhost:2809");

    > InitialContext init = new InitialContext(prop);

    > DataSource source = (DataSource)init.lookup("WMPDS");

    > //Connection con = source.getConnection("CFEWS","CFEWS");

    > Connection con = source.getConnection();

    > PreparedStatement pstmt = con.prepareStatement("select * from customer_details");

    > ResultSet rs = pstmt.executeQuery();

    > }catch(Exception e)

    > {

    > e.printStackTrace();

    > }

    > }

    >

    > in this Code if i send source.getConnection(userid, password) it was getting the connection fine, if i access thru source.getConnection(); it was throwing an Error.

    >

    > With the Websphere DataSource we already configured the Userid and password, why it was not acessing, i was unable to understand the issue. I tried by including all the jars and properties of "setupCmdLine.bat". even it was giving the same problem.

    >

    > Here i am pasting the Error

    > ============================

    > Mar 25, 2008 4:08:22 PM com.ibm.ws.util.ImplFactory

    > WARNING: WSVR0072W

    > java.sql.SQLException: invalid arguments in callDSRA0010E: SQL State = null, Error Code = 17,433

    > at oracle.jdbc.driver.DatabaseError.throwSqlException (DatabaseError.java:125)

    > at oracle.jdbc.driver.DatabaseError.throwSqlException (DatabaseError.java:162)

    > at oracle.jdbc.driver.DatabaseError.throwSqlException (DatabaseError.java:227)

    > at oracle.jdbc.driver.T4CConnection.logon(T4CConnecti on.java:197)

    > at oracle.jdbc.driver.PhysicalConnection.<init>(Physi calConnection.java:344)

    > at oracle.jdbc.driver.T4CConnection.<init>(T4CConnect ion.java:148)

    > at oracle.jdbc.driver.T4CDriverExtension.getConnectio n(T4CDriverExtension.java:32)

    > at oracle.jdbc.driver.OracleDriver.connect(OracleDriv er.java:545)

    > at oracle.jdbc.pool.OracleDataSource.getConnection(Or acleDataSource.java:194)

    > at oracle.jdbc.pool.OracleConnectionPoolDataSource.ge tPhysicalConnection(OracleConnectionPoolDataSource .java:109

    > )

    > at oracle.jdbc.pool.OracleConnectionPoolDataSource.ge tPooledConnection(OracleConnectionPoolDataSource.j ava:77)

    > at oracle.jdbc.pool.OracleConnectionPoolDataSource.ge tPooledConnection(OracleConnectionPoolDataSource.j ava:59)

    > at com.ibm.ws.rsadapter.spi.InternalGenericDataStoreH elper$1.run(InternalGenericDataStoreHelper.java:89 7)

    > at com.ibm.ws.security.util.AccessController.doPrivil eged(AccessController.java:118)

    > at com.ibm.ws.rsadapter.spi.InternalGenericDataStoreH elper.getPooledConnection(InternalGenericDataStore Helper.ja

    > va:892)

    > at com.ibm.ws.rsadapter.spi.WSRdbDataSource.getPooled Connection(WSRdbDataSource.java:1180)

    > at com.ibm.ws.rsadapter.spi.WSManagedConnectionFactor yImpl.createManagedConnection(WSManagedConnectionF actoryImp

    > l.java:1047)

    > at com.ibm.ws.rsadapter.spi.WSDefaultConnectionManage rImpl.allocateConnection(WSDefaultConnectionManage rImpl.jav

    > a:81)

    > at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConn ection(WSJdbcDataSource.java:431)

    > at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConn ection(WSJdbcDataSource.java:400)

    > at websphere.WebsphereDataSource.main(WebsphereDataSo urce.java:33)

    >

    > please revert me the possible solutions.

    >

    > Thanks and Regards


    I'm not certain that it's valid to use a DataSource from outside WAS but using
    credentials configured inside WAS. That would allow any process from anywhere
    to use your database connection and its credentials. Assigning the
    credentials inside WAS may only work for processes/entities running inside of
    WAS where an administrator has explicit control over authorized usage.

    --
    Doug

  3. Re: Accessing Websphere 6.1 DataSource From Stand Alone Java ClientApplication

    Any update on this??? I'm facing the same issue... It does not make sense to provide username, password to get the connection.

  4. Re: Accessing Websphere 6.1 DataSource From Stand Alone Java ClientApplication

    hi ,
    I am running into the same problem and have the same requirement. Any luck trying to figure out a way to do a JNDI JDBC lookup from WebpShere APp. client.

  5. Re: Accessing Websphere 6.1 DataSource From Stand Alone Java ClientApplication

    I am running into the same problem and have the same requirement. Any luck trying to figure out a way to do a JNDI JDBC lookup from WebpShere APp. client.

    Again, I think it would be unsafe to allow an external client to use a WAS DataSource without having to provide the database credentials.

    But are you saying you can't do the JNDI lookup at all, or that you can't connect without passing credentials?

  6. Re: Accessing Websphere 6.1 DataSource From Stand Alone Java ClientApplication

    Thanks for getting back. I can do a lookup but fails while getting the connection from DataSource.
    Error message "Caused by:
    java.sql.SQLException: Invalid argument(s) in callDSRA0010E: SQL State = null, Error Code = 17,068"

    My need is to find a way to connect to a Datasource from a standalone J2EE client, so I dont have to maintain the db. details in more than one location.

  7. Re: Accessing Websphere 6.1 DataSource From Stand Alone Java ClientApplica

    Hi i too have the same problem. any solution for this...

+ Reply to Thread