Database operations in JSP

I am a java programmer but new to JSP and web site design.
now am , designing a website for a bank in which I need to have database operations.from tutorials i see we can use beans or tag lib.
which is the best in these 2?
which is the simplest in these 2?
and which one to select?
is there any basic doc for this with step by step explanation?
thank you for any help.
joe

sorry that was for the previous jsp. this is for the file i need.
2007-04-09 09:46:52 StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: /dbquerySimple.jsp(8,5) Invalid standard action
     at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
     at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:357)
     at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:81)
     at org.apache.jasper.compiler.Parser.parseStandardAction(Parser.java:1249)
     at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1559)
     at org.apache.jasper.compiler.Parser.parse(Parser.java:126)
     at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:220)
     at org.apache.jasper.compiler.ParserController.parse(ParserController.java:101)
     at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:203)
     at org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
     at org.apache.jasper.compiler.Compiler.compile(Compiler.java:422)
     at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:507)
     at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:274)
     at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
     at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
     at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
     at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
     at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
     at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
     at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
     at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
     at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
     at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:793)
     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:702)
     at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:571)
     at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:644)
     at java.lang.Thread.run(Thread.java:534)

Similar Messages

  • Checking Oracle Database availblity using JSP

    Hello All,
    How to check the database availablity using JSP like whether the TNS Listener is up or not, or the whole database is up or not.
    Thanks
    Rahul

    Hi,
    To see if your listener is up or down you can use the lsnrctl status, and to start use start option. You can make a similar operation for database, use the sqlplus program.
    Another option is program a batch script, if you wan't use the commands.
    Afonso

  • Database access in JSP?

    Can I easily access MS access using JSP? If it is, what kind of drive should be used to access the MS Access database?
    Thank you so much!

    <%!
    // define database parameters
    String host="localhost";
    String user="";
    String pass="";
    String db="";
    String conn;
    %>
    <%
    Class.forName("org.gjt.mm.mysql.Driver");
    // create connection string
    conn = "jdbc:mysql://" + host + "/" + db + "?user=" + user + "&password=" +
    pass;
    // pass database parameters to JDBC driver
    Connection Conn = DriverManager.getConnection(conn);
    // query statement
    Statement SQLStatement = Conn.createStatement();
    This is when accessing a database in a JSP, not a javabean... Try searching this forum, there are LOTS of topics about this.

  • Ifs-21030 Database operation timed out

    Hi,
    We have installed cmsdk 9.0.4.2.2 with oas10g 10.1.2.0.2. The application runs fine, but sometimes we got the following error:
    [AJPRequestHandler-ApplicationServerThread-6] ERROR cmsdk.CmsdkUtil - Error with gettting document
    oracle.ifs.common.IfsException: IFS-21030: Database operation timed out
    java.sql.SQLException: ORA-01013: user requested cancel of current operation.
    I have set the IFS.SERVICE.SESSION.DefaultSearchTimeoutPeriod, but it doesn't help. Normally the documents are displayed immediately, but when the error occurs, it can take 30 min or more. Mostly, but not always, the error occurs on monday morning, while getting the first or second document after the weekend in which the application is not used. Sometimes the first documents comes up immediately, and the second gives the error.
    Are the parameters, agents, sessions, .. to configure to avoid this problem?
    Can anyone help me with this?
    Regards,
    Els

    I forgot to mention that we use a webservice. This is the complete error from the OC4J instance, found in the <oracle home>\opmn\logs dir
    oracle.ifs.common.IfsException: IFS-21030: Database operation timed out
    java.sql.SQLException: ORA-01013: user requested cancel of current operation
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:137)
         at oracle.jdbc.driver.T2CConnection.checkError(T2CConnection.java:698)
         at oracle.jdbc.driver.T2CConnection.checkError(T2CConnection.java:630)
         at oracle.jdbc.driver.T2CPreparedStatement.doDefineExecuteFetch(T2CPreparedStatement.java:1142)
         at oracle.jdbc.driver.T2CPreparedStatement.execute_for_rows(T2CPreparedStatement.java:1010)
         at oracle.jdbc.driver.OracleStatement.execute_maybe_describe(OracleStatement.java:1022)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1109)
         at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2932)
         at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:2973)
         at oracle.ifs.server.S_LibrarySession.executeQuery(S_LibrarySession.java:16561)
         at oracle.ifs.server.S_LibraryObjectSelector.findObjectById(S_LibraryObjectSelector.java:556)
         at oracle.ifs.server.S_LibraryObjectSelector.selectObjectById(S_LibraryObjectSelector.java:494)
         at oracle.ifs.server.S_LibrarySession.constructLibraryObjectData(S_LibrarySession.java:8024)
         at oracle.ifs.server.S_LibrarySession.getLibraryObjectData(S_LibrarySession.java:7811)
         at oracle.ifs.server.S_LibrarySession.getLibraryObject(S_LibrarySession.java:8283)
         at oracle.ifs.server.S_LibrarySession.getPublicObject(S_LibrarySession.java:8407)
         at oracle.ifs.server.S_LibrarySession.DMgetPublicObjectData(S_LibrarySession.java:8051)
         at oracle.ifs.beans.LibrarySession.DMgetPublicObjectData(LibrarySession.java:13209)
         at oracle.ifs.beans.LibrarySession.getPublicObject(LibrarySession.java:4944)
         at be.kindengezin.cmsdk.CmsdkUtil.getDocument(CmsdkUtil.java:74)
         at be.kindengezin.cmsdk.CmsdkUtil.getDocumentMimeType(CmsdkUtil.java:91)
         at be.kindengezin.cmsdk.content.CmsdkContentServlet.doGet(CmsdkContentServlet.java:41)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:824)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:830)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:224)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:133)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
         at java.lang.Thread.run(Thread.java:534)
    kind regards,
    Els

  • When and How to close database connection in JSP?

    Hi there,
    I am using MySQL and JDBC 3.0, in my system, When and How to close database connection in JSP?
    Thanks in advance.
    Lonely Wolf
    <%@ page session="true" language="java" %>
    <jsp:include page="checkauthorization.jsp" />
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
    <%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql" %>
    <%--
    Execute query, with wildcard characters added to the
    parameter values used in the search criteria
    --%>
    <sql:query var="availablecomputerList" dataSource="jdbc/Bookingcomputer" scope="request">
    SELECT * FROM computer where status=0
    order by s_code
    </sql:query>
    <html>
    <head>
    <title>Search Result</title>
    </head>
    <body bgcolor="white">
    <center>
    <form action="checkin.jsp" method="post">
    <input type="submit" value="Back to Check-in Page">
    </form>
    <c:choose>
    <c:when test="${availablecomputerList.rowCount == 0}">
    Sorry, no available computer found.
    </c:when>
    <c:otherwise>
    The following available computers were found:
    <table border="1">
    <th>Computer</th>
    <th>Description</th>
    <th>Status</th>
    <c:forEach items="${availablecomputerList.rows}" var="row">
    <tr>
    <td><c:out value="${row.s_code}" /></td>
    <td><c:out value="${row.description}" /></td>
    <td><c:out value="${row.status}" /></td>
    </tr>
    </c:forEach>
    </table>
    </c:otherwise>
    </c:choose>
    </center>
    </body>
    </html>

    when should you close the connection? when you're done with it.
    how should you close the connection? like this: conn.close();
    that said, doing this in a JSP page is bad form and not recommended
    JSP's typically don't contain ANY business or data logic

  • How to establish a MYSQL Database connection in JSP page.

    Hi People,
    Tell me how to establish mysql database connection in JSP page.
    Needed details on:
    1) what are all the mysql drivers need to be included.
    2) what is the syntax for establish a database connection

    hi,
    http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.htmlsee down for mysql config with tomcat

  • Sql database connection in jsp

    Hi,
    I am new to java.
    I know how to connect the database in the java using the javacodings [jdbc] but i am don't know how to connect the database using the jsp.
    Is it easy. If so, can any one help me in this regards.
    Any sample codes or white paper available.
    thanks in advance,
    Regards,
    sa

    Hi,
    Here's a simple application i write to test JSTL.
    Using JSTL is easier.
    Create a directory named tests in your webapps tomcat directoty.
    In this, create a web-inf dir and inside a lib dir.
    Copy JSTL.JAR ans STANDARD.JAR in tests/web-inf/lib/ which are lib for JSTL (found on apache foundation web site, jakarta implementation).
    Copy you jdbc driver in jakarta-tomcat/common/lib dir.
    Here is a file to input some data from an HTML form:
    Create saisie.jsp and record.jsp in you tests apps dir.
    saisie.jsp:
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
    <html>
    <head>
    <title>Simple Example</title>
    </head>
    <body>
        <h1> Saisie de donn�es  </h1>
        <form name="saisie" action="record.jsp" method="get">
            Code :<input type="text" name="code"/>
            Text :<input type="text" name="text"/>
            <input type="submit" name="submit"/>
        </form>
    </body>
    </html>and record.jsp:
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
    <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
    <%@ page isELIgnored ="false" %>
    <html>
    <head>
    <title>Simple Example</title>
    </head>
    <body>
    <sql:query var="result"  maxRows="100">
         select * from ess
    </sql:query>
    <table>
         <!-- Affichage de l'ent�te avec le nom des colonnes -->
         <tr>
         <c:forEach var="name" items="${result.columnNames}">
              <th>${name}</th>
         </c:forEach>
         </tr>
         <!-- Affichage des donn�es avec 'rowsByIndex' -->
         <c:forEach var="ligne" items="${result.rowsByIndex}">
         <tr>
              <c:forEach var="valeur" items="${ligne}">
                   <td>${valeur}</td>
              </c:forEach>
         </tr>
         </c:forEach>
    </table>
    <c:set var="code_id" value="${param.code}"/>
    <sql:update>
        INSERT INTO ESS (ID,TEXT) VALUES (?,?)
        <sql:param>${param.code} </sql:param>
        <sql:param>${param.text}</sql:param>
    </sql:update>
    </body>
    </html>Here's web.xml file to create in tests/web-inf dir:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
        PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
        "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
        <description>Learning JSTL (or whatever you like</description>
        <context-param>
              <param-name>javax.servlet.jsp.jstl.sql.dataSource</param-name>
              <param-value>jdbc:postgresql://127.0.0.1/gihe,org.postgresql.Driver,gihe,****<param-value>
         </context-param> 
    </web-app>web.xml contains the datasource definition, the jdbc driver, the url, user and password.
    saisie.jsp is a standard html file.
    record.jsp use web.xml datasource to connect to the database and use JSTL tag to insert some data.
    more explanations on java sun site.

  • IFS-21030 Database Operation time out

    Hi everyone,
    I really need help with this one. I try to search for a folder with a certain value for a custom attribute. It ALWAYS takes a very long time, but some times it returns successfully and sometimes it gives me a "Database Operation timed out" IFSException.
    I tried to change the attribute setting to make it indexed, but it didn't help.
    I'm using Oracle Files 9.0.2 (which, I think uses CM SDK 9.0.3, or at least this is the jar I'm using on the client side).
    This doesn't happen with all folder queries, just the query where I use the
    FolderRestrictQualification.setMultiLevel(true)
    Can anyone help me with this?

    setMultiLevel(true) enables folder recursion, of course, which can be an expensive operation, depending on how many levels deep you need to go.
    how many subfolders (and documents) are we talking about here?
    .rich

  • Problem in Oracle Database Connectivity in JSP

    I am having big problem such as Oracle Database connectivity problem
    Following code i am used for database connection. but it throw an exception call class not found exception.
    Pls any one can help me. With a sample code for Oracle Database connection in JSP
    Class.forName ("oracle.jdbc.driver.OracleDriver");
    String url="jdbc:oracle:thin:@172.25.44.54:1521:bbo";
    con = DriverManager.getConnection(url,"user", "user123");
    Thank you

    Well i've never used oracle or their drivers before but i'm presuming that you'd go to oracle.com or something and look for downloads. Otherwise you could goodle for Oracle JDBC drivers. Then just follow the instructions.
    Again i've never used JSP but if you have a manifest file somewhere you'll need to put a class-path: entry in their referecning the jar file with the driver so that it is availble at run-time.
    Wes

  • How to improve perfomance in database operations

    In my programme i do some select, insert operations many time. so when i run my program with atlease 80000 customer data it takes 1 hrs to complete the task.
    So i switched to use threads. So i use n number of threads and gave a new connection to each thread and splited my customer data for each threads. so each thread contain 80000/n data.
    when i check the perfomance both (with and without thread) are equal
    so help me to improve the perfomance :)

    s friend. most of the time it invokes the database operations. i use addbatchs to execute the code. wait i will give the timelines,
    :AbstractRuleBasedScenario:run:test2---- is the time to execute the query
    :pool-1-thread-1:KYCScenarioTask:call:pool-1-thread-1---- is the time to run a thread
    with 1 thread
    01/04/07 10-33:pool-1-thread-1:AbstractRuleBasedScenario:run:test2 Time:::: 62
    01/04/07 10-33:pool-1-thread-1:AbstractRuleBasedScenario:run:test2 Time:::: 0
    01/04/07 10-33:pool-1-thread-1:KYCScenarioTask:call:pool-1-thread-1 ::: 94
    01/04/07 10-33:pool-1-thread-1:AbstractRuleBasedScenario:run:test2 Time:::: 63
    01/04/07 10-33:pool-1-thread-1:AbstractRuleBasedScenario:run:test2 Time:::: 31
    01/04/07 10-33:pool-1-thread-1:KYCScenarioTask:call:pool-1-thread-1 ::: 125
    01/04/07 10-33:pool-1-thread-1:AbstractRuleBasedScenario:run:test2 Time:::: 63
    01/04/07 10-33:pool-1-thread-1:AbstractRuleBasedScenario:run:test2 Time:::: 0
    01/04/07 10-33:pool-1-thread-1:KYCScenarioTask:call:pool-1-thread-1 ::: 109
    with 5 threads[
    01/04/07 10-29:pool-1-thread-3:AbstractRuleBasedScenario:run:test2 Time:::: 125
    01/04/07 10-29:pool-1-thread-1:AbstractRuleBasedScenario:run:test2 Time:::: 125
    01/04/07 10-29:pool-1-thread-2:AbstractRuleBasedScenario:run:test2 Time:::: 62
    01/04/07 10-29:pool-1-thread-2:KYCScenarioTask:call:pool-1-thread-2 ::: 266
    01/04/07 10-29:pool-1-thread-4:AbstractRuleBasedScenario:run:test2 Time:::: 32
    01/04/07 10-29:pool-1-thread-3:AbstractRuleBasedScenario:run:test2 Time:::: 63
    01/04/07 10-29:pool-1-thread-1:AbstractRuleBasedScenario:run:test2 Time:::: 47
    01/04/07 10-29:pool-1-thread-4:KYCScenarioTask:call:pool-1-thread-4 ::: 281
    01/04/07 10-29:pool-1-thread-3:KYCScenarioTask:call:pool-1-thread-3 ::: 312
    01/04/07 10-29:pool-1-thread-1:KYCScenarioTask:call:pool-1-thread-1 ::: 250

  • Oracle BR0973W Database operation alert warning

    Hello experts,
    I hope you can help me with the following:
    In transaction DB13 the checkdb job reports the following errors:
    BR0973W Database operation alert - level: WARNING, operation: sdvgirhz.dbp, time: 2007-05-14 15.46.27, condition: Last 'dbp' operation failed with rc = 4
    BR0973W Database operation alert - level: WARNING, operation: sduxubpz.tse, time: 2007-03-30 08.58.27, condition: Last 'tse' operation failed with rc = 4
    BR0973W Database operation alert - level: WARNING, operation: sduxuaou.dfa, time: 2007-03-30 08.46.40, condition: Last 'dfa' operation failed with rc = 2
    I would like to get rid of these messages in dbcheck but can't figure out how to do it.
    I searched the notes database, google and this forum and still couldn't find an answer.
    Some data regarding oracle and sap versions:
    SAP_ABA     700     0009     SAPKA70009     Cross-Application Component
    SAP_BASIS     700     0009     SAPKB70009     SAP Basis Component
    PI_BASIS     2005_1_700     0006     SAPKIPYJ76     PI_BASIS 2005_1_700
    ST-PI     2005_1_700     0003     SAPKITLQI3     SAP Solution Tools Plug-In
    SAP_BW     700     0006     SAPKW70006     SAP NetWeaver BI 7.0
    SAP_AP     700     0003     SAPKNA7003     SAP Application Platform
    BBPCRM     500     0003     SAPKU50003     BBPCRM
    ST-A/PI     01I_CRM500     0000          -     Application Servicetools for CRM 500
    Database system      ORACLE   
    Release              10.2.0.2.0
    Thanks in advance for helping.
    Regards
    Dirk Visser

    the operations mentioned were not succesfully done...check the corresponding logfiles
    -> dbp = alter database parameter (brspace)
    -> tse = extend tablespace (brspace)
    -> dfa = alter data file (brspace)
    GreetZ, AH

  • How to display Column Names of a Database Table in JSP

    Dear All,
    I want to display all the attribute names(column names) of a database table on JSP.
    [ ex:  mytable contains : ( EmpId,EmpName,Dept ). This should be display as  EmpId--text box                    
    EmpName--text box
    Dept----textbox
    please note , i don't want to display values,but only column names

    Yeah make use of methods like
    ResultSet DatabaseMetaData.getColumns(String catalog, String schemaPattern, String tableName, String columnNamePattern)
    else use
    String ResultMetaData.getColumnName(int column_index)
    search google i'm sure u wud get thousands of example on it... :)

  • Database Access through JSP

    Hi im trying to access my ORACLE database through a jsp program. The page loads up in the browser, no errors or anything like that, but i get no output.
    I am running things on localhost with TomCat 3.2.3
    Here is the code, any help gratefully appreciated.
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE>Testing Database Access</TITLE>
    </HEAD>
    <BODY BGCOLOR="#FDF5E6" TEXT="#000000" LINK="#0000EE"
    VLINK="#551A8B" ALINK="#FF0000">
    <CENTER>
    <TABLE BORDER=5 BGCOLOR="#EF8429">
    <TR><TH CLASS="TITLE">
    Testing Database Access</TABLE>
    </CENTER>
    <P>
    <P>
    Here Is what Might be in the Database
    <P>
    <%@ page language="java" %>
    <%@ page import="java.util.*" %>
    <%@ page import="oracle.jdbc.driver.*" %>
    <%@ page import="java.io.*" %>
    <%@ page import="java.sql.*" %>
    <%
         try
    %>
    <%
         DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
         String username = "Donnchadh", password = "zcbu5mya";
         Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@kiwi.isg.computing.dcu.ie:1521:kiwi",username,password);
         java.sql.Statement stmt = conn.createStatement();
         String query = "SELECT * FROM PERSONALS";
         ResultSet rs = stmt.executeQuery(query);
         while(rs.next())
              int ccount = rs.getMetaData().getColumnCount();
              for( int i = 1; i <= ccount; i++ )
                   System.out.print(rs.getString(i)+"\t");
              System.out.println();
    %>
    <%
         rs.close();
         stmt.close();
         if(conn != null)
              try
                   conn.close();
              catch(Exception e)
                   return;
         catch(Exception e)
              return;
    %>
    <P>
    </BODY>
    </HTML>
    I have also tried to access columns directly with this code in the while loop
    while(rs.next())
                        String Title = rs.getString("title");
                        String FName = rs.getString("fname");
                        String LName = rs.getString("lname");
                        String Phone = rs.getString("phone1");
                        String Phone2 = rs.getString("phone2");
                        String Addr = rs.getString("addr");
                        String County = rs.getString("county");
                        String Country = rs.getString("country");
                        out.println("<tr><td>" + Title + "</td><td>" + FName + "</td><td>" + LName
                        + "</td><td>" + Phone + "</td><td>" + Phone2 + "</td></tr>" + "</td></tr>" + Addr
                        + "</td></tr>" + County + "</td></tr>" + Country + "</td></tr>" );

    i give a servlet access to oracle ,that have test ok!
    import java.sql.*;
    import javax.servlet.*;
    import javax.sql.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.util.*;
    public class TestServlet1 extends HttpServlet {
    private static final String CONTENT_TYPE = "image/jpeg; charset=GBK";
    //Initialize global variables
    String strRno =null;
    ResultSet rs=null;
    byte [] buf=null;
    InputStream in;
    int IntNo;
    public void init() throws ServletException {
    //Process the HTTP Get request
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    response.setContentType(CONTENT_TYPE);
    // PrintWriter out = response.getWriter();
    // System.out.println("TEst database prepaired ok��");
    strRno = request.getParameter( "PictNo" );
    IntNo = 0;
    if( strRno != null ) {
    try { IntNo = Integer.parseInt( strRno ); }
    catch( NumberFormatException e ) {
    strRno = null;
    System.out.println("��������������������"); }
    else
    System.out.println("��������������������");
    if( strRno == null ) {
    // response.sendError( HttpServletResponse.SC_NOT_FOUND );
    return;
    try {
    Class.forName("oracle.jdbc.driver.OracleDriver");
    catch (ClassNotFoundException ex2) {
    //      out.println("TEst2��");
    // System.out.println("TEst2�� ex2��");
    String url="jdbc:oracle:thin:@erdos00:1521:erdos";
    Connection con = null;
    try {
    con = DriverManager.getConnection(url, "system", "manager");
    catch (SQLException ex1) {
         //out.println("TEst�� ex1");
         System.out.println("TEst�� ex1��");
    // PreparedStatement sql=con.PrepareStatement("select photo from blob_test WHERE rno = IntNo" );
    PreparedStatement sql = null;
    try {
    sql = con.prepareStatement("select photo from blob_test WHERE rno = 14 ");
    // sql = con.prepareStatement("select photo from blob_test WHERE rno = " +"+ IntNo +" );
    catch (SQLException ex) {
         //out.println("TEst�� ex");
         System.out.println("TEst�� ex��");
    //method prepareStatement(sting) not found in interface java.sql.connection
    // sql.setInt( 1, rno );
    try {
    rs = sql.executeQuery();
    catch (SQLException ex3) {
         //out.println("TEst�� ex3");
         System.out.println("TEst�� ex3");
    System.out.println("TEst database operate ok��");
    // out.println("TEst database operate ok��");
    //��������������������
    try {
    if (rs.next()) {
    buf = rs.getBytes(1);
    in = rs.getBinaryStream("photo");
    else {
    buf = new byte[0];
    }catch (Exception e){
    //throw e;
    response.reset();
    //������image/jpeg������������������������
    response.setContentType("image/bmp");
    // ��bmp��jpeg
    byte[] b = new byte[1024*1024];
    int len;
    while((len=in.read(b)) >0)
    response.getOutputStream().write(b,0,len);
    OutputStream out1 = response.getOutputStream();
    out1.flush();
    out1.write(buf);
    in.close();
    try {
    rs.close();
    catch (SQLException ex4) {
    // out.println("<html>");
    // out.println("<img src='http://192.168.0.1/examples/servlet/TestServlet1?PictNo="+IntNo+"'>");
    // out.println("</html>");
    out.println("<html>");
    out.println("<head><title>TestServlet</title></head>");
    out.println("<body bgcolor=\"#ffffff\">");
    out.println("<p>The servlet has received a GET111111111. This is the reply.</p>");
    out.println("</body></html>");
    //Process the HTTP Post request
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    response.setContentType(CONTENT_TYPE);
    PrintWriter out = response.getWriter();
    out.println("<html>");
    out.println("<head><title>TestServlet</title></head>");
    out.println("<body bgcolor=\"#ffffff\">");
    out.println("<p>The servlet has received a POST. This is the reply.</p>");
    out.println("</body></html>");
    //Process the HTTP Put request
    public void doPut(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    //Process the HTTP Delete request
    public void doDelete(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    //Clean up resources
    public void destroy() {
    hope u can get some thing from that

  • Database query from jsp

    hi! All
    i am making the following query to the MySQL database from a jsp page but I get error. please help.
    i am asking user to type in first few letters of person's first name and i use that string to find the match.
    String getName = request.getParameter("search_name"); // gets the few letters entered by user
    // fname is a field in the Employee table
    rs = statement.excuteQuery("Select fname, lname, from Employee where fname.indexOf('" + getName + "') != -1");
    Thanks in advance

    It looks like you have Java code in your select statement.
    I don't know what database your using but you want something
    like this.
    <%
    String getName = request.getParameter("search_name");
    /* I use ingress for my rdms and in ingress you use the keywork 'like'
       to match against character data. The '%' character is the wild card. So, this
       query looks for fname's that have any number of characters followed
       by the value stored in the java string getName, followed by any
       number of characters. */
    rs = statement.excuteQuery("Select fname, lname, from Employee where fname like '%" + getName + "%'");
    %>-S-

  • Yellow status after "No database operations necessary, data unchanged"

    Hi,
    I am loading master data (full) and for some packages I get the message "No database operations necessary, data unchanged" the processing remains with status yellow (no "processing end" message comes for those packages). In the end, I get a red status because it times out.
    Has anyone encountered this problem before? Any idea appreciated
    Thanks!
    Andreea

    Hi,
    In case of master data, the update option for infoobject is overwrite. So if u are trying to load the same data again and again or if no changes are there in the new request at that time u may get this type of error. i am not sure about it. Check once more.
    Hope this helps u a lot.........
    <REMOVED BY ADMIN - DO NOT ASK FOR POINTS>
    Regards
    Ramakrishna Kamurthy
    Edited by: Craig Cmehil on Jul 17, 2008 9:24 AM

Maybe you are looking for