Retrieve db connection using datasource object

The problem is: i can't retrieve the connection to database
using datasource object in jsp.
my jsp was build by Oracle9i Report Builder,then deployed
to OC4J jsp container,
i define the datasource at container level,
but an error "log on not specified" arise.
is it possible to use datasource object in such a way or not?
thanks you for your help.

What is the full Java and os versions you are using to compile and to run. Note that with JDEV the platform used for your code may be different than the platform used by JDEV itself.
Please modify all of your exception handlers to print the stack trace. Add this as the first line in each handler.
ex.printStackTrace();The stacktrace contains important information about where the problem really occured.
See the Java docs for NamingException - http://docs.oracle.com/javase/6/docs/api/javax/naming/NamingException.html
>
This is the superclass of all exceptions thrown by operations in the Context and DirContext interfaces. The nature of the failure is described by the name of the subclass. This exception captures the information pinpointing where the operation failed, such as where resolution last proceeded to.
•Resolved Name. Portion of name that has been resolved.
•Resolved Object. Object to which resolution of name proceeded.
•Remaining Name. Portion of name that has not been resolved.
•Explanation. Detail explaining why name resolution failed.
•Root Exception. The exception that caused this naming exception to be thrown.

Similar Messages

  • Help me understand JDBC connections using DataSource objects

    I'm writing a simple Java server application that accepts connections from multiple clients via RMI, connects to a SQL Server 2000 database via Microsoft's SQL 2000 JDBC driver, gets some data, and returns it to the client. The server application will handle every SQL database connection. However, it must be able to establish multiple simultaneous connections, since multiple clients may connect at the same time and request data.
    Sounds like a simple multi-threaded server that utilizes a connection pool for database connectivity, right? Well, if I want to do that, I have to register a PooledDataSource object with JNDI. My server threads that are handling requests will simply grab connections out of the pool to retrieve data (presumably).
    This seems like a fairly simple server application; however, all the information and tutorials I've read on using DataSource objects for database connections rather than DriverManager.getConnection() mention XML config files, J2EE application servers, Tomcat, WebSphere, etc. I really don't want to have to deal with all that just to get connection pooling and not have to use the DriverManager.getConnection() method.
    Is there a simple way to use DataSource objects without installing a lot of extra junk on my server?

    Thanks, diazlara. Your response was exactly what I needed to know. All the information I've read prior to this suggested that I had to have a J2EE server running, and that I had to register the DataSource object with JNDI. If you ladies and gents could take a quick look at this and let me know if I'm doing it correctly, I'd appreciate it.
    As proflux suggested, I wrote a connection manager:
    import java.sql.*;
    import javax.sql.*;
    import com.microsoft.jdbcx.sqlserver.*;
    public class SQLConnectionManager {
       private static ConnectionPoolDataSource connectionPool;
       // Initialize the connection manager
       public SQLConnectionManager() {
          init();
       // Retrieve a connection from the connection pool and return it
       public static Connection getConnection() {
          Connection connection = null;
          try {
             connection = connectionPool.getPooledConnection("myUsername", "myPassword").getConnection();
          catch (SQLException ex) {
             System.err.println("A problem occurred while getting a connection from the pool.");
             ex.printStackTrace();
          return connection;
       // Initialize the datasource and connection pool
       private static void init() {
          SQLServerDataSource mds = new SQLServerDataSource();
          mds.setDescription("MS SQLServerDataSource");
          mds.setServerName("127.0.0.1");
          mds.setPortNumber(1433);
          mds.setDatabaseName("SomeTable");
          mds.setSelectMethod("cursor");
          connectionPool = (ConnectionPoolDataSource) mds;
    }As you can see, I'm hard-coding the username and password for testing purposes. I'll incorporate a login/authentication system for any production code that I use this in.
    Once the SQLConnectionManager is created, connections can be retrieved as follows:
          Connection connection = null;
          try {
             connection = SQLConnectionManager.getConnection();
             System.out.println("** Got a SQL database connection from the pool");
             DatabaseMetaData metaData = connection.getMetaData();
             ResultSet rs = metaData.getCatalogs();
             while (rs.next()) {
                System.out.println("\tcatalog: " + rs.getString(1));
             rs.close();
             connection.close();
          catch (SQLException ex) {
             System.out.println("An exception occurred while connecting to the SQL Database:");
             ex.printStackTrace();
          }So, how does that look? I tested it out, and it seems to work just fine. Using this code, I am getting a connection from a pool, correct? I want to make sure of that. Also, are there any inherent weaknesses or flaws with this method that I need to be aware of?
    Thanks so much for all the helpful responses.

  • Using DataSource object

    Hi,
    how can I connect to a database using a javax.sql.DataSource??
    how can I obtain a javax.sql.DataSource object??
    Do I need to implement the javax.sql.DataSource to get a connection through it??
    thanks,
    Roger Silva

    DataSource implementations are numerous, but one that I can recommend (and use) is Tyrex. Tyrex comes with Tomcat4.x. See www.tyrex.org.
    Typically a DataSource instance is obtained by calling JNDI which calls a factory that creates a DataSource implementation and configures it from some configuration source. In the case of Tomcat db details are obtained from a resource reference in its configuration xml file.
    If you know the package (or can get hold of source that shows how to initialise it) then you can create the DataSource instance yourself.
    For example using Tyrex you can do the following to get a Connection Pooling instance:
    EnabledDataSource ds = new EnabledDataSource();
    ds.setDescription(..);
    ds.setLoginTimeout(..);
    ds.setUser(..);
    ds.setPassword(..);
    ds.setDriverName(..);
    ds.setDriverClassName(..);
    ServerDataSource sds = new ServerDataSource((javax.sql.XADataSource) ds);Dave

  • Trying To make DB connection using DataSource

    Hi ,
    I am working on Jdev 11g . Getting exception while trying to execute below code:
    import java.sql.*;
    import java.util.Hashtable;
    import javax.naming.*;
    import javax.sql.*;
    final class GetConnection {
    /** Uses JNDI and Datasource (preferred style). */
    static Connection getJNDIConnection(){
    // String DATASOURCE_CONTEXT = "java:comp/env/jdbc/blah";
    String DATASOURCE_CONTEXT = "JNDIDataSource-0";
    // String DATASOURCE_CONTEXT = "TESTJNDI_CONN";
    System.out.println("Control till here :1");
    Connection result = null;
    try {
    Context initialContext = new InitialContext();
    if ( initialContext == null){
    System.out.println("JNDI problem. Cannot get InitialContext.");
    System.out.println("Control till here :2");
    Hashtable<String, String> table = new Hashtable<String, String>();
    System.out.println("Here");
    table.put(Context.INITIAL_CONTEXT_FACTORY,
    "weblogic.jndi.WLInitialContextFactory");
    System.out.println("Control till here :3");
    table.put(Context.PROVIDER_URL, "hostName");
    System.out.println("Control till here :4");
    table.put(Context.SECURITY_PRINCIPAL, "weblogic");
    System.out.println("Control till here :5");
    table.put(Context.SECURITY_CREDENTIALS, "weblogic123");
    System.out.println("Control till here :6");
    initialContext = new InitialContext(table);
    System.out.println("Control till here :7");
    initialContext = new InitialContext(table);
    System.out.println("Control till here :8");
    DataSource datasource = (DataSource)initialContext.lookup(DATASOURCE_CONTEXT);
    DataSource source = (DataSource)new InitialContext().lookup("DataSource");
    // result = source.getConnection();
    System.out.println("Control till here :9");
    if (datasource != null) {
    System.out.println("Control till here :3");
    result = datasource.getConnection();
    System.out.println("Control till here :4");
    else {
    System.out.println("Failed to lookup datasource.");
    catch ( NamingException ex ) {
    System.out.println("Cannot get connection: 1" + ex);
    catch(SQLException ex){
    System.out.println("Cannot get connection: 2" + ex);
    return result;
    public static void main(String[] args) throws Exception {
    //WBSCallingProc WbsProc = new WBSCallingProc();
    String returnValue;
    GetConnection getConnection = new GetConnection();
    // returnValue =home.callingProcedure();
    Connection returnValue1 =getConnection.getJNDIConnection();
    System.out.println("returnValue1 " + returnValue1);
    Log
    Control till here :1
    Control till here :2
    Here
    Control till here :3
    Control till here :4
    Control till here :5
    Control till here :6
    Cannot get connection: 1javax.naming.NamingException: String index out of range: -1
    returnValue1 null
    Can anyone please help me here.Many Thanks.
    Regards
    Kumar

    What is the full Java and os versions you are using to compile and to run. Note that with JDEV the platform used for your code may be different than the platform used by JDEV itself.
    Please modify all of your exception handlers to print the stack trace. Add this as the first line in each handler.
    ex.printStackTrace();The stacktrace contains important information about where the problem really occured.
    See the Java docs for NamingException - http://docs.oracle.com/javase/6/docs/api/javax/naming/NamingException.html
    >
    This is the superclass of all exceptions thrown by operations in the Context and DirContext interfaces. The nature of the failure is described by the name of the subclass. This exception captures the information pinpointing where the operation failed, such as where resolution last proceeded to.
    •Resolved Name. Portion of name that has been resolved.
    •Resolved Object. Object to which resolution of name proceeded.
    •Remaining Name. Portion of name that has not been resolved.
    •Explanation. Detail explaining why name resolution failed.
    •Root Exception. The exception that caused this naming exception to be thrown.

  • Retrieving JDBC connection from datasource in JAAS login module

    Hi,
    I have a custom JAAS login module which calls a DAO for accessing user login details. The DAO looks up the datasource to retrieve connections from when the LoginModule is initialized. The datasource is simply defined through the admin interface. When a user tries to login (through the web container) an exception is thrown as shown below:
    com.sun.enterprise.InvocationException
         at com.sun.enterprise.resource.PoolManagerImpl.getResource(PoolManagerImpl.java:134)
         at com.sun.enterprise.resource.JdbcDataSource.internalGetConnection(JdbcDataSource.java:241)
         at com.sun.enterprise.resource.JdbcDataSource.getConnection(JdbcDataSource.java:154)
         at com.dmdsecure.mobile.security.store.impl.JDBCUserStore.fetchUser(JDBCUserStore.java:330)
         at com.dmdsecure.mobile.security.impl.LocalUserManager.authenticate(LocalUserManager.java:70)
         at com.dmdsecure.mobile.security.adapter.sunone.DMDLoginModule.authenticate(DMDLoginModule.java:66)
         at com.dmdsecure.mobile.security.adapter.sunone.DMDLoginModule.authenticate(DMDLoginModule.java:38)
         at com.iplanet.ias.security.auth.login.PasswordLoginModule.login(PasswordLoginModule.java:163)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at javax.security.auth.login.LoginContext.invoke(LoginContext.java:675)
         at javax.security.auth.login.LoginContext.access$000(LoginContext.java:129)
         at javax.security.auth.login.LoginContext$4.run(LoginContext.java:610)
         at java.security.AccessController.doPrivileged(Native Method)
         at javax.security.auth.login.LoginContext.invokeModule(LoginContext.java:607)
         at javax.security.auth.login.LoginContext.login(LoginContext.java:534)
         at com.sun.enterprise.security.auth.LoginContextDriver.doPasswordLogin(LoginContextDriver.java:382)
         at com.sun.enterprise.security.auth.LoginContextDriver.login(LoginContextDriver.java:307)
         at com.sun.enterprise.security.auth.LoginContextDriver.login(LoginContextDriver.java:116)
         at com.sun.web.security.RealmAdapter.authenticate(RealmAdapter.java:201)
         at com.sun.web.security.RealmAdapter.authenticate(RealmAdapter.java:140)
         at org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthenticator.java:263)
         at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:492)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:496)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:203)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
         at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:157)
         at com.iplanet.ias.web.WebContainer.service(WebContainer.java:598)
    It seems the datasource is valid but trying to retrieve connections from it will fail.
    Anyone had any similar problems??

    Nope, sorry ... I am also having other troubles with JNDI lookups, this time from within the init method of a filter ... Seems there may still be some issues here for Sun to iron out ...
    -Johan

  • Toplink fails to connect using Datasource

    I'm deploying an EJB project using Toplink persistence to Oracle AS 10.1.3.1 and have defined a datasource/connection pool as:
    <managed-data-source name="OAS_Oracle_Datasource"
    connection-pool-name="My_Connection_Pool"
    jndi-name="jdbc/OAS_Oracle_Datasource"/>
    <connection-pool
         name="My_Connection_Pool"
         min-connections="3"
         max-connections="10">
    <connection-factory factory-class="oracle.jdbc.pool.OracleDataSource"
    user="joeuser"
    password="joepasswd"
    url="jdbc:oracle:thin:@dbserver:dev01">
    </connection-factory>
    </connection-pool>
    Once deployed I can test the datasource/connection pool successfully from the admin GUI. I can also access the database from an external client using the same connection parameters. However, I see this stack trace in log.xml:
    Exception [TOPLINK-4002] (TopLink (Oracle OC4J CMP) - 10g Release 3 (10.1.3.1.0) (Build 061004)): oracle.toplink.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: Io exception: The Network Adapter could not establish the connectionError Code: 17002
         at oracle.toplink.exceptions.DatabaseException.sqlException(DatabaseException.java:276)
         at oracle.toplink.internal.ejb.cmp.oc4j.Oc4jNonJtaConnector.connect(Oc4jNonJtaConnector.java:49)
         at oracle.toplink.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:147)
    <SNIP>
         at java.lang.Thread.run(Thread.java:595)
    Caused by: java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:138)
    <SNIP>
         at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:608)
         at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:218)
         at oracle.jdbc.pool.OracleConnectionPoolDataSource.getPhysicalConnection(OracleConnectionPoolDataSource.java:114)
    <SNIP>
         at oracle.oc4j.sql.ManagedDataSource.getConnection(ManagedDataSource.java:197)
         at oracle.oc4j.sql.ManagedDataSource.getNonTransactionalConnection(ManagedDataSource.java:167)
         at oracle.oc4j.sql.ManagedDataSource.getNonTransactionalConnection(ManagedDataSource.java:153)
         at oracle.toplink.internal.ejb.cmp.oc4j.Oc4jNonJtaConnector.connect(Oc4jNonJtaConnector.java:44)
         ... 27 more
    Anyone run into this problem? If so please share your fix.
    Thanks,
    Gerald

    OK, a little more light shines on this mystery...
    It turns out that the deployer-generated orion-ejb-jar.xml was using a data-source attribute pointing at the jdbc/OracleDS datasource in the default application, which OAS creates during install. Of course this wasn't set to anything in particular, and if Toplink is using this behind the scenes it wouldn't connect.
    Now the question is how do I get my datasource stuffed into the auto-generated orion-ejb-jar.xml data-source? Would be nice if there was a way to specify some Toplink datasource property in the orion-ejb-jar.xml before it gets processed by the deployer into its eventual resting place under application-deplyments.
    Gerald

  • Connection through Datasource

    hi..
    i need help to create connection using DataSource in my Desktop Application(Swing)..
    i am using mysql5.0 and jdk1.6.
    Thanks And Regards
    fun_with_me

    Try:
    String port = "xxxx", // You fill in
           sid  = "mysql";
    Class.forName( "com.mysql.jdbc.Driver" );
    URL url = "jdbc:mysql://localhost:"+port+"/"+sid;
    Connection con = DriverManager.getConnection( url, uid, pwd );  // uid and pwd passed in

  • How to retrieve a Connection Pool name form a DataSource

    I couldn't find a way of retrieving JDBC Connection Pool name (or JDBCConnectionPoolRuntimeMBean
    object) from a DataSource object.
    I use the standard approach to get a Datasource:
    Context ctx = null;
    Hashtable ht = new Hashtable();
    ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
    ht.put(Context.PROVIDER_URL, sJndiUrl);
    ctx = new InitialContext(ht);
    dataSource = (javax.sql.DataSource) ctx.lookup (s);
    It works fine !
    I know that each datasource is mapped to a connection pool & need to retrieve
    either connection pool's name or JDBCConnectionPoolRuntimeMBean object from the
    datasource, but didn't find any function that would allow me to do that.

    "Oleg Gryb" <[email protected]> wrote:
    >
    I couldn't find a way of retrieving JDBC Connection Pool name (or JDBCConnectionPoolRuntimeMBean
    object) from a DataSource object.
    I've just found a solution for that, but didn't like it too much because it uses
    undocumented class & function. Probably BEA should include the documentation for
    weblogic.jdbc.common.internal.RmiDataSource or provide an alternative way of getting
    JDBCConnectionPoolRuntimeMBean object from a datasource. The solution is below:
    RmiDataSource dataSource = (RmiDataSource) ctx.lookup (s);
    Properties propDs = dataSource.getDriverProperties();
    String sPoolName = propDs.getProperty("connectionPoolID");
    MBeanHome mbeanAdmin = (MBeanHome)ctx.lookup(MBeanHome.LOCAL_JNDI_NAME);
    JDBCConnectionPoolRuntimeMBean jdbcPool = (JDBCConnectionPoolRuntimeMBean)
    mbeanAdmin.getRuntimeMBean(sPool,"JDBCConnectionPoolRuntime");
    Now I have JDBCConnectionPoolRuntimeMBean object that I can use to access different
    kind of pool's counts, e.g. number of current connections, number of leaked connections,
    etc. I need this information to monitor pool programmatically & send alerts to
    a suport team if e.g. number of active connections reaches a certain threshold.
    If there is a better way of doing this please let me know.
    Please also notice that I don't want an application to know anything about the
    Connection Pool being used, an application should know only about a datasource.
    Thanks.

  • Using datasource for connection

    What is the diffrence in getting connection using a datasource instead of programatic access to a database........???
    programatic access
    DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
    connect =DriverManager.getConnection ("jdbc:oracle:thin:@//host_ip/orcl.oracle.com%","user","password");
    // @machineName:port:SID, userid, password
    is there diffrence in these approch??
    Message was edited by:
    UDAY

    Functionally, there is no difference. Both return exactly the same object.
    Practically, the major difference lies in where the connection information is defined. A DataSource is typically be registered with a JNDI naming service, which means that it is configured centrally. This makes it much easier to adjust settings when databases move-- if the IP address of the database server changes, it's a heck of a lot easier to adjust the app server's JNDI settings once than to find every class that has the settings hard-coded. From a security standpoint, it's also a lot easier to hide the middle tier account's password from developers (and CVS trees) by letting the app server store it securely in the JNDI service.
    Justin

  • When is it appropriate to use DataSource (or Connection pooling)?

    Hello all,
    I'm having some design issues with my application and I'm starting to think that maybe using Connection pooling is not suited for my application. I'm using Tomcat 5.5.12 if it's any relevant..
    The architecture of our application looks like this:
    Servlets -> App Helper classes -> DB/Accessor classes
    looks like the three-tier architecture described in this document: http://www.subrahmanyam.com/articles/servlets/ServletIssues.html
    I have read on the Tomcat docs that said that using DataSource is good practice and improves efficiency since it recycles database connections. However, if the accessor/DB classes are not servlets, how can I use the DataSource facility that interacts with Tomcat?
    I would like to know whether it is a good idea to use DataSource in my case and if so, how? (since they are not servlets)
    Thanks in advance :)

    Hi. Thank you for replying.
    In the examples that I've seen that use JNDI for Database access, it seems that DataSource is always used--in other words, JNDI and DataSource always seem to be used together (in Servlets). I have not found a case where JNDI is used by itself to access the Database--perhaps I'm not looking in the right place. Could you point me to some documentation maybe?
    Thanks a lot!

  • How to use datasources to connect to database ?

    I have the following Problem
    I have two identical databases, one is the development database, the other one the production database.
    Now I need to find a way, how I can deploy an bc4j-application in local mode that way, that if the application is deployed to server 1 it connects to database 1 and if deployed to server 2 it connects to database 2.
    JDBC connection strings do not work as the connection is deployed with the application. So the application always connects to the same database.
    I thought datasources might be the solution. So I tried to define a datasource MyDS in the data-sources.xml file and specified it in the Configuration Wizard as the connection to use.
    But unfortunately this does not work and i do not know why:
    If I try to connect using the tester and using this datasource I get the following exception:
    Level #3: javax.naming.noInitialContextException
    Can anyone help me, what this means? How can I get around this using the BC4J Framework? Is there any "HowTo" Document which describes using datasources with BC4J?

    Frank,
    I've sorted this stuff out to some extent. Have a look at this thread:
    re:? How: multiple myAppWar.ear to use OC4J's data-sources.xml pooling?
    If this isn't all you need, then search on data-source.xml
    and read other threads also I may have posted helps on
    other threads so if you search on data-source.xml and my handle (curt504) it brings up all the threads that I posted to.
    Not to say I've solved all your problems, but I solved mine anyway. :)
    Good luck,
    curt

  • CANT CONNECT TO DB USING DATASOURCE ON J2ME PERSONAL PROFILE

    Having installed the optional JDBC package for J2ME and using the personal profile. I cant seem to connect using a datasource provided by HSQLDB. I keep getting the following error in WSDD:
    This compilation unit indirectly references the missing type javax.naming.Referenceable (typically some required class file is referencing a type outside the classpath)
    My classpath contains the database.jar file.
    Where am I going wrong?
    please please could some one help.
    Thanks

    Just a guess according to my Personal Java experience: maybe that optional JDBC package for J2ME is only JDBC1.2 compatible so that your should use HSQLDB JDB1.2 package? Thanks for correction.

  • Connecting to IPCC DB (db_cra) using Business Objects

    Hi,
    I've been tasked with creating a Business Objects universe against a CISCO IPCC SQL Server database (db_cra), and I have no knowledge of the database and how the system works.  I also don't have access to the database outside of Crystal Reports.  I can connect through CR with the instructions provided by CISCO and using an OLE DB (ADO) connection, and there's also a launchHRC executable that was added to the crw32.exe shortcut.  The OLE DB (ADO) connection has Integrated Security checked, so I have no idea how I'm able to connect to the database and tables without being added to database security.
    Business Objects does not have an option for creating an OLE DB (ADO) connection.  I have no idea if it's even possible to connect to the database.  Normally we have a default reporting user that's used to set up OLE DB and ODBC universe connections using SQL authentication.
    And from what my colleague in Japan told me, it's not possible to add users to the db_cra database security.
    If there's any information that you could provide it would be greatly appreciated   I'm really lost with this one so any help or advice would be great.
    Thank you!!
    Kevin V.

    Hi
    It's best to specify product (UCCE, UCCX) and version when posting.
    If you are UCCX v7.0 or lower, then see this : https://supportforums.cisco.com/thread/272601
    The trick is to set up the account on the server with rights to the DB, and use the windows pass through auth method to access the DB using integrated security (as SQL auth is disabled by default).
    If on 8.0 or higher it's different as you're in informix land, and need to set up and use the uccxhruser account.
    Regards
    Aaron

  • Using Datasource in OC4J  to connect to 9iDb(ArrayIndexOutOfBoundsException

    Hi all,
    I've been encountering a certain ArrayIndexOutOfBoundsException when attempting to connect to Oracle 9i
    via a defined datasource.
    I've taken the following troubleshooting steps but to no avail:
    1. Verified username and password
    2. Verified URL by having a test class to establish a direct connection using this URL
    3. Verified that both classes12.jar and ocrs12.jar are defined in the classpath
    3. Updated classes12.jar and ocrs12.jar from the OTN to copies stipulated to be compliant with 9.2.0.1
    (this was based on a post on the net with reference to similar error messages:http://www.orafaq.net/msgboard/java/messages/1488.htm)
    It would be great if anyone could have some input on this problem.
    Thanks!
    WK
    My development environment:
    Oracle Database 9.2.0.1
    oc4j
    The following configuration and code snippets are provided for reference:
    data-sources.xml
         <data-source
              class="com.evermind.sql.DriverManagerDataSource"
              name="OraclePool"
              location="jdbc/OracleCoreDS"
              xa-location="jdbc/xa/OracleXADS"
              ejb-location="jdbc/OracleDS"
              connection-driver="oracle.jdbc.driver.OracleDriver"
              username="USER"
              password="PASSWORD"
              inactivity-timeout="30"
              url="jdbc:oracle:thin:@localhost:1521:OracleDb"
    />
    Client Code:
    InitialContext ic = new InitialContext();
    DataSource ds = (DataSource)ic.lookup("jdbc/OracleDS");
    Connection conn = ds.getConnection();
    Statement stmt = conn.createStatement();
    String strQuery = "SELECT id FROM TBL_PART";
    ResultSet rset = stmt.executeQuery (strQuery);
    Error:
    java.lang.ArrayIndexOutOfBoundsException
         at oracle.security.o3logon.C1.r(C1)
         at oracle.security.o3logon.C1.l(C1)
         at oracle.security.o3logon.C0.c(C0)
         at oracle.security.o3logon.O3LoginClientHelper.getEPasswd(O3LoginClientHelper)
         at oracle.jdbc.ttc7.O3log.<init>(O3log.java:290)
         at oracle.jdbc.ttc7.TTC7Protocol.logon(TTC7Protocol.java:251)
         at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:252)
         at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:365)
         at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:260)
         at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].sql.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:118)
         at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].sql.DriverManagerConnectionPoolDataSource.getPooledConnection(DriverManagerConnectionPoolDataSource.java:24)
         at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].sql.OrionPooledDataSource.getPooledConnection(OrionPooledDataSource.java:273)
         at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].sql.PooledConnectionUsage.getPooledConnection(PooledConnectionUsage.java:21)
         at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].sql.OrionPooledDataSource.getConnection(OrionPooledDataSource.java:145)
         at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].sql.DriverManagerXADataSource.getAutoCommitConnection(DriverManagerXADataSource.java:226)
         at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].sql.LogicalDriverManagerXAConnection.intercept(LogicalDriverManagerXAConnection.java:88)
         at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].sql.FilterConnection.createStatement(FilterConnection.java:324)
         at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].sql.FilterConnection.createStatement(FilterConnection.java:325)

    Hi WK,
    According to your stack trace, you are using a very old version of OC4J. I suggest updating to the latest, production version: 9.0.3
    Also, I seem to recall reading somewhere (I think it was in this forum), that "DataSource" is not serializable, and therefore cannot be transferred to the client.
    I use "DataSource" in my BMP entity beans to interact with the database -- this works fine. I have not tried getting a "DataSource" from a remote client, though.
    And also you may need to pass some "properties" to your "InitialContext" constructor -- depending on the type of client you are using (which I could not ascertain from your post).
    Hope this has helped you.
    Good Luck,
    Avi.

  • AJAX retrieval using Javascript Object Notation (JSON) - How To

    I have written up a how-to on my blog, explaining the steps involved to implement AJAX functionality using JSON for data transmission. It uses a simple example where the user makes a selection from a select list and 2 values are returned from the database into page items. I found it pretty simple to implement.
    http://anthonyrayner.blogspot.com/2007/06/ajax-retrieval-using-javascript-object.html
    Hope you like it, feedback welcome!!
    Anthony.

    Duplicate post.
    Yann C.
    France

