Ned help  from java developer init() doGet(),doPost()

Where do we create Databse connection in servlet in all the init() doGet(),doPost() method and why
Appericite your help

Here are the steps at high level to follow to obtain database connection in your web app -
Configure connection pool(s) and data sources for the container on which your app is going to be deployed.
Specify the names of the datasources to be used in the deployment descriptor of your app.
Look up the datasource using JNDI APIs and get a connection from it.

Similar Messages

  • I need help from java sorceries.

    Hello, I've discovered some magic in Java sources.
    I looked into HttpURLConnection code, there is absolutely nothing about sockets. Look at this getStatusCode method:
    getInputStream();
    String resp = getHeaderField(0);
    responseCode = parse(resp);Neither getInputStream() nor getHeaderField(int) are not defind in HttpUrlConnection class. Yes, these methods are defined in UrlConnection. Here is how it is done:
    public String getHeaderField(int n) {return null;}
    public InputStream getInputStream() throws IOException
    {throw new UnknownServiceException("protocol doesn't support input");}Seems that UrlConnection do not support these metods. My only problem was to discover how can I read character header from binary socket stream and parse it without depricated readLine in DataInputStream.

    HttpURLConnection is an abstract class, so it does not provide the implementation of what you're looking for. When you need an object of HttpURLConnection, you can't use new HttpURLConnection(), instead, you use URL.openConnection() or something like that. In that method, an object of the HttpURLConnection is created (actually an object of its sub-class as all abstract method must be implemented).
    you should be able to get any header info via an object of HttpURLConnection, as all methods have already been implemented, though not in the HttpURLConnection class.
    BTW, if you like readLine(), find it in BufferedReader class, it's the replacement of DataInputStream, but it's not recommanded for networking communication, as the new line control character(s) is platform dependant (some use '\n', while some use '\r\n').

  • Need help from SQL Developer users

    I’d like to run Decision Tree models in SQL Developer for monthly predications after running in ODM manually.
    I created PL/SQL Packages under Tools from ODM, and compiled them in SQL Developer successfully. According to Oracle documents, I should be able to run the same DT models (using create or replace PACKAGE BODY "DATAMININGACTIVITY1" .......). However, I am unable to run the entire “Package Body” or any part of it. One of the error messages shows "The select program is in an invalid state for running". I also tried to use "Call" to call functions to run my SQL Package, but that didn't work either. So far, the only SQL works for me is to create a view from a table.
    Please share how you use SQL to run models. Thanks, DC

    In PL/SQL Block you will see something like below.
    In the most simple case you need to supply to arguments ( see bold )
    CASE_TABLE := *'YOUR_TABLE_NAME_FOR_MODEL_BUILD'*;
    MODEL_NAME := *'MODEL_NAME_FOR_YOUR_NEW_MODEL';*
    That would be enough to build a model.
    Thanks,
    Jim
    DECLARE
    CASE_TABLE VARCHAR2(200);
    ADDITIONAL_TABLE_1 VARCHAR2(200);
    MODEL_NAME VARCHAR2(200);
    CONFUSION_MATRIX_NAME VARCHAR2(200);
    LIFT_RESULT_NAME VARCHAR2(200);
    ROC_RESULT_NAME VARCHAR2(200);
    TEST_METRIC_NAME VARCHAR2(200);
    FEATURE_TABLE VARCHAR2(200);
    MAPPING_TABLE VARCHAR2(200);
    DROP_OUTPUT BOOLEAN;
    BEGIN
    CASE_TABLE := *'YOUR_TABLE_NAME_FOR_MODEL_BUILD'*;
    ADDITIONAL_TABLE_1 := NULL;
    MODEL_NAME := *'MODEL_NAME_FOR_YOUR_NEW_MODEL';*
    CONFUSION_MATRIX_NAME := NULL;
    LIFT_RESULT_NAME := NULL;
    ROC_RESULT_NAME := NULL;
    TEST_METRIC_NAME := NULL;
    FEATURE_TABLE := NULL;
    MAPPING_TABLE := NULL;
    DROP_OUTPUT := NULL;
    DATAMININGACTIVITY1.DT_1428168079_BA(
    CASE_TABLE => CASE_TABLE,
    ADDITIONAL_TABLE_1 => ADDITIONAL_TABLE_1,
    MODEL_NAME => MODEL_NAME,
    CONFUSION_MATRIX_NAME => CONFUSION_MATRIX_NAME,
    LIFT_RESULT_NAME => LIFT_RESULT_NAME,
    ROC_RESULT_NAME => ROC_RESULT_NAME,
    TEST_METRIC_NAME => TEST_METRIC_NAME,
    FEATURE_TABLE => FEATURE_TABLE,
    MAPPING_TABLE => MAPPING_TABLE,
    DROP_OUTPUT => DROP_OUTPUT
    END;
    Edited by: jdadashev on Mar 12, 2010 9:08 AM

  • Migrating from JavaHelp to Oracle Help for Java

    Currently we have a product in which we have implemented Sun Microsystem's JavaHelp as the Help delivery system. However, after evaluating Oracle Help for Java we would like to migrate from Javahelp to OHJ.
    My question is, how difficult would this migration be from the Development side? I have been reviewing the Oracle Help for Java Developer's Guide and comparing it against the JavaHelp documentation but I haven't been able to get a clear idea of how different the implementation is.
    Thanks,
    Theresa

    Hello Theresa,
    Thanks for considering Oracle Help.
    There isn't much you have to do with your source content and control files. With the exception of the full text search index, the Oracle Help control file formats (helpset, index, map, etc.) extend the JavaHelp formats. So you can use the JavaHelp control files as is, or you can extend them with the Oracle Help extensions. For a quick overview of differences, see the following page in the Oracle Help Guide:
    1. Go to http://otn.oracle.com/ohguide/help/.
    2. Click "Oracle Help File Formats."
    3. Click "Comparision to Javahelp File Formats."
    To create an Oracle Help full text search index, run through the Helpset Authoring Wizard and remove the existing JavaHelp search view and have the wizard generate an Oracle Help Search index
    on the following wizard page. For the Helpset Authoring Wizard doc:
    1. Go to http://otn.oracle.com/ohguide/help/.
    2. Click "Authoring Oracle Help Systems."
    3. Click "Using the HelpSet Authoring Wizard."
    Alternatively, change the helpset file by hand. For the doc:
    1. Go to http://otn.oracle.com/ohguide/help/.
    2. Click "Oracle Help File Formats."
    3. Click "Helpset File."
    Then run the indexer. For doc:
    1. Go to http://otn.oracle.com/ohguide/help/.
    2. Click "Authoring Oracle Help Systems."
    3. Click "Using the Full-text Search Indexer."
    On the development side, the APIs are different, but they are also very
    simple. You create a Help object, add HelpSets, and associate topic-ids
    with java UI components using the CSHManager as described in the
    Oracle Help Guide:
    1. Go to http://otn.oracle.com/ohguide/help/.
    2. Click "Oracle Help for Java Developer's Guide."

  • Web Dynpro JAVA developer attempting to unravel Environmental Compliance source code seeks guidance from EC NWDS Composition Environment specialist

    It frustrates me to have to ask for detailed instruction on this issue, but normal means of importing these Java-based EC software archives just aren't working in our NWDI system. We never moved our production WDJ applications to CE (like so many others we jumped straight from NW7.01 to NW7.3) but I'm doing my part to come up to speed on composition projects. No matter how we create the NWDI track and import the software archives and dependencies, we can't get to a state where we can successfully import a project (product?) from the Development Infrastructure into the Composite Explorer perspective.
    I need to know specifically how I, an experienced WDJ developer with no exposure to CE, can take the five .SCA files that contain Environmental Compliance 3.0 and get the project into my NWDS 7.31 workspace in a workable state, on my local system, without NWDI. Actual code modifications can wait for the moment, I just need to analyze the classes and EJB's to identify where we might want to make enhancements, and where/how to use the provided Enhancement Spots. I've followed the links, downloaded the .pdf's, read the online help, stepped thru the tutorials - I've done my due dilligence. It's common knowledge that Composition Environment is no longer recommended for new development, and as the EH&S programs are converted to WDA there are even fewer resources to look to.
    These specific types of pleas don't often return results, as I have learned over my years in this community, but nothing ventured-nothing gained, and I am no longer afraid of looking dumb or being scolded. I just need help.
    As always, points will be awarded.

    I agree in part Tobias.
    Because the source code is in the SCA within the src.zip file within each SDA.
    What does not exist within that SCA Standard is the SOURCEARCHIVES folder. In that folder should be a file (the extension .dcsa) for each DC (component) that SCA Standard.
    In short, yes it is possible to perform a reverse engineering...
    Just import the SCA Standard in NWDS.
    Note the name and type of all DCs, its dependencies and its public parts... yes, it's a lot of work, as there are many interdependent DCs.
    Done so, create a new workspace in NWDS and create a new SCA in DI (custom), inside it create all DCs with the same names and types (and dependencies)... identical to SCA Standard.
    And soon after, entering the SRC folder of each of these projects (DCs) and replace its contents with the contents of src.zip file that is contained within the SDA files within the SCA Standard.
    That done, we will have an SCA Custom with all representative of the SCA Standard DCs, but editable.
    I agree it is not nearly a good practice, or even that SAP indicate that this is done... however, it is possible yes.
    Att,
    Angelo

  • SELECT returning different rows when issued from SQL Developer or Java apps

    Hi there. I'm facing a problem here: I'm trying to issue a SELECT from Java, which should return me 2 rows; but I'm getting just one. When I issue the SELECT directly through SQL Developer it gives me the expected result. I've pastebin the code at http://paste.uni.cc/11821, where I've described in details the problem.
    What could it be? Any help would be appreciated.
    Thanks in advance!

    Marco,
    I would code it a bit differently, but I don't think that would solve your problem.
    I suggest setting up the JDBC logging. I'm not promising it will help, but I guess it
    can't hurt. Here is a white paper about it:
    http://www.oracle.com/technology/tech/java/sqlj_jdbc/pdf/logging%20white%20paper.pdf
    You can also access that link from this Web page:
    http://www.oracle.com/technology/tech/java/sqlj_jdbc/index.html
    Good Luck,
    Avi.

  • Help on java/j2ee application development framework

    hello java-gurus,
    I'm new to java and is working in java for just 15 months.i want to know more about the platform/framework which is used in the development of java/j2ee projects.To be more specefic i want to build a java/j2ee project .
    -->The project will be located in the eclipse workspace.
    -->The eclipse will be connected to the cvs and will save the latest code in the repository.
    -->The project will have a build.xml file which on being executed
    will check the latest code from cvs.
    will run j unit test.
    on success from the junit it will compile the project.
    It will make a .war,.ear etc file..
    It will then be deployed in the application server.
    So i want to make a framework of this kind.So i want help from u guys how to proceed.
    I'm just a starter with ant scripts .know how to clean,build and make war files ..I also know about eclipse like connecting to cvs,generating ant script from it etc..
    i'm also comfortable with struts,java,servlet etc..
    So do give me some guidelines how to proceed .
    thanks

    Hello,
    i'm working in project same style of what you want. here are details :
    - eclipse for development - lomboz plugins for j2ee support.
    - using subclipse plugin for svn support checkout and commit, in case of cvs i think it is default in eclipse.
    - the framework is Struts, which is a very very powerful J2EE framework.
    - eclipse plugin lomboz supports creating and deal with struts project
    it also offers GUI for configuring struts xml files.
    - lomboz contains plugin for creating and define application servers and containers like tomcat and jboss, so you can compile, run and debug your code from your eclipse.
    - i use many other tools for creating UML diagrams and ERD diagram and reflect contents to existing projects.
    i think with struts,eclipse and lomboz you need nothing else.

  • Sample Java code and detail to call RFC from Java clas developed in Eclipse

    Hi All,
    I am new to Java. I have downloaded Eclipse IDE  and planning to use for developing Java application to send data to SAP by calling RFC JCO Interface.
    I need a sample java code/tutorial step by step to create Java class for simple example to call RFC from Java.
    I have downloaded SAPJCO3 from service market place.
    Kindly help me to send steps involved to configure for JCO  with my Eclipse with JCO.
    Thanks in advance.
    Sharma

    Hi Sharma,
    Please have a look at [Example: Using Generated Proxies to Call Function Modules |http://help.sap.com/saphelp_nw04/helpdata/en/b6/55e3952a902447847066a0df27b0d6/content.htm]
    JCo Exceptions : http://help.sap.com/saphelp_nw70ehp1/helpdata/en/f6/daea401675752ae10000000a155106/content.htm
    Hope it will helps
    Regards
    Arun

  • Init() and doGet(),doPost()

    Dear All If i want to make a JDBC connection in which method we have to do and why.
    Thanks in advance

    None of the above.
    If you get a connection inside init(), which is only called once when the servlet is loaded, you'll only have one connection. Bad idea. Definitely don't get one in init().
    doGet() should just call doPost(), or visa versa. No need to implement both.
    Write a separate Java Bean that does all your database access. Test it off-line, without the servlet. Once you have it working, have the servlet instantiate it and call its methods. Make it possible for this database object to use a connection pool that will be maintained by your servlet container.
    It'll keep the database code out of your servlet. It'll let you test the database code thoroughly without having to use a Web interface. It'll make it possible for you to reuse the database object. It'll enforce good model-view-controller separation. It'll use connections in an efficient manner, because your database object will get one, use it, and immediately return it to the connection pool.
    Lots of benefits, IMO.

  • How do prepare myself to become a good java developer??pls help

    Hi ,
    I would like to get into JAVA dev but for that I need to prove my potential to my manager.So, could anyone please provide me suggestions on how do I begin preparing to become a JAVA developer.
    I have basic JAVA knowledge,completed SCJP 1.5.But I need to prepare in a dev perspective.
    Hope any of dos expert developers could help me out.
    Thanks,
    Triji

    PhHein wrote:
    [Sun's basic Java tutorial|http://java.sun.com/docs/books/tutorial/]
    [Sun's New To Java Center|http://java.sun.com/learning/new2java/index.html]
    Includes an overview of what Java is, instructions for setting up Java, an intro to programming (that includes links to the above tutorial or to parts of it), quizzes, a list of resources, and info on certification and courses.
    jGuru
    A general Java resource site. Includes FAQs, forums, courses, more.
    JavaRanch
    To quote the tagline on their homepage: "a friendly place for Java greenhorns." FAQs, forums (moderated, I believe), sample code, all kinds of goodies for newbies. From what I've heard, they live up to the "friendly" claim.
    [Yawmarks List|http://forums.devshed.com/java-help-9/resources-for-learning-java-249225.html]
    [The Java Developers Almanac|http://www.amazon.com/exec/obidos/tg/detail/-/0201752808?v=glance]
    [http://javaalmanac.com|http://javaalmanac.com]
    Bruce Eckel's [Thinking in Java(Available online.)|http://mindview.net/Books/DownloadSites]
    Joshua Bloch's [Effective Java|http://www.amazon.co.uk/exec/obidos/Author=Bloch,%20Josh]
    Bert Bates and Kathy Sierra's [Head First Java|http://www.amazon.com/exec/obidos/tg/detail/-/0596004656?v=glance ]
    James Gosling's [The Java Programming Language|http://www.bookpool.com/sm/0321349806]
    Gosling is the creator of Java. It doesn't get much more authoritative than this.
    Joshua Bloch and Neal Gafter [Java Puzzlers.|http://www.javapuzzlers.com/]

  • Help required from JDeveloper Development Team.

    HI there,
    I Download the JDeveloper 10.1.2 (1811) from OTN, But the downloaded archive file is unable to open. I did the download once again but I am facing same problem. I want to JDeveloper 10.1.2 for the installation of BI Beans 10.1.2.
    Help required from JDeveloper Development Team
    Thanks For Your Time,
    Regards,
    ViSHAL.

    Please use an informative Subject line, there is more chance that people will read the post.
    All we can suggest is that you try the download again.

  • Accessing *.XLS from Java -- Help!

    Could anyone help me with some explanations about how to access MS Excel (*.elx) files from java?

    I just have Accessing Access from Java.
    /* 2003/02/06 eric.leung
    * Source : HOME
    import java.sql.*;
    import java.lang.*;
    public class ejdbcsel {
         public static void main(String args[]) {
              // eric_jsp is ODBC User DNS
              // String url = "jdbc:odbc:eric_jsp";     
              // Using DSNless connection
              String url = "";
              url = "jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb)}" +
              ";SERVER=127.0.0.1;DBQ=c:\\example\\ERIC_JSP.mdb";
              Connection con;
              String query;
              query = "select * from pt_mstr";     
              Statement stmt;
         try {     
              Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
         } catch (ClassNotFoundException e) {
              System.err.print("ClassNotFoundException " );
              System.err.println(e.getMessage());
         try {
              con = DriverManager.getConnection (url,"","");
              stmt = con.createStatement();
              ResultSet rec = stmt.executeQuery(query);          
              // Scan the Database
              while(rec.next()) {
                   System.out.println(rec.getString("pt_part") + "\t"
                   + rec.getString("pt_desc"));     
              stmt.close();
              con.close();
         } catch (SQLException ex) {
              System.err.println("SQLException: " + ex.getMessage());
         catch (Exception e) {
              System.err.println("Error: " + e.toString() + " " + e.getMessage());

  • Why returning string from java stored function failed ?  HELP ME, PLEASE

    Hi everybody,
    I created java stored function: it's doing http post, parsing xml from http reply, and returning string result.
    Sometimes, it doesn't return any value. What can be a reason ?
    The high level procedure, has following form:
    class SBE {
    public static String call(String arg0) {
    SBE sbe=new SBE("d:\\oracle\\ora81\\network\\log\\SBE.log");
    String result=SBEParser.go(sbe.sendRequest(arg0, ""), sbe.logger);
    sbe.logger.log(result);
    sbe.logger.log("Finish SBE intetraction");
    return result;
    PLSQL wrapper has a simple form:
    create or replace package PG_SBE as
    function CALL(arg0 in varchar2) return varchar2;
    end;
    create or replace package body PG_SBE as
    function CALL(arg0 varchar2) return varchar2 as language java name 'SBE.call(java.lang.String) return java.lang.String';
    end;
    In log file ("d:\\oracle\\ora81\\network\\log\\SBE.log"), I can find message :
    "Finish SBE intetraction"
    but query:
    select pg_sbe.call("any argument") from dual;
    doesn't finish.
    What can be a reason ? What can I do to trace stage of convertion java string to varchar ?
    Please help me...
    Best regards
    Marek

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Stefan Fdgersten ([email protected]):
    Maybe your call is wrong... Shouldn't there be a "?" instead of "1"?
    Your code:
    String myquery = "begin :1 := jspTest; end;";
    I provide my (working) call from java as an example. Maybe it is of any help... :)
    import java.sql.*;
    import oracle.jdbc.driver.*;
    public Vector getAllHosts() throws SQLException {
    //return getHosts(false, -1);
    Connection conn = null;
    CallableStatement cs = null;
    Vector hostV = new Vector();
    try {
    conn = getConnection();
    String query = "{ ? = call curTestPkg.curTestFunc}";
    cs = conn.prepareCall(query);
    cs.registerOutParameter(1, OracleTypes.CURSOR);
    cs.execute();
    ResultSet rs = ((OracleCallableStatement)cs).getCursor(1);
    while (rs.next()) {
    Host host = new Host(
    rs.getInt("hostid")
    , rs.getString("name")
    , rs.getString("descr")
    , rs.getString("os"));
    hostV.add(host);
    cs.close();
    return hostV;
    } finally {
    close(conn, cs);
    <HR></BLOCKQUOTE>
    hi Stefan thanx.....even after changing the call statement i get the same error. i changed query string as...
    String myquery = "{ ? = call jspTest}";
    CallableStatement cst = con.prepareCall(myquery);
    Can u please check out my call sepc that i have written in pl/sql and plz let me know it there is any error in that.
    PS : THIS IS THE FIRST TIME I AM WORKING WITH PL/SQL AND IT IS URGENT

  • How to create context sensitive help and call the role based help from my Java Project?

    Hello All,
    I am new to Robo Help. I have created a Robo help for my Java Web Applicaion. My application is role base i.e some user's will not see some of the pages of the application. So I want to hide those pages in Robo help as well. I tried creating multiple TOC for different Roles.
    My Question is
    How to call robo Help from my application?(I will be calling using java script. If it is with RoboHelp_CSH.js where can I get that and How to implement it in my project)
    How to implement role based help?
    Thanks,
    Siva.

    I answered that. My point in asking whether it matters was that if it does, then you cannot use content categories and point different users to different categories and not allow them to see the others.
    The alternative, as I said, would be to produce different outputs for each role.
    As it does matter, then using webhelp you will have to use your RoboHelp project to produce a number of outputs, one for each category. Your app would install each webhelp into different folders and when your app determines the user role, you will link to the appropriate help.
    There is another thread running where it has been explained by Willam van Weelden that you can achieve what you want using browser based AIR help. If that form of help can be considered, then the thread is at http://forums.adobe.com/message/4914753?tstart=0#4914753
    Browser based AIR help must be run from a web server. It cannot be installed locally.
    See www.grainge.org for RoboHelp and Authoring tips
    @petergrainge

  • How to call windows help files .hlp from Java program

    Hai all everybody
    How to call windows Help file that is xxx.hlp files from java programs
    any help great!!!!
    regards
    veeru

    How about
    Runtime.getRuntime().exec("start xxx.hlp");

Maybe you are looking for

  • How to read some records from a text file into java(not all records)

    hello, how to read text files into java. i need only few records from the text file not all records at a time. If any one knows plz reply me my id is [email protected]

  • Distorsion problem

    Has the new 20Gb iPod with color display the same distorsion problem (or background crackling) of high frequency/high output sound (such as piano, high output electric guitar & some deep bass output)? Please let me know because I'm planing to replace

  • Page order for booklet in pdf

    Hi! I have to make a booklet. I created it with facing pages in A5 format. If I would print it directly from InDesign by choosing "Print Booklet" everything seems ok - it put all pages in order to later stick everything together in the right way on A

  • Can i use the iPhone 5 unlock version for tMobile?

    can i use the iPhone 5 unlock version for tMobile?

  • If you have an Airport Extreme router and a slow Internet connection ...

    I know that Internet connection speeds are extremely variable, but I wanted to share this post for anyone having performance problems (very slow Internet connection speeds) while using an Airport Extreme router. This may or may not help you, but it m