How to connect to database in web service??

Hi all,
How to connect to database in web service ? Can anyone give some advice what kind of database should i use? thanks

No difference. Just connect as usual!
Let me give you an example:
Code to connect to postgresql db ...
public Connection connectPostgresql(String servername, String dbname, String username, String password)
          Connection conn = null;
          try
                    // Load the JDBC driver
                    String driverName = "org.postgresql.Driver";
                    Class.forName(driverName);
                    // Create a connection to the database
                    String url = "jdbc:postgresql://" + servername +  "/" + dbname;
                    conn = DriverManager.getConnection(url, username, password);
                    return conn;               
          catch (ClassNotFoundException e)
                    // Could not find the database driver
                    return conn;
          catch (SQLException e)
                    // Could not connect to the database
                    return conn;
}Code for an axis web service ...
public Element[] updateProfile(Element[] params)
          String message = "";
          // get str 1
          Node node1 = params[0].getFirstChild();
          String str1= node1.getNodeValue();
          // get str 2
          Node node2 = params[1].getFirstChild();
          String str2= node2.getNodeValue();
          Connection conn = connectPostgresql ("localhost","myDatabase","myUsername","myPassword");
          // there is a method to insert these params to db
          boolean isInserted = insertParams(conn, str1, str2);
          if(isInserted )
                    message = "OK";
          else
                    message = "Not OK";
          // constructs an array of DOM Elements for message to send back to client
          SOAPBodyElement[] response = new SOAPBodyElement[1];
          response[0] = new SOAPBodyElement(XMLUtils.StringToElement("urn:foo", "e1", message));
          return response;
}Gokce.

