How to search Database in JSP using LIKE

hi can anyone tell me is there any other syntax for Query when we use LIKE to search database in which suppose
String para = request.getParameter("name");
Select name,surname From user where name LIKE '"+para+"';

hi,
which database are you using, some require you to put % sign with like
e.g. select xyz from table abc where xyz like '%"+para+"%'

Similar Messages

  • How to Search database  through JSP

    I ve created JSPs. How do i carry out search in my Oracle database? Can nebody help me with some code or some link where i can find some help.

    String clsDriver = "DriverName";
    Class.forName(clsDriver);
    String dbUrl = "jdbc:oracle:thin:@dbmachine:dbport:dbsid";
    String dbUser = "dbuser";
    String dbPass = "dbpass";
    java.sql.Connection con = java.sql.DriverManager.getConnection(dbUrl,dbUser,dbPass);
    java.sql.Statement stmt = con.createStatement();
    java.sql.ResultSet rs = stmt.executeQuery("select column from table where column2 like '%"+search_criteria+"%'");
    while(rs.next())
        out.println(rs.getString("column"));
    rs.close();
    stmt.close();
    con.close();Update bold, italic values by ur specific values.

  • How to do  validation in jsp using javascript

    how to do validation in jsp using javascript

    The same way you do with any HTML page.
    Catch the onclick/onsubmit event, do your validation in javascript and then allow/cancel the action as required.
    However this is javascript validation only - javascript can never call JSP code.

  • How to search tables and views used in the code of oracle fmb 6i from another form???

    Hii guys, this is a very interesting question and i hope that it will have ample amount of answers.
    My requirement is to know the number of tables and views and backend functions/procedures which are used in the code written in the oracle forms 6i,
    all i want is to display whole views, tables or functions/procedures which are written  in the code of a particular fmb, i do have the path of that fmb and i want to read the code and search through it's entire code for the tables/views/backend procedures/functions written in the code. So how to search through the entire code of a particular form (6i) and make it display through another form.
    I am using oracle forms 6i.
    Please help me out....
    With Regards:
    Ankit Chandra

    Here is a modified dealForm.jsp that merges the 2 steps - both symbol submission and Yahoo convert is done by it. Play with it and add your DB code to it:
    <html>
    <head><title>IPIB Database Selection</title></head>
    <body bgcolor="#DFDFFF">
    <H1><CENTER>IPIB Database Selection</CENTER></H1>
    <font size=4>
    <%@ page language="java" %>
    <%@ page import="java.net.*,java.io.*,java.util.*" %>
    <%
    String symbol = request.getParameter("symbol");
    if (symbol != null) {
    String urlString = "http://finance.yahoo.com/download/javasoft.beans?SYMBOLS=" + symbol + "&format=ab";
    try {
    URL url = new URL(urlString);
    URLConnection con = url.openConnection();
    InputStream is = con.getInputStream();
    InputStreamReader isr = new InputStreamReader(is);
    BufferedReader br = new BufferedReader(isr);
    String line = br.readLine();
    StringTokenizer tokenizer = new StringTokenizer(line,",");
    String name = tokenizer.nextToken();
    name = name.substring(1, name.length()-2);
    String price = tokenizer.nextToken();
    price = price.substring(1, price.length()-2);
    %>
    <p>
    Original line from yahoo <%= line %>
    </p> <p>
    Name: <%= name %>
    </p> <p>
    Price: <%= price %>
    </p> <p>
    Pub DB processing code from dealLoad.jsp here
    </p>
    <%
    } catch (IOException exception) {
    System.err.println("IOException: " + exception);
    } else { %>
    <form action="dealForm.jsp"method="GET">
    <p>Enter Symbol: <input size="20" name="symbol">
    <inputtype="submit" value="Submit">
    </p></form>
    <% } %>
    </font>
    </body>
    </html>

  • How to find database options features used?

    Hello Oracle Gurus,
    Can someone please tell me how can I find whether a database features is used in the database? e.g. I have a installation with partitioning, label security , etc installed but not sure which of these features is used.
    I could query dba_tab_partitions, for example, to find if there are any partitioned tables in the database. Are there similar views/tables that I can use to find all non standard (extra cost) options like label security, data mining, streams, advanced secuirty, etc.? Can please someone reply with relavant view/table names or queries?
    Thanks,
    Santosh

    In 10g (at least in 10gR2 that I'm checking), there are the DBA_FEATURE_USAGE_STATISTICS and DBA_HIGH_WATER_MARK_STATISTICS views. These are normally accessible through the 10g OEM webpage (administration -> database feature usage) but you can just as easily use query the views themselves.
    set linesize 120 pagesize 999
    col description format a49
    col name format a30
    col version format a10
    col currently_used format a5 heading "Used?"
    col last_usage_date format a10 heading "Last|Usage"
    select name
    , currently_used
    , last_usage_date
    , description
    from DBA_FEATURE_USAGE_STATISTICS
    where version = (select max(version) from dba_high_water_mark_statistics)
    I just thought I'd add that information to complete an old thread, in case anybody else was searching for it on the forums.

  • How to display PDF in JSP using Iframe

    Hi All,
    I am using Struts 2. I am building my file in ActionClass with seperate Method like getGeneratedPDF() in which, I am setting header of response and writing into PDF.
    This method will be called from JSP by this way
    s:property value="getGeneratedPDF()" />
    But It displayed Junk Characters , and this PDF is not static (already Generated). It is generated and build on Fly.
    I have 2 questions 1 -- How to display PDF in JSP in proper way without Junk Character in it?
    questions 2 -- How to display it in Iframe?
    Please help me , If you know the solution.
    Thanks in Advance,
    Jimmy

    jamy_26 wrote:
    But It displayed Junk Characters , and this PDF is not static (already Generated). It is generated and build on Fly.A PDF file is a binary file, not a text file, and you're trying to display it as String. Of course you would get "junk characters". Have you ever tried opening a binary file (pdf, doc, jpg, xls, etc) using a text editor like Notepad?
    I have 2 questions 1 -- How to display PDF in JSP in proper way without Junk Character in it?Display it as binary stream, not as text stream. You can display it standalone, just let the link/form/addressbar URL point to some Servlet which writes the InputStream of the PDF file to the OutputStream of the response, along with a correct set of response headers (at least content-type, content-disposition and content-length), so that the browser can open it in the correct application (which is usually Acrobat Reader). If you want to embed the PDF file in a JSP, then one of the ways is indeed using the HTML <iframe> tag.
    questions 2 -- How to display it in Iframe? Just let the iframe URL point to the aforementioned Servlet.
    You can find here an example of a generic file servlet, you may find it useful to get the idea how to do it: [http://balusc.blogspot.com/2007/07/fileservlet.html].

  • How to identify database records without using rowid.

    Hello,
    I want to find a way to identify records uniquely in my database without the use of the rowid.
    What I want to do is the following :
    I have a table that contains images. Something like that :
    Table images (id number, image blob).
    Lets say that in this table I have scanned images of persons, invoices and orders.
    I want to be able to associate a record with different records from different tables from my ERP via an association table.
    this table could be :
    Table image_associations (imageid number, rowid_column varchar2(100))
    The "rowid_column" would contain the rowid of the row that is associated with the image.
    The problem is that the rowid is something that changes (for example after export/import).
    So I do not want to use rowid.
    Any ideas?
    Thanks

    What you are saying is you want to avoid theaccepted relational design theory and subvert the
    fundamental principles of very model?
    Yes !!!!Then you are very short sighted and will fail. Why would you want to do this? How is it that you think you are smarter than the forefathers of our industry? an idea so compelling that huge companies have many massive profits implementing the concepts? (sometimes even properly) and how is it that you imagine you can work outside the concepts underlying those tools, within the tool and come to a better solution? this is arrogance surely.
    >
    I think a lot of people use rowid to identify within
    plsql code a record instead of using the table-key.
    There is very limited specific application of the ROWID for temporary reference within known bounds.
    You shouldn't rely on the ROWID. Think about what it actually is: a physical location address hash.
    Don't use it. Just don't.
    As I can remember from my classrooms (a lot of years
    ago) rowid was never mentioned in ER models. Still
    that helps a lot..For very good reason. Rowid is an implementation concept, and not a logical concept.
    Oracle already makes provision at the physical storage level to store BLOBs out of line with a record. You don't need to try to do this at the logical level as I said already.

  • How to search on Time Machine using Yosemite OS X?

    Is searching on Time Machine different using Yosemite OS X?

    Hi Bruce,
    This article give an excellent explanation of how to search in Time Machine under Mac OS X 10.10 (Yosemite).
    OS X Yosemite: Recover items using Time Machine and Spotlight
    Thanks for using Apple Support Communities.
    Best,
    Brett L 

  • How to include servlet in JSP using Include Directive?

    Hi experts,
    am a beginner to JSP.. I want to know,
    is it possible to include a servlet in jsp using include directive? could any one explain me...

    No it is not possible.
    Include directive is like copying and pasting some text into a JSP file, and then translating/compiling it.
    So the only thing you can include with the <%@ include %> directive is a jsp fragment
    It is a static translation/compile time include and thus will always be the same
    By contrast <jsp:include> is a runtime include, and includes the result of running the imported url.
    That URL has to be a complete/standalone jsp/servlet/whatever. However as it is runtime, it can take parameters where the include directive can not.
    Does that answer your homework question?
    Cheers,
    evnafets

  • How to pass paramter JHeadstart jsp using setCurrentRowWithKeyValue

    How i can use setCurrentRowWithKeyValue or other ADF function to pass one value to JSP / JHS page and Jheadstart give me rows matching this parameter value passed to this page
    JHS use setCurrentRowWithKey but now i need to pass a value not a rowkey
    for example an deptno to emp.jsp page
    <a href="Emp.do?event=setCurrentRowWithKeyValue&deptno=10/>FetchValues</a>
    this is possible ? there is an easy way to do this ?
    tnx                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Hi sandra tnx for response my question is how to be in capacity of access any JSP page on my JHS Proyect directly using programmatic links depending of some situations.
    There are some master pages that have details pages for example on simple oe schema
    Customer -> Orders Page -> Order Items
    How from Customer Page i can directly call and Order Items Page and pass parameters?
    if i use native JHS navigation functionality when i click details on Customer page JHS pass parameter and save some info on session depending of row key selected and show Orders Page
    There is a way Having a link on Customer page call a programmatic event onSaveSomeParam save param of Order Number and then call Orders Items page ?
    I also try using native search functionality of JHS
    a href="orditem.do?queryOperatorNonString=is&queryOperatorString=startsWith&event=quickSearch&eventValue=true&searchAttribute=Id&searchText=<c:out value="${orditems.Id}"/>">Order Items
    off course it send me an missing IN OUT parameter because JHS is waiting for
    Orders Page param to be set
    If u have some sample code i really appreciate
    tnx....
    Mensaje editado por:
    mr2k

  • How to create database from scratch using user input

    what I am trying to do is to create database via my java code (using hibernate and my sql) and based on user input.
    The details like the name of table.... or the number of columns in it are all supposed to be determined from user input (only the first time).
    On subsequent run the program should remember the previously created database and hence work with it.
    Can somebody help me through this?
    Suppose I did create it using firing queries from my program then the next problem is how my program would start up next time......?????

    Anuvrat wrote:
    what I am trying to do is to create database via my java code (using hibernate and my sql) and based on user input.
    The details like the name of table.... or the number of columns in it are all supposed to be determined from user input (only the first time).
    On subsequent run the program should remember the previously created database and hence work with it.
    Can somebody help me through this?Presumably because you want to (fun) rather than because you need to (job or project.)
    If the second then don't do it.
    >
    Suppose I did create it using firing queries from my program then the next problem is how my program would start up next time......?????You would start by learning about DDL which is the common name for the languages, which vary by database, used to create the entities that represent the structure of a database. Until you figure out the syntax of that you can't do anything in java.

  • How to access database from applet using connection pooling.

    Hi,
    I am using tomcat 4.1, JRE 1.4.2_10, MySQL 5.0, and IE 6.0. I can access the database using connection pooling from JSP without problems. But, if I try to acess from the applet, I get the following exception (related to JNDI.):
    javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
    at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
    at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
    at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)
    at javax.naming.InitialContext.lookup(Unknown Source)
    I know what this acception means, but I don't know how to fix it. I set up connection pooling in my Tomcat 4.1 that talks to MySQL 5.0. As I said, when I access from jsp, JNDI works. But, applet complains. Please help. In my applet, the following code accesses the database:
    ArrayList toolTipData =
          access.getToolTipData (projectName,interfac);This is the snipet of my Access class:
    public ArrayList getToolTipData (String projectName, String interfac) {
        System.out.println("In getToolTipData");
        ArrayList toolTipData = new ArrayList();
       try{
        Context ctx = new InitialContext();
        if(ctx == null )
            throw new Exception("No Context");
        DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/interfacesDB");
        if (ds != null) {
          Connection conn = ds.getConnection();
          if(conn != null)  {
              Statement s = conn.createStatement();
              //For some reason paramtized queries don't work, so I am forced
              //to this in slighly less eficient way.
              ResultSet rst = s.executeQuery("select * from interfaces");
              while (rst.next()) {
                 if (rst.getString("Project_Name").equals(projectName) &&
                     rst.getString("Interface").equals(interfac)) {
                   System.out.println("getToolTipData: ITG #" + rst.getString("ITG"));
                   toolTipData.add("ITG #: " + rst.getString("ITG"));
                   toolTipData.add("SPNE Prime Name: " +
                                   rst.getString("SPNE_Prime_Name"));
                   toolTipData.add("PD Prime Name: " +
                                   rst.getString("PD_Prime_Name"));
                   toolTipData.add("IT Prime Name: " +
                                   rst.getString("IT_Prime_Name"));
                   toolTipData.add("MLC Priority: " +
                                   rst.getString("MLC_Priority"));
                   toolTipData.add("Gary's Prime: " + rst.getString("Garys_Prime"));
                   toolTipData.add("QA Prime: " + rst.getString("QA_Prime"));
                   toolTipData.add("Brief Description: " +
                                   rst.getString("Brief_Description"));
                   toolTipData.add("Project_Status: " +
                                   rst.getString("Project_Status"));
              conn.close();
      }catch(Exception e) {
        e.printStackTrace();
      return toolTipData;
    ....

    The jsp runs on the server, whereas the applet runs on the client so
    you must package with your applet any jndi implementation specific classes
    and
    Properties props = new Properties();
    props.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory" );
    props.setProperty("java.naming.provider.url", "url:1099");
    Context ctx = new InitialContext(props);
    Object ref = ctx.lookup("...");

  • How to search users in Outlook Using Last Name and First Name

    During recent times we change the naming convention in AD, FirstName , LastName
    We can search users using More Columns but I would like to know alternate method to search users. The search result should sort results by last name as query
    Regards Chen V [MCTS SharePoint 2010]

    Hi Chen,
    Based on my knowledge, there is no related method to enforce all users using More Columns as the default search option in Outlook Address Book. We can just change the search option for individual Outlook user by remembering the last search using as I mentioned
    above.
    Sorry for any inconvenience and thanks for your understanding.
    Regards,
    Winnie Liang
    TechNet Community Support

  • How to resize image in JSP using JAI ??!!

    Please help me how to resize an JPEG image from my JSP, could I use JAI lib ? how ?

    Hello,
    I had the same problem few months ago ( in that case i used Jimi instead of JAI).
    The answer to your question is: use the java class called "Image".
    Infact you can use JAI just for load or save to disk your image that you have to resize and then use the following code to resize the image :
    Image imgResized = img.getScaledInstance(100,1,Image.SCALE_AREA_AVERAGING);
    The object "img" is the image to resize and the object "imgResized" is the image resized with width equals to 100 and with a right height.
    I used Jimi just to save my image and i think that with JAI there is a method to do this.
    You can use JAI to load in memory your image too so you can avoid problem with MediaTraker class.
    I hope that this can help you.
    Cheers.
    Stefano

  • How to set JavaBean in JSP using JavaScript function

    Hello,
    When a user clicks on an item, I want to execute a JavaScript function. Within that function, I want to set specific JavaBeans (<jsp:setProperty... />) within my JSP page.
    Can anyone tell me how to do this or where I can find examples on how to set JavaBeans in a JSP page using JavaScript?
    Thanks.
    Pat

    try this:
    your.jsp
    <html>
    <SCRIPT>function buttonClick()
    {document.compform.submit();}
    </SCRIPT>
    <body>
    <form name=compform method=post action='your.jsp'>
    <%
    //write your code which you want to execute once the button is submitted
    String submit;
    submit=request.getParameter("mysubmit");
    if ((submit != null) && (! submit.equals("")))
    %>
    <input type=hidden name=mysubmit value="submit">
    <input type=button value=add onclick='buttonClick()'>
    </form></body></html>

Maybe you are looking for

  • Safari Hijacked and Certificates that won't go away.  Malware?

    Four times over the last 4 or 5 months "something" hijacks Safari and freezes it. The first 3 times I was in Google.   I clicked on a site, it would freeze Safari and I would get a message from an unrelated website telling me to call a number for App

  • Adding photos in iPhoto 6 to make a book

    when I add some pictures to create a book the picture has a yellow triangle in the corner with a exclamation mark in it and a message that the picture is not composite. Will the yellow triangle be in the book picture or will the picture not print in

  • Error in Business Rule Decision Service's wsdl

    Hi, Getting strange error which i am unable to sort out. Pleaseeee help. Error message is "Error Message: {http://xmlns.oracle.com/OrderPORules/OrderPORules_DecisionService_1}operationErroredFault Fault ID default/OrderBooking!1.0*soa_e118292f-eb55-4

  • ORA-01427: single-row subquery returns more than one row -- no solution

    Hello to all: I have to tables: Table a anwender (Email,Dept). --> all fields are filled Table b dingo (Name,email,dept) --> all fields are filled I now want to update the table a with the data from table b: update anwender a set a.abteilung = ( sele

  • "Unexpected End of File Occurred". What is this and how do I fix it?

    I just downloaded files into Lightroom 3 from a new 32 gig CF card from my Nikon D700. When I went to the develop module some of the images had a dialogue box come up saying "Unexpected End of File Occurred". I have never seen this before. Does anyon