Datasource Connection

Hello, I'm tryng to write an application that must be connected to a database.
-In my EAR Project I declared a dataSource Alias (in <i>data-source-aliases.xml</i>).
-In my EJB Project in <i>ejb-jar.xml</i> (and in <i>ejb-j2ee-engine.xml</i> defining the JNDI name) I passed the dataSource alias (in reaource-ref folder).
But when I try to connect to the DB it doesn't work.
In my Java class I'm using:
<b><i>ctx = new InitialContext();
ds = (DataSource)ctx.lookup("jdbc/<DataSourceAlias>");</i></b>
Is this the right procedure or I'm missing something??
Another question: this application is a WebService, if I need to test can I use the WS Navigator's test in my Enterprice Portal??
Thank You in Advance

Check this thread: Web Dynpro | EJB | JNDI lookup
class loading Issue in EJB
This is tutorial for creating and using EJBs in Web Dynpro:
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/1f5f3366-0401-0010-d6b0-e85a49e93a5c
For your last question: You can use WS Navigator's test.
Regards,
Ashwani Kr Sharma

Similar Messages

  • Loosing datasource connection in a server thread

    Hi,
    In a backing bean I start a long term thread that uses the datasource connection taken from application module.
    Everything works fine but after a period of time between one and two hours the connection is lost and server throws a
    <BEA-001112> <Test "SELECT 1 FROM DUAL" set up for pool "AEE2010DS" failed with exception: "java.sql.SQLException: Connection Closed".>
    Is there any way to stop the server from closing the connection that is used in a separate thread, programmatically or using configuration?
    Any comment will be helpful,
    Thanks

    That looks like something external is killing the connection, either the DBMS or a firewall.

  • Error !! Cannot fetch a datasource connection

    I am a beginner in Oracle BPEL process Manager,
    i am experiencing the following error :
    After starting the BPEL PM server, i got the following in the Dos Window:
    " Message Handle error:
    An exception occurred while attempting to process the message "com.collaxa.cube.engine.dispatch.message.process.SetDbDefaultMessage."the exception is tranaction was rolledback........"
    then i tried also to open the BPEL console and i logged in , but i got
    "Cannot fetch a datasource connectionThe process domain was unable to establish a connection with the datasource with the connection URL "jdbc/BPELServerDataSource". The exception reported is: Internal Error:Invalid Connect String
    Please check that the machine hosting the datasource is physically connected to the network. Otherwise, check that the datasource connection parameters (user/password) is currently valid."
    What could be wrong !
    Please Help.
    Thanks in advance

    Hey Rana,
    in OC4J_BPEL container, that is located under $AS_HOME/j2ee go to the config directory and open data-sources.xml.
    it seems during installation you might have provided wrong information..
    could you pls paste it here, that we can figure out what's wrong..
    in what enviroment did this occur,
    thx clemens

  • Datasources connection questions

    hi all
    my question is about How the connections stored in a Jndi server datasource pool are managed.
    For example, I'm developing a J2EE application with Ejbs and Datasources, etc. I saw that when I want to retrieve a connection from datasource to work on it I need do something like this:
    For example to retrieve a datasource connection:
    Hashtable jndiProps = new Hashtable();
    jndiProps.put(Context.INITIAL_CONTEXT_FACTORY,...);
    jndiProps.put(Context.PROVIDER_URL, ...);
    Context context = new InitialContext(jndiProps);
    DataSource ds = (DataSource) context.lookup("jdbc/MyDatasource");
    Connection con = ds.getConnection();
    ...I know in this case that the server manages a datasource connection pool, etc
    My question is when a get a connection from the Datasource pool of my app server. do I need to release the connection with some special method when I finish with it (in order to return it to the pool) or it doesn't matter ?
    thanks in advance

    If I have three prepared statements right in a row with nothing in between should I close the connection after each one and then get it again?
    Seems like I would be just as well off to just get the conn once do the 3 things then close it.
    and in spots I might actually be doing something as i step through the first result set so can i use conn.preparedStatement() in the loop many times without getting the connection and closing each time through the loop?
    i of course close all PS and RS and use diff PS2 and RS2 in the loop so i 'm just talking about keeping the conn open while (RS.next()) and use it multiple times to conn.preparedStatement() inside the loop?
    or should i use 2 connections lol and open conn1 and then in loop use conn2 and close it each time around the loop and then close conn1 when i exit the loop?

  • EnvironmentException: -600: Could not retrieve a datasource connection

    Hi,
    I am getting below errors in my logs has anybody have any idea about below errors.
    0.4 IJFWK-302 itseelm-lx4065.xxx.com 2013-02-12 05:55:40 EBCCOP01 971 NA BsGetDeliveryMethods irwuser irwuser EBCCOM01 28442421A3EF52E9C8692AA9F19FFC42 37 <?xml version="1.0" encoding="UTF-8"?> <SystemError><Message>-302: Error caught while executing the business task. Marked transaction for rollback; nested exception is: com.xxx.xxxx1.util.exception.EnvironmentException: -600: Could not retrieve a datasource connection for user 'null'.; nested exception is: com.ibm.websphere.ce.cm.StaleConnectionException: The Network Adapter could not establish the connectionDSRA0010E: SQL State = 61000, Error Code = 20</Messa
    Thanks
    Edited by: Ramstimo on 15 Feb, 2013 9:34 AM
    Edited by: Ramstimo on 15 Feb, 2013 9:36 AM

    Hi,
    Can you paste the jdbc connection that you have used in your application code here?
    Regards,
    Kishore

  • Script for checking datasource connections

    Hi,
    I would like to find out if it's possible to monitor datasource connections using Unix based scripts and if so how can this be accomplished?
    Thank you in advance
    Twaggz

    Hi
    Thanks for the link however I was looking at enabling monitoring at an AIX level.

  • SSRS 2005 change datasource / Connection String

    Hi All
    I need to change the some shared data source on ssrs 2005 for the migration of some dbs.
    Can I do it on tsql, I need to update the datasource / Connection String only for the reports that uses it.
    How to change it on table : [ReportServer].[dbo].[DataSource] table. ?
    Thanks a lot in advance.

    It is not recommended to update records directly in Catalog table.
    You can try
    programmatic way to update that.
    SSRS is webservice so you have to use something like below.
    https://<<Report Server Name>>/ReportServer/ReportService2005.asmx
    Make sure you do BACKUP database before doing any changes.
    Regards,
    Vishal Patel
    Blog: http://vspatel.co.uk
    Site: http://lehrity.com

  • Infosource and datasource connection

    Hi Experts,
    In the BI 3.5 business content, what is the best way to decide which datasource connects to which infosource? For example if i were to install BI content for SD i have about 8 datasources and 20 infosources and 6 cubes only.
    How can i setup a dataflow based on Bi content only?
    Should i make a decision based on the fields i am interested in? Please educate me on this.
    Thanks
    K

    Hi Krishna,
    Go to RSA1--->, right mouse show data flow you can double click the elements.
    On the Source systems you can see the relation between DS and IS.
    Also try table RSOLTPSOURCE - field OLTPSOURCE for datasource,field BASOSOURCE for infosource.using 'show data flow' as mentioned, click 'technical name on/off' to have the technical name displayed.
    hope this helps.
    Regards
    CSM Reddy

  • DataSource & Connection pools

    Hi,
    I have a couple of question about DataSources and connection pools.
    1. Are DataSources & connection pools the same thing?
    2. Typically the data-sources.xml file, shows in plain text a user/name password combination. Isn't this a security risk? Can anything be done about this?
    thanks in advance,
    Kevin

    Hi Kevin --
    1. Are DataSources & connection pools the same thing?
    A DataSource enables the clean abstraction of the database connection details from the code.
    A DataSource has a name, and it provides you with access to connections via some configuration information it has (ie database host, port, sid, username/password). To get a connection, you first locate the datasource, and then ask it for a connection.
    Since the DataSource is now providing access to connections, you can get different types of DataSources that give you different behaviour. One example of this is a DataSource which supports connection pooling -- it will pool the connections for you. Some other datasources will support the use of container-managed-connections, which are used by EJB containers to support CMT.
    So while a DataSource can support connection pooling, the two are not synonomous.
    2. Typically the data-sources.xml file, shows in plain text a user/name password combination. Isn't this a security risk? Can anything be done about this?
    In the current production version and prior, the data-sources.xml file stored details in clear-text. Besides ensuring that the file has the correct level of OS priviliges set on it to ensure it can't be easily viewed, the only other workaround was to specify the username/password as parameters to the ds.getConnection() method. This puts the username/password back into the code so it breaks the concept of clean abstraction, but it was an option to avoid it being in the xml file.
    In our 904 release (available as a dev preview now on OTN) we support the use of password indirection for the passwords in this file. This enables you to specify a logcal name for a password, then create the actual user/password combination in our encrypted JAZN user repository. When the datasource is used, the container follows the indirection and retrives the password from the encrypted storage area.
    I'm pretty sure this is documented in the beta version of 904 J2EE Services Guide, see
    http://otn.oracle.com/tech/java/oc4j/904/doc_library/services-904-preview.pdf
    cheers
    -steve-

  • How to remove unused datasource connections in Report Builder 3

    In Report Builder 3.0 using a wizard to create a new Report, select create a DataSet. It opens a "Choose a connection to a datasource" dialog box. It shows previously used datasource connections of other ReportSevers I have accessed long
    time back. But I dont want to see datasource connection not in use. How can I remove those datasource connections used in past but they are still available in the list.  

    Hi Saty
    You can find more information about Remove previously used datasource connections.
    http://connect.microsoft.com/SQLServer/feedback/details/679232/cannot-remove-old-unusable-data-source-connections-from-report-builder-3-0-wizard-dialog
    SUHAS http://suhaskudekar.blogspot.com/ Please click "Mark as Answer" if this resolves your problem or "Vote as Helpful" if you find it helpful.

  • Test SSRS DataSource Connection Programtically

    Hi, Dear
    I have created a SSRS Datasource programatically.
    I also would like to Test this SSRS Datasource Connection programatically.
    But it seems no API to do that.
    Is there a way to do it programatically?
    Regards
    Ming

    Hi Jiulidaji,
    According to your description, you want to test the SSRS Data Source Connection programmatically. Right?
    In program design, generally we create a separated class/function for database connection. If we want to test the connection, we just need to test this class/function only. For testing the connection, we can directly output/print the
    connection object, if it can return a hash code string which means we connect the data source successfully. If the connection is failure, it will return null value when printing the connection object.
    If you still have any question, please feel free to ask.
    Best Regards,
    Simon Hou

  • ADF BC  in ADF Swing application(global datasource connection)

    Hi all!
    I have ADF-Swing based application.
    I have a standalone Weblogic server and global datasource (for example, name of datasource hrGlobal)
    I want to use this datasource(hrGlobal) in my application module. All my entities and views must connect into the database, using this datasource.
    The question is, how can I declare this remote connection in connections.xml, for using him in Application Module?
    In forum or in documentation a can't find the answer for this question. So, any help is welcome:)
    Thank you all for responses.
    PS. JDeveloper version is 11.1.1.3
    WLS version is 10.3.3

    Thank you for links. Also, I found very useful link http://suns1988.blogspot.com/2011/02/adf-desktop-application.html
    So, I had deployed application on WLS. Ear size is 95 MB with folder adfjars, that includes many jar libraries.
    Now I'm trying to run WebStart file, but get an error "com.sun.deploy.net.JARSigningException: Found unsigned entry in resource: http://myurl:myport/testWebStart/adfjars/xmlparserv2.jar".
    Can you help me, please?
    And the 2-d question is about libraries in folder "adfjars": Can I share this libraries on WLS, than not to deploy each time in Ear archive?
    Edited by: Stanislav on 01.05.2011 7:17

  • Java.lang.NullPointerException when using DataSource connection and executing CallableStatement

    Hi Guys
    I am having some problem as I am using a DataSource for connections and randomly
    the CallableStatements and PreparedStatements created from this DataSource becomes
    null and everytime I get NullPointerException with this message.
    java.sql.SQLException: java.lang.NullPointerException
         at weblogic.jdbc.rmi.SerialPreparedStatement.setString(SerialPreparedStatement.java:210)
         at .........
    Help will be appreciated..

    Hi Guys
    I am having some problem as I am using a DataSource for connections and randomly
    the CallableStatements and PreparedStatements created from this DataSource becomes
    null and everytime I get NullPointerException with this message.
    java.sql.SQLException: java.lang.NullPointerException
         at weblogic.jdbc.rmi.SerialPreparedStatement.setString(SerialPreparedStatement.java:210)
         at .........
    Help will be appreciated..

  • Oracle Clobs, datasources, connection pools, RMI ...

    Hello all,
    We are using Weblogic 7.0, windows 2K server, Oracle 9i and are trying to read from a clob. Using
    Weblogic datasources to manage connection pools. We are getting back a weblogic.jdbc.rmi.serialClob
    object.
    Any help reading data from this?
    The main error is "No Data Found".
    What else might I tell you to help?
    Thanks a bunch for any help.
    BTW
    We had this working in iplanet and we are converting to weblogic. This is our last major hurdle.
    Galen Boyer

    On 3 Feb 2004 12:51:26 -0800, Raymond Tiong <[email protected]> wrote:
    >
    Oracle Database Server 9i supports the usage of LABELS to enforce highly
    granular
    resource access restrictions at the database level independent of the
    application
    that is accessing it. In order to use this however, the particular
    user, and
    not just the application, accessing the database must be known. Oracle
    Application
    Server (Oracle's J2EE product line) solves this by providing the ability
    to PROXY
    the identity of the application user and creditials (SSL Certs for
    instance) down
    to the database server.
    I haven't seen a similar ability for BEA Weblogic Server 8.1 which allow
    the user
    identity and credientials to be PROXIED to the database server. Is this
    possible?
    Have I missed an important document?
    Thanks for any input,
    Raymond Tiong
    I think there is a section in the JDBC documentation for 8.1 which
    describes what it takes to utilize Oracle 9i extension called "Virtual
    Private Database". With this extension, one might be able to proxy the
    callers
    identity to the DB.
    See: http://e-docs.bea.com/wls/docs81/jdbc/thirdparty.html#1103627

  • DataSource Connection Issues w/Authentication Sample App

    Hi,
    I'm trying to accomplish database provided authentication as described in this how to article:
    http://www.oracle.com/technology/products/jdev/howtos/1013/oc4jjaas/oc4j_jaas_login_module.htm
    I have enabled logging for the oc4j security module in the j2ee_logging.xml file for troubleshooting, and have been inspecting the log entries returned whilst attempting to login.
    It seems my datasource is not connecting, and i can't work out why not.
    The relevent log information is here :
    14/08/2007 13:33:40 oracle.security.jazn.login.module.db.DBTableOraDataSourceLoginModule performDbAuthentication
    FINE: [DBTableOraDataSourceLoginModule]User Han Solo not authenticated: username or password mismatch
    14/08/2007 13:33:40 oracle.security.jazn.login.module.db.DBTableOraDataSourceLoginModule performDbAuthentication
    FINE: [DBTableOraDataSourceLoginModule]Error: Listener refused the connection with the following error:
    ORA-12514, TNS:listener does not currently know of service requested in connect descriptor
    The Connection descriptor used by the client was:
    //oratestsvr:1521/BIDB
    oratestsvr is the correct server name, and BIDB is the correct service name, i can successfully connect to this database via sqlplus.
    The datasource definition in the embedded oc4j data_sources.xml file is:
    <native-data-source name="OracleNativeDS" jndi-name="jdbc/OracleNativeDS" data-source-class="oracle.jdbc.pool.OracleDataSource" user="TIMESHEET_SYS" password="->DataBase_User_zdvhhyJa_CMhuW4MPzpmFZRhjNO9WQeI" url="jdbc:oracle:thin:@//oratestsvr:1521/BIDB" login-timeout="1000">
    </native-data-source>
    However changes to this file are not reflected in the log errors, i can alter the log response by changing the datasource definition found in 'embedded OC4j Server preferences.. -> Current Workspace -> Data Sources -> OracleNativeDS (appears to be the same definition)
    I am unsure how to proceed as i can't find anything wrong with my datasource configuration, yet i keep getting the same connection error in the log.
    Any idea's?
    Thanks

    Ah, fixed it.. the // slashes weren't needed.
    url="jdbc:oracle:thin:@oratestsvr:1521:bidb"

  • DataSource Connection Pooling in 903?

    We are having difficulty getting 9iAS DataSource Pooling to work. We are using 9iAS 9.0.3 (without Infrastructure) and, as per the J2EE Services Guide, have :
    1) Added...
    Context ic = new InitialContext();
    DataSource ds (DataSource) ic.lookup("jdbc/OracleDS")
    Connection con = ds.getConnection();
    ...to our code.
    2) Modified the default DataSource's url, username, password, min-connections & max-connections from within Enterprise Manager (leaving ejb-location as is at "jdbc/OracleDS") and restarted the Instance.
    The app generates an exception when trying to locate the OracleDS, however.
    We have also tried replacing the "com.evermind.sql.DriverManagerDataSource" class with "oracle.jdbc.pool.OracleConnectionCacheImpl" as per another post's recommendation.
    It appears that others have had similar problems (prior to 903?), but many have, in fact, (now) got this working successfully -- what are we missing please......?
    Thanks.

    Hi people!
    I have a question on the above code.
    I tried it myself on OC4j 9.0.3 (the one that comes with JDeveloper) and I noticed the connections on the pool. The problem is the behaviour of this code when the datasource is configured to have as a "max_connections" attribute a value less than 10, e.g. 8.
    I tried a datasource of the following form
         <data-source
              class="com.evermind.sql.DriverManagerDataSource"
              name="OracleDS"
              location="jdbc/OracleCoreDS"
              xa-location="jdbc/xa/OracleXADS"
              ejb-location="jdbc/OracleDS"
              connection-driver="oracle.jdbc.driver.OracleDriver"
              username="myuser"
              password="mypass"
              min-connections="2"
              max-connections="8"
              url="jdbc:oracle:thin:@localhost:1521:orcl"
              inactivity-timeout="60">
         <property name="cacheScheme" value="DYNAMIC_SCHEME"/>
         </data-source>
    but the execution of the code stops when it comes to get a Statement object out of the 9th connection object. Isn't the pool supposed to give a new connection and remove it when it's finished with it? After all, the documentation says that this is the default behaviour of the pool (it is not necessary to declare the DYNAMIC_SCHEME in the data-source.xml)
    I am interested in this, because I have a bunch of JSP files (100 of them or even more) that shall use the same connection pool. If some of them are being executed concurrently, then there will definitely be a problem with the available connection objects.
    Thanx

Maybe you are looking for

  • Can't shut down system preferences

    After changing display settings while using VGA port to remote display laptop will not shutdown because System Preferance will not shut down. Shutdown grey-Ed.

  • Kernel task is hogging lots of threads and CPU time

    My Mavericks Quad Macbook Pro is getting pretty slow these days and at some point I'll have to reinstall everything I think. However I can't start that for a while as I have important projects on the go. I looked in Activity Monitor first and I can s

  • File encoding question

    Just attempting to open some file and read it to screen with BufferedReader and no encoding is handled anywhere... I tried to save an html file to .txt and just use that as a test file, but yeah encoding was different from ???(the standard encoding I

  • I have just updated to Mavericks and my email has gone'strange'. Help???

    Everything papers to be archived, which I NEVER use, and when I try and move messages to where they should be, half of them get lost. This is in my shared gmail account for the rugby club.I haven't dared to look at my main sky account, or my own gmai

  • Embedded Video

    Is the Adobe Reader for iPad able to show embedded video in an interaktive PDF? Thanks for information