Maybe you are looking for

  • Is there any other way to get Adobe Captivate help?

    Hi guys, is there any other way to get Adobe Captivate specific help? I've posted a question twice with no help, it's very specific, so no one here might actually know the solution. I'm wondering though, since the chat is obviously not for Captivate

  • Error -200 and no sound except start-up tone

    After playing sound over headset my macbook won't play any sounds except the start sound. Furthermore my Itunes won't start anymore and I've got the error -200 ... any help?

  • Invoice by IDOC

    Hi All, I am using standard IDOC (Process Code SD08/SD09) which uses FM IDOC_INPUT_INVOIC_MRM to post the incoming invoice against a STO. This FM however, posts the entire price on th GR/IR account and does not recognize purchase price variance. We n

  • What are the disadvantages of ATG Scenarios

    HI Everyone, I wanted to use ATG scenarios . Please let me know the Drawbacks of ATG scenarios. Our requirement is to use for AB Test(split test) for the two different shopping cart pages and we want to update the scenarios in production now and then

  • Error message 1161, tried all recommended solutions by Apple.

    Error message 1161, tried all recommended solutions by Apple. For about 3 weeks, my iPod would retain charge when plugged in, but wouldn't charge. Just today, I used it until the battery completely drained, and it started to restore when I plugged it