• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Oracle10gDataStoreHelper

 
Ranch Hand
Posts: 186
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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


 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 186
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Anand,

Thanks for the reply.


Regards,
Vijay
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
*/

}

}
 
reply
    Bookmark Topic Watch Topic
  • New Topic