Similar Messages

  • How could I synchronize databases via web services

    I have two web sites. The first has been build in jsp. The second has been build in php. Each of these sites has database mysql.
    I have managed to communicate these two web sites via web services.
    I would like someone to tell me how could I syncronize these two databases via web services. There is something specific procedure?
    Thanks in advance, sorry for my bad English

    If you can explain us what you actually looking for, then I can extend my help.As we are also using websites in jsp which is having DB connections.
    Cheers
    Rajesh R

  • How to connect the database (JDBC) using service name rather than SID

    How should we make the connection to the database using service name. Initially, we are using the SID to make the database connection, with following setting in the data-source.xml in OC4J using ABCDB as the SID.
    <data-sources>
         <data-source
              class="com.evermind.sql.DriverManagerDataSource"
              name="jdbc/ABCDB"
              location="jdbc/ABCDB"
              pooled-location="jdbc/OracleDSPooled"
              xa-location="jdbc/xa/OracleDSXA"
              connection-driver="oracle.jdbc.driver.OracleDriver"
              username="ABC"
              password="ABC"
              url="jdbc:oracle:thin:@191.1.4.126:1521:ABCDB"
         />
    </data-sources>
    It work, but now we need to make the connection using this service name ABCSERVICE, but it doesn't work in the OC4J (JDBC). May I know how should we handle this connection?
    Thanks and Regards,
    Pang

    Finally, I got the solution to make the database connection using service name, with putting the tnsname setting in URL portion.
    url="jdbc:oracle:thin:@(description=(address=(host=191.1.4.126)(protocol=tcp)(port=1521))(connect_data=(SERVICE_NAME = ABCSERVICE)))"
    And now, it is working fine.
    Regards,
    Pang

  • How to connect a PDF form to SQL server database through web service?

    Hi,
    I'm new to LiveCycle designer. I have designed a PDF form in LC designer ES2, which suppose to take a personnel number and retrieve the personnel information from a SQL server database. Currently its working fine with XML data and a search button, but I need to securly connect to a database through web service. I know how to connect to a wsdl file through designer. What I need is a wsdl file to connect the form to database. For this purpose, is there any WSDL code to use as the web service?
    I really appreciate your help and advice.

    Hi,
    I'm new to LiveCycle designer. I have designed a PDF form in LC designer ES2, which suppose to take a personnel number and retrieve the personnel information from a SQL server database. Currently its working fine with XML data and a search button, but I need to securly connect to a database through web service. I know how to connect to a wsdl file through designer. What I need is a wsdl file to connect the form to database. For this purpose, is there any WSDL code to use as the web service?
    I really appreciate your help and advice.

  • Update/insert/delete data from xcelsius to Database via web service

    Hi,
    I need to create dashboard that go function can <b>update/insert/delete</b> data send to <u>Database</u> thru <u>web services</u>, as i know got 2 xcelsius add-on software which support those of function <b>InfoBurst</b> and <b>flynet </b>
    <b>InfoBurst</b>
    http://www.infosol.com/azbocug/minutes/4-Writeback%20to%20a%20Database%20with%20Xcelsius.pdf
    <b>flynet </b>
    http://www.flynetviewer.com/public/community/Blogs/FlynetXcelsiusServerUser/default.aspx
    Except this 2 purchase add-on xcelsius, any other solution ?  
    Maybe need to write some in MSSQL or C# programming which enable insert, update, delete ...etc  ?
    *note: i not use Xcelsius Engage Server , i use Xcelsius Engage only
    thanks,
    regards
    s1
    Edited by: Leong Pui Kee on Mar 1, 2011 6:06 AM

    Hi,
    As of now in Xcelsius/Dashboard Design there is no feature or functionality to insert/update/delete data from database.
    Solution:
    Create a Web service in let’s say C# or Java, which will perform insert/update/delete operation.
    In Xcelsius add Web Service connection and user above web service.
    Xcelsius Web Service connection provides option to pass input values to a Web Service (Input Pane) and get the result (Output values pane).
    We can pass values to be written to the database as a input to Web Service via Web Service connection from Xcelsius and write data to the database.
    Note:
    Performing delete operation from Xcelsius Dashboard could be risky and may delete important data from database. I would not prefer giving delete option/functionality in Xcelsius dashboard.
    Hope this helps!
    Thank you.
    Regards,
    Vinay Mhaske

  • How can I call a SAPME web service from MII such as PlaceFutureHold?

    Dears,
    How can I call a SAPME web service from MII such as PlaceFutureHold?
    By using MII, I would like to develop some logic to check some values which query from SAPME database, if the value is out of spec, it needs to send a emal to inform user ans also hold the SFC.
    Thanks!

    With Web service action block you can view all ME available services
    in I.E
    https://sapme:5000/manufacturing-services/ProductionServiceService?wsdl  you could see your FutureHold service
    To do that in MII, you need Web Service action block. Have you work with MII transaction before?
    (saw your post in MII)

  • How to connect external database(Ex:SQL Server/Tivoli)  from ABAP Webdynpro

    Hi,
    Any one have idea how to connect external database like SQL Server/Tivoli to access tables from WebDynPro ABAP.
    Please point to me some links if you have
    Thanks
    Praveen

    Hi,
    Please check out this link -
    FETCH DATA FROM ORACLE DATABASE USING Web Dynpro
    Regards,
    Lekha.

  • How to install and consume GroupWise Web Service (SOAP)

    Hello! I'm Razvan, programmer from Romnia, and I am new to GroupWise development.
    I am asking if anyone could help me with a C# Visual Studio 2010 example of how to install and consume GroupWise Web Service (SOAP).
    The documentation from novell site didn't help me, i didn't understant much of it.
    All I need is either a link to a documented GroupWise C# developer step-by-step tutorial, or some code examples.
    Can you please show me some code examples in C# with:
    1)loging in using a username and a password,
    2)retrieving contact list,
    3)retrieving appointment list,
    4)sending a mail,
    5)setting an appointment
    I don't know how to use "groupwise.wsdl" and customise it so that it points to our GroupWise server.
    Please, I really need this because I am working at a project right now which involves GroupWise integration.
    I hope I haven't disturbed anyone with my simple question.
    I know this might be a very simple question given the complexity of the other posts here, but that's why I really hope I will get an answer soon.
    Thank you very much!
    Signature:
    How old is the Orthodox faith?
    How old is the orthodox faith?

    Just a comment.
    The value for the version element should be "1.02"
    not "1.2".
    Preston
    >>> On Tuesday, March 01, 2011 at 8:06 AM,
    TheRomanian<[email protected]> wrote:
    > I have great news! After strong documentation yesterday and today, I've
    > just made a successfull example that actually connects to our GroupWise
    > server.
    >
    > I made it in PHP.
    >
    > I need an ASP.NET + C# application, but now is very simple to convert
    > it. I post the PHP code here for other people who in future might be
    > interested in finding out.
    >
    > So a simple PHP GroupWise Login code using "groupwise.wsdl" web
    > service:
    >
    >
    > require_once('./GWService/GroupwiseService.php');
    > require_once('FB.class.php');
    >
    > $classmap = array(
    > 'Authenication' => 'Authenication',
    > 'PlainText' => 'PlainText',
    > 'loginRequest' => 'loginRequest',
    > 'loginResponse' => 'loginResponse',
    > 'logoutRequest' => 'logoutRequest',
    > 'logoutResponse' => 'logoutResponse',
    > 'UserInfo' => 'UserInfo',
    > );
    >
    > $gwservice = new GroupwiseService(
    > "./WSDL/groupwise.wsdl",
    > array(
    > "location" => "http://11.150.40.78:8756/soap",
    > *Your GroupWise server IP:
    > and PORT*
    > "classmap" => $classmap,
    > "trace" => true)
    > );
    >
    > // do login
    > $pt = new PlainText();
    > $pt‑>username = *"YOUR GROUPWISE USERNAME"*;
    > $pt‑>password = *"YOUR GROUPWISE PASSWORD"*;
    >
    > $lr = new loginRequest();
    > $lr‑>auth = $pt;
    > $lr‑>language = "en";
    > $lr‑>version = "1.2";
    > $lr‑>application = "phpClient";
    >
    > $lres = $gwservice‑>loginRequest($lr);
    > //print_r($lres);
    >
    >
    > I Hope this will help others.
    >
    > ‑‑
    > Signature:
    >
    > How old is the Orthodox Faith?
    > 'How old is the orthodox faith?'
    > (http://www.orthodoxphotos.com/history.shtml)

  • Connecting to an external web service from Oracle BPEL

    How do we connect to an external web service using its wsdl (possibly implemented in .NET) from Oracle BPEL process?
    Any specific details/examples greatly appreciated.
    Thanks,
    JN

    How do we connect to an external web service using its wsdl (possibly implemented in .NET) from Oracle BPEL process?
    Any specific details/examples greatly appreciated.
    Thanks,
    JN

  • Sending Infopath content to a database or web service

    Hi,
    I have a sharepoint 2010 where I have 2 infopath forms used to enter data (each form has 5 por 6 fields). I need, once the data entered and validated, at the same time sent to a sql database or web service.
    Can you please let me know the best route to follow. I read in this forum and on google that it can be done as importing to excel but I do not want any intermediary.
    Thanks in advance

    Hello,
    In this video, i don't see any info about SQL OR ORACLE connector. It is simply about rest web service which can be used anywhere (with infopath, external list etc). As per my knowledge, by default there is no rest web service available in SP to connect
    with ORACLE directly. Either you have to ask third party to provide you rest API OR you can create your own as i said earlier.
    This thread will give you more idea:
    https://social.msdn.microsoft.com/Forums/sharepoint/en-US/0ce0a4cd-40f8-4bbf-b963-38e3f59ede73/getting-data-from-oracle-database-to-sharepoint-list?forum=sharepointdevelopment
    Hemendra:Yesterday is just a memory,Tomorrow we may never see<br/> Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • How to connect oracle database from tuxedo

    Hi,
    How to connect oracle database from tuxedo.
    If any one can help me.
    Regards,

    it depends on configuration your going to choose, there are two ways--
    - Using X/Open standards, for this
    you have to make an entry of Resource manager in $TUXDIR/udataobj/RM file.
    Then in UBBConfig file in GROUPS section u have to set Openinfo.
    It also depend on which database you are going to use.
    In your service now you need to call tpopen() API from tpsvrinit() function.
    - Other possibility is, take an implicit connection using Pro*C or Pro*Cobol whatever platform you are using.
    EXEC SQL Connect ...

  • Database Native web services - load balancing,  Instrumentation , security

    Hello –
    I’m proposing use of Database Native web service in our company. Our architects are asking following questions so appreciate your help
    a.     How do you load balance across the DB WS (is there a way to use the F5 to detect downtime and balance the load across the DB servers)? We will be using RAC configuration with 3 nodes.
    b.     Our architect have security concern as user id/password information are in the web service URL, which may prove to be an issue. Is there a way to mitigate this risk?
    c.     Instrumentation in this approach (db native services) is questionable due to development/auto gen of the service logic from the DB itself. We may investigate wrapping the services with OSB to give us an additional instrumentation, policy enforcement, endpoint mediation and security proxy. Thoughts??
    d.     Architect are curious regarding any potential performance issues this may have on the DB server.
    Thanks

    Hi
    We've recently begun using Native Web Services, intending to roll out this approach across the enterprise, but we've encountered 2 significant problems so far, which you may want to consider before proceeding ...
    1. NWS returns an exception if the underlying PL/SQL returns a null value - even if the PL/SQL has completed successfully, and null is a legitimate return value (see SR 3-6201969101 - it contains simple instructions to recreate the problem)
    (I raised it in this forum but there were no replies - SOAP Fault when returning null from a Native Web Service Stored Procedure
    2. The sequence of values returned in the NWS response message is the opposite to the sequence declared in the auto-generated wsdl - i.e. schema validation will fail (see SR 3-6209016991 - it also contains simple instructions to replicate)
    We have coded a workaround for problem 1. where we return <EMPTY> in place of null, and check for it in the client, but without proper resolution we're not prepared to use NWS elsewhere
    As a workaround for problem 2. we removed schema validation, again not ideal
    Both SRs were escalated 9 days ago, but are still outstanding
    Incidentally our database is 11.2.0.1, but I've tested on 11.2.0.3 and both problems are still present
    We also wrap the NWS services using an OSB Proxy Service, and came across the same security issue that you describe (b) - to provide the credentials required for the NWS, simply create a Service Account (containing the credentials) inside OSB and attach it to the Business Service which invokes the NWS (http://docs.oracle.com/cd/E17904_01/doc.1111/e15867/service_accounts.htm)
    HTH

  • Are there any shortcuts to connecting the printer with web services and/or the eprint server?

    (HP Officejet Pro 8600 Plus, IE, Windows 7)
     As I am unable to execute the instructions given by
    by Ryamond 1411, I'm looking for  other avenues to connect my printer to web services and/or
    the eprint server so I can release 4 emails for printout now stuck in que.

    Hello MurrayJ,
    The first thing I would do is follow step six in this document to set a static IP: http://h10025.www1.hp.com/ewfrf/wc/document?docname=c02817031&cc=us&dlc=en&lc=en&product=4023246&tmp...
    When it askes for DNS information, enter in Google's DNS. Preferred DNS = 8.8.8.8 Alt DNS = 8.8.4.4
    If that does not help, if you could provide me with the following information it would help me out. First, who is your ISP( Internet Service Provider, i.e. Comcast, AT&T, Verizon, ect.)? Second, who is the maker of your router? Lastly, what is the model number and firmware version of your router?
    -------------How do I give Kudos? | How do I mark a post as Solved? --------------------------------------------------------

  • Connecting to a SOAP web Service

    For my sapp I want to connect to a simple web service . This web service has Several functions .They each accept some arguments and return End result.. The web service is being activated but it always returns an answer of zero (NULL ) which makes me suspect the parameters aren't being passed in correctly. I'm using Xcode 3.1 on Leopard.
    anyone give some sugesstion.
    Thanks
    Hariharan

    oh it didn't show my WSDL/Schema...
    Hopefully this works:
    <wsdl:operation name="getBooksByID">
          <wsdl:input message="tns:getBooksByIDRequest">
        </wsdl:input>
          <wsdl:output message="tns:getBooksByIDResponse">
        </wsdl:output>
          <wsdl:fault message="tns:RequestFault" name="RequestFault">
        </wsdl:fault>
        </wsdl:operation>
    Request
    <xsd:complexType name="BookParam">
    <xsd:sequence>
    <xsd:element maxOccurs="1" minOccurs="1" name="BookID" type="xsd:int"/>
    </xsd:sequence>
    </xsd:complexType>
    Response
    <xsd:complexType name="BookSummary">
    <xsd:sequence>
    <xsd:element name="BookID" type="xsd:int"/>
    <xsd:element name="BookLocation" type="xsd:string"/>
    <xsd:element name="BookName" type="xsd:string"/>
    <xsd:element name="BookPrice" type="xsd:int"/>
    <xsd:element name="BookCost" type="xsd:int"/>
    </xsd:sequence>
    </xsd:complexType>

  • OutofMemory Error while sending file to database using Web services

    I have a file of 30MB to be written to the MySQL database. I am doing this in Axis web services and it gives me the following error:
    (I am using Tomcat as the application server and Apache as the web server, Axis 1.3 and MySQL standard 5.0.21 version. I have set the minimum and maximum heap size and it works well without using the web service (just uploading and downloading from the database using a simple java program). Another thing to notice is that I can send a file of almost 10MB size to the database using web service without any problem. But it doesn't work with the 30 MB .)
    java.lang.OutOfMemoryError: Java heap space; nested exception is:
         java.lang.OutOfMemoryError: Java heap space
    AxisFault
    faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.generalException
    faultSubcode:
    faultString: java.lang.OutOfMemoryError: Java heap space; nested exception is:
         java.lang.OutOfMemoryError: Java heap space
    faultActor:
    faultNode:
    faultDetail:
         {http://xml.apache.org/axis/}hostname:dbr221d.dbr.louisville.edu
    java.lang.OutOfMemoryError: Java heap space; nested exception is:
         java.lang.OutOfMemoryError: Java heap space
         at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
         at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
         at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
         at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:633)
         at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanEndElement(XMLNSDocumentScannerImpl.java:719)
         at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1685)
         at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
         at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
         at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
         at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
         at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
         at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
         at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
         at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
         at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
         at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
         at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
         at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
         at org.apache.axis.client.Call.invoke(Call.java:2767)
         at org.apache.axis.client.Call.invoke(Call.java:2443)
         at org.apache.axis.client.Call.invoke(Call.java:2366)
         at org.apache.axis.client.Call.invoke(Call.java:1812)
         at edu.louisville.bcc_ma.ws.lab.LabServiceSoapBindingStub.storeGZIPFile(LabServiceSoapBindingStub.java:472)
         at edu.louisville.bcc_ma.lims.labclient.container.SendGZIPFile.sendFile(SendGZIPFile.java:69)
         at edu.louisville.bcc_ma.lims.labclient.container.LoginContainer.login(LoginContainer.java:58)
         at edu.louisville.bcc_ma.lims.labclient.container.LoginContainer.main(LoginContainer.java:44)

    Sorry for the delayed response here, forget to add it to my watchlist. I didn't catch if you were using Java 1.5 or not. Prior to 1.5 the default maximum heap space was 64MB which with the overhead of the appserver might be your problem.
    Take a look at http://java.sun.com/j2se/1.5.0/docs/guide/vm/gc-ergonomics.html and the java -Xmx <size> command line option to change the default (I believe the size argument is in bytes, but don't hold me to that). I think you can pass that as a command line option to the startup script, but you should check the doco to see if it needs to be wrapped in some other arg etc.,
    I seem to recall running into this same problem a few years back when I had a servlet doing some intense graphics processing on the fly and setting this option fixed the problem.

Maybe you are looking for