Webservice with Database access

Hi all,
I have a requirement in which my client will send some data through webservice and i will store that in oracle database, i want to know best approach to handle this. Following are some approches
1- Develop webservice with EJB back
2- Develop webservice with POJO back
3- Develop webservice with service lifecycle and get datsoource/connection from servicelifecycle implementation
4- Deavelop a webservice with DAO class and initialize DAO in constructor of webservice
Please recommend wich approach will be better, please also suggest any other approach.
Regards,
imran

I think the best approach is to keep your web service layer isolated from the data access layer. Hence i would create a business service or business delegate kind of layer which will be called from web service. Business service then calls the DAO methods. For data access layer you have multiple choice of using hibernate, JPA, JDBC, etc based on your requirement. I would prefer to use some sort of dependency injection for injecting the objects in various layers.
Hope this helps.
Divyesh

Similar Messages

  • Servlet with Database Access!!!

    Hi !!!!
    I have deployed HelloServlet with Oracle Application Server 4.0.8.1.
    Now I want to connect from Servlet to Oracle8i 8.1.5.
    But, when I try to deploy a Servlet with Database Access, I receive the next:
    "Get operation not allowed"
    The URL used is:
    http://host.domain:port/virtual_path/class_name
    The servlet was compiled using the Sun's jdk from command line. There wasn't compilation errors.
    I run a simple application with database access from command line without problems.
    The drivers and JDBC libraries are operating for this simple application.
    Any help will be appreciated.
    Many thanks
    Sergio

    If you are running OAS 4.0.8.1 and Oracle 8.1.5 on the same machine then this could be the problem. These products are not certified to run on the same machine as they give a path conflict.
    Hope this helps.

  • OAS 10.1.2.0.2 - How configure PHP with database access

    I Installed OAS 10.1.2.0.2 on SuSe 9.3.
    I put in $ORACLE_HOME/Apache/Apache/htdocs a php pages for test if this OAS versión supported php.
    The test is ok, this versión support PHP, but not are configured to PHP with database access.
    My question is: How I configure this OAS 10.1.2.0.2 to use PHP with database access?
    I need install all PHP although my php pages is running (without database access) ??? or I only need configure database access?

    How I compile my PHP with --with-oci8??                                                                                                                                                                                                                           

  • Using ops$ accounts with Database Access Descriptors

    Hi, I have installed and configured the Photo Album demo under 9i on Windows 2000 with no problems. I wish to use the operating system via oracle ops$ accounts to provide access to the Db through the Database Access Descriptor using the Gateway Database Access Descriptor Configuration tool. While the ops$ accounts I have configured work as expected under sqlplus, i.e. I am able to login to the Db without manually supplying a username and password e.g. sqlplus / , there does not seem to be a way of configuring the DAD to accept ops$ accounts for access to the photo album demo. Please can anyone confirm this to be the case and/ or provide an alternative solution. Kind regards.

    I am pretty sure if you specify a DB username and password in dads.conf, you will not need to log in. Also, there is a tool to encrypt the password so it is not in clear text in the config file.
    From the dads.README For 10:
    - One or more mod_plsql specific directives. For example:
    PlsqlDatabaseUsername scott
    PlsqlDatabasePassword tiger
    PlsqlDatabaseConnectString orcl
    PlsqlAuthenticationMode Basic
    I am on 10 now, so I don't personally know if it the same on 9. I don't use the DADs tool either, but you should be able to set a username/password for the dad so that there is not a need to login.
    It would be best to ask in the HTMLDB forum, they would know better.
    Larry

  • JSP example with database access

    Is there a good example of a JSP portlet doing Oracle database access? Thanks

    David,
    Thanks for the suggestion. We'll schedule that on our list of new sample portlets.
    But as a sidenote, the Database access would really be no different from any standard JDBC calls to connect to and query the database.

  • Problems with database access in Servlet Apllication (Duke's Bookstore)

    Hi! My name is Elena Veretilo! I am so newbie in JavaEE. So I really need you help and advice!!!
    I started to learn JavaEE with "The JavaEE5 tutorial for Sun Java Application Server 9.1" (http://java.sun.com/javaee/5/docs/tutorial/doc/) and this tutorial recommended the next examples: http://java.sun.com/javaee/5/docs/tutorial/information/download.html. I try to work in NetBeans 6.0 and NetBeans 6.5.
    First problem - I couldn't add Sun Java Application Server 9.1 to NetBeans' server list - it just doesn't see the installed Sun Java Application Server 9.1.
    Second problem - I couldn't run Duke's Bookstore example (from tutorial examples) - something wrong with working (maybe creating or accessing) database. The Database Server started, GlassFish Server also started, so I don't know where the problem could be.
    There is exception:
    Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2006.8 (Build 060830)): oracle.toplink.essentials.exceptions.DatabaseException
    Internal Exception: org.apache.derby.client.am.SqlException: Table/View 'WEB_BOOKSTORE_BOOKS' does not exist.Error Code: -1
    Call:SELECT BOOKID, FIRSTNAME, SURNAME, ONSALE, INVENTORY, CALENDAR_YEAR, TITLE, PRICE, DESCRIPTION FROM WEB_BOOKSTORE_BOOKS WHERE (BOOKID = ?)
    bind => [203]
    Query:ReadObjectQuery(com.sun.bookstore.database.Book)
    If anybody had learned this tutorial and examples or just know what I need to do, please help me!!!!! If it's possible, tell me step by step, what I need to do!
    And one more question - do I really need Sun Java Application Server 9.1 to work with or GlassFish includes Sun Java Application Server 9.1?????

    [http://forums.sun.com/thread.jspa?threadID=5350426]
    Crossposting without notification is very rude. Please stick to one topic.

  • XMLStreamReader exception when using webservice with security access denied

    Hi,
    I'm using CXF webservices generated from a WSDL with SOAP document style. Under normal conditions, the client and server work fine, and can I read info back from the the server (SOAP http messages passed between both)
    However, for some servers, I am using SUNs Policy Agent, which checks for an authentication token in the http header cookie before allowing access to the web service. I set up the cxf service port as follow:
    Service service = Service.create(serviceName);
    service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, address);
    servicePort = (IMyService)service.getPort(portName, IMyService.class);
    I also add the authentication token to the http header cookie in the service's request context.
    If the token is correct, everything works fine. However, if the token is incorrect, and access is denied, the policy agent does not return a SOAP http message. In this case, the web service method throws a low-level XMLStreamReader exception i.e. it can't read the SOAP message response - so I can't get the actual response from the policy agent.
    Would anyone have an idea on this? Should I configure the CXF port differently, or should I try to get the policy agent to return a SOAP message even if access is denied.
    There is already a browser that can access the policy agent - and this needs to be redirected if access is denied. So in effect, we need the redirect functionality for the browser, and the returned SOAP message for the application using the web service.
    Any help would be greatly appreciated!
    Rob

    Thanks for your answer.
    I eventually found a workaround for this problem.
    Actually you don't need to provide an SSO cookie the first time you connect to the webgate server, you just need to provide basic credentials and the webgate will provide you an SSO cookie that you can use for the next call.
    The problem is that this doesn't work out of the box with the .NET/WSDL framework for some reason (with Java + the HTTPClient library I had no problem).
    I had to had manually the following headers to the HTTP request to make it work:
    Authentication: Basic XXXXXXXX
    Cookie: OBBasicAuth=fromDialog
    Where XXXXXXXX is a base64 encoded string containing "login:password"
    Thanks,
    Franck

  • Help with database access

    I was installing Oracle 8i Lite in my Win ME box, but when I try to access to POLITE database, there is an error like this:
    ERROR: OCA-30002: ubofcsr: function not supported. If I cancel the mesage then another error appear:
    ORA - 12203: TNS: can't connect with the destinity (or something like that)
    Whats matter???

    you may need to verify that WinME is a supported platform for Oracle Lite. I know that there were some issues installing on Win2K which may also affect WinME. try to reinstall but first clear your machine of Oracle specific items in your registry. there are some documents on metalink.oracle.com that go over the procedure to clearing your machine of oracle products - Document numbers 103213.1 and 74790.1 go through the procedures to follow to remove and install.
    hope this helps.

  • Problem with database access in EJB deployment to SJSAS on remote deploy

    Hi,
    I have deployed an Enterprise application containing an EJB3.0 module to a remote sun application server (Edition 9.0_01 (build b02-p01))
    using a mysql ver 5 DB with connector
    mysql-connector-java-5.0.0-beta-bin.
    It is being used by a swing application client deployed as a module of a separate Enterprise application.
    The client can access the session beans but when the EJB tries to create a query with the entity manager the client fails and the following exception appears in the log.
    Timestamp:     
    Aug 20, 2007 09:36:38.910
    Log Level:     
    INFO
    Logger:     
    javax.enterprise.system.container.ejb
    Name-Value Pairs:     
    _ThreadID=21;_ThreadName=p: thread-pool-1; w: 7;
    Record Number:
    2239
    Message ID:
    javax.ejb.EJBTransactionRolledbackException at com.sun.ejb.containers.BaseContainer.mapBusinessInterfaceException(BaseContainer.java
    Complete Message
    1373)
         at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1290)
         at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:192)
         at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:71)
         at $Proxy329.findAll(Unknown Source)
         at test.TestGuyBean.getTheWordGreat(TestGuyBean.java:36)
         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:597)
         at com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1050)
         at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:165)
         at com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:2766)
         at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:3847)
         at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:190)
         at com.sun.ejb.containers.EJBObjectInvocationHandlerDelegate.invoke(EJBObjectInvocationHandlerDelegate.java:67)
         at $Proxy323.getTheWordGreat(Unknown Source)
         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:597)
         at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:121)
         at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:650)
         at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:193)
         at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1705)
         at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1565)
         at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:947)
         at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:178)
         at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:717)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.dispatch(SocketOrChannelConnectionImpl.java:473)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.doWork(SocketOrChannelConnectionImpl.java:1270)
         at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:479)
    Caused by: javax.ejb.TransactionRolledbackLocalException: Exception thrown from bean; nested exception is:
    java.lang.IllegalArgumentException:
    An exception occured while creating a query in EntityManager
         at com.sun.ejb.containers.BaseContainer.checkExceptionClientTx(BaseContainer.java:3588)
         at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:3436)
         at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1247)
         ... 30 moreThis is a result of a test portion of the application, but similar results occur when the actual application is run.
    The "at test.TestGuyBean.getTheWordGreat(TestGuyBean.java:36)" is
    being invoked by the client and "$Proxy329.findAll(Unknown Source)" is where the query is constructed.
    The code is as follows
    public String getTheWordGreat(String bob){
            String s = "abcdefgh ";
            List<MobileDialingCodes> c =  mobileDialingCodesFacade.findAll();
            for (MobileDialingCodes elem : c) {
                s += elem.getNumber() + " ";
    //        System.out.println("bob");
            return s;
    public ArrayList<MobileDialingCodesHC> getAllDialingCodes(){
            List allCodesEJB = findAll();
            ArrayList<MobileDialingCodesHC> allCodesHC = new OurArrayList();
            for (Object elem : allCodesEJB) {
                allCodesHC.add(convertEJBtoHC((MobileDialingCodes)elem));
            return allCodesHC;
    }The default config for the application is used and the application
    uses the netbeans defaults. Netbeans 5.5. Toplink persistence manager.
    Any suggestions would be appreciated.
    null

    Did you try after restarting the iAS server?

  • Problem with database Access

    Here i want to retrive columns names in table inside my database . I used Access , but i have error : Server= null !!! why this ?!!
    import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.Statement; import java.util.logging.Level; import java.util.logging.Logger; public class JDBCTest {     private Connection connection = null;     private static final String DRIVER = "sun.jdbc.odbc.JdbcOdbcDriver";     private static final String DRIVER_URL = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};"             + "Dbq=C:\\Documents and Settings\\a\\Desktop\\JDBCTest";     private Statement statement = null;     public JDBCTest() {     try {             Class.forName(DRIVER);             connection = DriverManager.getConnection(DRIVER_URL);             statement = connection.createStatement();             ResultSet resultSet = statement.executeQuery("select*from InsertClient");             ResultSetMetaData rsm = resultSet.getMetaData();             for (int i = 0; i < rsm.getColumnCount(); i++) {                 String name = rsm.getColumnName(i);                 System.out.println(name);             }         } catch (Exception ex) {             Logger.getLogger(JDBCTest.class.getName()).log(Level.SEVERE, null, ex);         }     }     public static void main(String[] args) {         new JDBCTest();     } } !
    Thanks

    Post the actual exception stack trace.

  • How to make a simple BPEL-process with database access

    I hope somebody can help me.
    I want to make a BPEL process that get a message via MEDIATOR. That message has to update a database table.
    So far as I know : start in composite with mediator - bpel process and database adaptor.
    What have to be done in the bpel process ?
    I hope somebody can help me, Thnx, Carel

    In a nutshell -
    Create a Database Adapter in the composite.xml UI. Drag a wire from BPEL process to that db adapter you just created. Go to BPEL process (double click), use invoke activity after the initial receive activity, and drag a wire to make the connection to the partner link on the right hand side swim lane (which is your DB Adapter).
    On doing that, you will be seeing the input/output variables generated in the Invoke Activity (should be of type expected by DB adapter).
    Next - drop an assign activity between Receive and Invoke and make the transformations from the "message from the mediator" to this Input Variable (created as part of the invoke activity).
    You are good to go!
    Regards
    Swgt

  • Webservices with Database interaction

    Hi,
    I am new to Web Services.
    I have a requirement to retrieve database records using web services.
    I am uisng Tomcat and JWSDP or AXIS
    Thanks

    Sorry, but for some reasons the way you formulated this question really demotivates me to give any help.
    Please ask questions the smart way: [http://www.catb.org/~esr/faqs/smart-questions.html].

  • Tomcat: Webservice with access for everybody?

    hi
    how can i set up an webservice with free access for anyone? i mean, that users don't need any usernames or passwords to access my webservice.
    thnx :)

    Correct me if I'm wrong, but authentication is not a default feature of webservices. It is a feature which you as a programmer implement. So if you write a normal webservice and the user has access to its wsdl and knows the location (end-point) then he/she should be able to access it without any problem.

  • Database Access NullPointer Exception in Tomcat

    Hi
    I have got a problem with database access in my servlet i have folowed all steps of installing and configuring tomcat and i have a DNS that i use to connect to my access database but i get a NullPointerException when i try to create a statement.
    please help

    Please show the code.

  • Database access using windows authentication

    We are updating our Applications to use single sign on and are running into a problem with database access. We are using CF11 Enterprise and SQL Server 2008 on IIS 7.5.
    We have set up the ColdFusion Application Service to run under an AD service account and have created the data sources in CFAdmin leaving the username and password blank. The data sources verify and all seems good. The problem comes when running a query. The credential passed to the database is the service account and not the windows authenticated user. As such the query fails. What are we missing to get CF to pass the Windows Authenticated user credential instead of the service account?
    Thanks
    Tim

    ColdFusion does not pass user's credentials to the database connections by default, and cannot pass Windows Authentication credentials that way.  It only sends the service account's credentials (if you leave username/password blank as you have done).  The only way to pass user credentials is to put them into the individual query calls themselves, and even then you can't pass Windows Authentication credentials.  You would have to use SQL Server Logins, and create accounts for each user.
    I think most people are using either a dedicated SQL Server login for ColdFusion and run all queries under that account, or they do as you have already done and use Windows Authentication along with the ColdFusion service account.  If you need an audit trail, then pass usernames into the insert/update queries and store them manually along with the other data you are inserting/updating.
    -Carl V.

Maybe you are looking for

  • 2008 imac - beachball lock ups and no-boot 'question mark in file' issue

    Firstly apologies am new to this forum.. am happy imac user (2008) but recently my imac is freezing in use and/or failing to boot on startup; the grey screen showing for a bit and then a file with a question mark in it.  This now happens frequently a

  • Tax Code removed on changing the posting Date in Purchase Order

    Dear All, This is with reference to the Purchase Order Document tax part, the document has been defined with the approval procedure and document series followed as annual series. The document series is linked to the period indicator as I am using the

  • PS CS4 Error

    I am having some problems opening any photo format in Photoshop CS4. They all look like the linked picture at 100% or less. If I zoom in to 200% the photo looks fine. I have tried uninstalling and reinstalling Photoshop. And I know the question will

  • Best way to write this sql ?

    Please let me know best way to write this SQL. select col1, count(*) from TableA group by col1 having count(*) = (select max(vals) from select col1, count(*) as vals from TableA group by col1 having count(*) > 1 )

  • Table for plant section field in equipment master.

    hi,experts, can anybody please tell me in which table data of plant section field gets updated? as I m developing one report where I need to pick up data from plant section field in equipment master. rgds rajib