wood burning stoves 2.0*
The moose likes Websphere and the fly likes Oracle10gDataStoreHelper Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "Oracle10gDataStoreHelper" Watch "Oracle10gDataStoreHelper" New topic
Author

Oracle10gDataStoreHelper

Vijay Chandran
Ranch Hand

Joined: Jan 07, 2007
Posts: 178
Dear friends,

I am trying to connect to Oracle 10g database through WebSphere 6.1 from a standalone Java application. This is the code:


When executing this code, i get the following exception. The following is the stacktrace:



I use: NetBeans IDE 6.5, IBM JRE 1.5.

JDBC Provider i configured in WAS 6.1 is: Oracle JDBC Provider (XA).


I am stuck here and cannot proceed further. Which JAR file contains the com.ibm.websphere.rsadapter.Oracle10gDataStoreHelper?
Kindly provide your help.

Regards,
Vijay


andyyy garcia
Greenhorn

Joined: Jan 23, 2009
Posts: 1
vijay,
its rsahelpers.jar. normally its under C:\Program Files\IBM\WebSphere\AppServer\lib.

This is Anand. I work with websphere server 6.1

let me know if you have any question regarding this server.

Anand

Vijay Chandran
Ranch Hand

Joined: Jan 07, 2007
Posts: 178
Anand,

Thanks for the reply.


Regards,
Vijay
SreeHarsha Kotturu
Greenhorn

Joined: Dec 04, 2011
Posts: 4
package com.test;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Hashtable;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;

public class DataSourceMainClass {

public static void main(String args[]) {

Context ctx;
try {

Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.ibm.websphere.naming.WsnInitialContextFactory");
// 2810
// corbaloc:iiop:localhost:2810
// CHECK the boot strap address 2809 or not in the server ports
// corbaloc:iiop:1.0@hp-pc:2809/NameService
// hp-PCNode02
// env.put(Context.PROVIDER_URL,
// "corbaloc:iiop:1.0@hp-pc:2810/NameService");
// env.put(Context.PROVIDER_URL, "corbaloc:iiop:1.0@hp-pc:2810");

ctx = new InitialContext(env);

System.out.println(" ctx::" + ctx);

DataSource ds = (DataSource) ctx.lookup("jdbc/MyOracleXEDBJNDI");


System.out.println(" dsss::;" + ds);

Connection con = ((DataSource) ds)
.getConnection("system", "system");
System.out.println(" CON:" + con);

if (con != null) {
System.out.println(" Conn is established ");

Statement stmt = con.createStatement();

String sql = "select * from testdate";

ResultSet rs = stmt.executeQuery(sql);

while (rs.next()) {

System.out.println(" result Set::" + rs.getInt("testid"));
}

}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (NamingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

/*
* STEPS TO ACCESS THE ORACLE XE CONNECTION OBJECT USING DATA SOURCE
*
* 1) LOGIN TO ADMIN CONSOLE 2) CREATE DATA SOURCE 3) CREATE DATA
* PROVIDER with a jnDi name (jdbc/MyOracleXEDBJNDI ) 4) PROVIDE THE USER ID & PASSWORD AS ALIAS NAMES
*
* 5) TEST THE CONNECTION FROM ADMIN CONSOLE 6) WRITE JAVA PROGRAM AND
* USING INITIAL LOOK UP OF WEBSPHERE URL 7) ADD
* com.ibm.ws.webservice.thinclient.jar ( from base v61 runtimes) 8) add
* rsahelpers.jar to external jars( C:program files\
* IBM\SDP\runtimes\base_v61\runtimes\lib) 9) change the scopes of
* datasource and data provider to " ALL SCOPES " 10) restart the server
* as well as scopes are changed 11) add client jar for Oracle xe data
* source ojdbc14.jar 12) get connection object by passing the userid
* and passwordas args to getconenction method.
*/

}

}
 
Don't get me started about those stupid light bulbs.
 
subject: Oracle10gDataStoreHelper