Connecting to a database in JSP but using connection in bean

I have a bean which connects to a database which is as follows:
package MyPackage;
import java.sql.*;
public class DataSourceBean{
        public DataSourceBean(){
     public void setDriver(String driver) throws ClassNotFoundException {
          Class.forName(driver);
     public void setUrl(String aUrl){
          url=aUrl;
     public void setUsername(String aUsername){
          username=aUsername;
     public void setPassword(String aPassword){
          password=aPassword;
     public static Connection getConnection() throws SQLException{
          return DriverManager.getConnection(url, username, password);
     private static String url;
     private static String username;
     private static String password;
}I then connect to a database through my JSP page:
<jsp:useBean id="db" class="MyPackage.DataSourceBean" scope="application">
   <jsp:setProperty name="db" property="driver" value="sun.jdbc.odbc.JdbcOdbcDriver" />
   <jsp:setProperty name="db" property="url" value="jdbc:odbc:MyDB" />
</jsp:useBean>This opens the database for the session, but I then want to allow people to login using a seperate bean.
My question is how do I use the connection created in the JSP page above in my login bean?
I have also tried connecting to a database in my LoginBean by using:
DataSourceBean dsb=new DataSourceBean();
yet it doesn't recognise DataSourceBean for some reason.
BTW my book suggests opening up the database using scope="application" but to me it seems that keeping the database open is risky, is it OK to keep the database open for the whole session? do you have any other suggestions for accessing the database through my DataSourceBean?
Thanks for any help.

hi shock,
there are a number of considerations when it comes to the database connections.
first of all is the database server yours or are you buying a hosting scheme?
if the database server is yours then you may consider building a database connection pool and keeping it in a session parameter. there's no harm in that because connections are opened as needed and closed when not needed. you can specify the minimum and maximum number of connections and connectio keep-alive times.
if you purchase your database from a host they possibly would object to having a db connection pool as connections are valuable for them. but in this case there is no harm to create a connection to the database per request because creating database connections are costly only for the database server. your application will not slow down that much.
for performance check sites: www.crystaltours.com or www.seckinkonaklar.com
in both sites all connections are created per request and the complete content (including menus and application properties) comes from the database.
my suggestion is that if you are writing a commercial application that will be hosted in a server that is not yours then create a connection per request (no pooling here).
i also would suggest to put your database access code in a single class -not in a bean- for easy maintenance, you can use that class in your beans.
i hope this was your answer.
cem.

Similar Messages

  • Problem connecting oracle database to jsp pages using Apache Tomcat server 8.0

    Well...I tried too many things..googled so many times..but still could not find solution to my problem.
    I use windows 8 Enterprise Edition(if this has to do something with the problem)
    Oracle 11.2.0
    Apache Tomcat server 8.0
    JDK 1.7
    My oracle is installed in the D: drive and tomcat in c:. i copied the ojdbc6.jar file from oracle to lib directory of tomcat server.
    Then i set  CLASSPATH in environment variables as "C:\Program Files\Apache Software Foundation\Tomcat 8.0\lib\ojdbc6.jar" in system variables
    My path variable is set as "C:\Program Files\Java\jdk1.7.0_02\bin".
    My program is as follows in notepad:
    <%@ page import="java.sql.*" %>
    <html>
    <body>
    <%
    Connection conn;
    Statement st;
    ResultSet rs;
    try{
    new oracle.jdbc.driver.OracleDriver();
    String dbURL="jdbc:odbc:oracle:thin:@localhost:1521:XE";
    String userId="system";
    String pwd="moon";
    conn=DriverManager.getConnection(dbURL,userId,pwd);
    st=conn.createStatement();
    rs= st.executeQuery("SELECT * FROM login");
    while(rs.next())
    System.out.println(rs.getString(1)+""+rs.getString(2));
    catch(Exception e){}
    %>
    </body>
    </html>
    I get too many errors then
    eroors
    org.apache.jasper.JasperException: An exception occurred processing JSP page /page2.jsp at line 14
    11: String userId="system";
    12: String pwd="moon";
    13:
    14: conn=DriverManager.getConnection(dbURL,userId,pwd);
    15: st=conn.createStatement();
    16:
    17: rs= st.executeQuery("SELECT * FROM login");
    Stacktrace:
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:455)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:403)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:347)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    root cause
    javax.servlet.ServletException: java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:905)
         org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:834)
         org.apache.jsp.page2_jsp._jspService(page2_jsp.java:102)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:403)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:347)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
         org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    Nothing solved this problem.

    >> Nothing solved this problem.
    Can't fix a problem 'till an actual problem is identified.
    >> ODBC Driver Manager ... Data source name not found
    That appears to be ODBC drivers looking for a DSN (Data Set Name). If it wants a DSN, the DSN has to be specified in the code, and the DSN has to be configured in the windows host ODBC applet. So that is at least two squirrels to get in the right tree before moving forward. A ...host:...[port:]SID|service name are some of the bits needed in a jdbc connect string, and that is in no way related to DSNs. A Whole Different Animal. If it wants a DSN that might be what needs to go in the URL bit.
    And ODBC setups can be confusing, especially if an x64 OS is in the mix- if that is the case there are two different ODBC configuration applets, one for x64 the other for x86, and if one gets as far as talking to an actual database it might toss an architecture error. Only way to fix that "problem" is *delete* the ODBC DSN and then run the correct (maybe the x86) ODBC config utility, and set up the DSN. Again.

  • Column Not found error while trying to access database through JSP+Java Bea

    I am trying to access MS Access 2003 db through JSP using Tomcat 5.0.28.The code for accessing the database is incorporated in the bean.The JSP only calls the particular method of the bean .
    Code for Java Bean:
    package ActiveViewer;
    import java.sql.*;
    import java.util.*;
    public class CompanyBean
    Connection con;
    ResultSet rs=null;
    Statement st;
    public CompanyBean(){}
    public void connect()
    try
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    System.out.println("Here4");
    con=DriverManager.getConnection("jdbc:odbc:activeviewer","","");
    System.out.println("Here1");
    catch (ClassNotFoundException e)
    System.out.println("Could not locate driver.");
    catch (SQLException e)
    System.out.println("An SQL Exception has occured :: "+e);
    e.printStackTrace();
    catch (Exception e)
    System.out.println("An unknown Exception has occured :: "+e);
    e.printStackTrace();
    public void disconnect()
    try
    if (con!=null)
    con.close();
    catch (SQLException e)
    System.out.println("An SQL Exception has occured :: "+e);
    e.printStackTrace();
    public ResultSet select(String username)
    if(con!=null)
    try
    st=con.createStatement();
    rs=st.executeQuery("select * from company where username='" + username + "'");
    catch (SQLException e)
    System.out.println("An SQL Exception has occured :: "+e);
    e.printStackTrace();
    catch (Exception e)
    System.out.println("An Exception has occured while retrieving :: "+e);
    e.printStackTrace();
    else
    System.out.println("Connection to database was lost.");
    return rs;
    The code for JSP that uses the above bean is:
    <%@ page language="java" import="java.sql.*,ActiveViewer.* " contentType="text/html"%>
    <jsp:useBean id="conn" scope="session" class="ActiveViewer.CompanyBean" />
    <html>
    <body>
    <% String username=request.getParameter("username");
    String password=request.getParameter("password");
    System.out.println("username:"+username);
    System.out.println("password:"+password);
    conn.connect();
    ResultSet rs=conn.select(username);
    System.out.println("Below select ");
    while (rs.next())
    String dbusername=rs.getString("username");
    String dbpassword=rs.getString("password");
    if(dbusername.equals(username) && dbpassword.equals (password))
    { %> out.println("OK");
    <% }
    else { %>Invalid Username and / or Password.
    <br>Clickhere to go back to Login Page.
    <% }
    } %>
    </body>
    </html>
    I get the following error:
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: Column not found
    though the database is not int he same folder as the jsp, the DSN is set correctly to pint to the db location.The jsp does print in stdout file:
    Here4 (from connect method above)
    Here 1 (from connect method above)
    Below Select (from jsp)
    This means that the jsp does connect to db but it gives the above error.Also the field name also matches that in the database and data is present in the db too.
    All other things like creating package for bean in WEB-INF/classes,incorporating the packakage are done.
    Can someone please help me with their precious advice?

    Hi, I too have a problem with an SQL exception, the message is Column not found.
    I'm using the sun jdbc odbc driver with access.
    the first few lines of the stack trace are
    sun.jdbc.odbc.JdbcOdbcResultSet.findColumn(JdbcOdbcResultSet.java:1852)
    sun.jdbc.odbc.JdbcOdbcResultSet.getInt(JdbcOdbcResultSet.java:603)
    net.homeip.sdaniels.MemberBean.ejbFindByUnamePwd(MemberBean.java:127)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    I am of course sure that the column does infact exist. I can insert into the column no problems. the sql looks like this:
    SELECT * FROM Members WHERE uName ='Stewart' AND encPwd='�F2C�3����h�1Y�'
    Can any one tell me if there is a common cause to this problem?
    Thanks

  • How to connect to database in JSP

    Hi, all.
    I am using J2EE and cloudscape. I have written all the EJB classes. But now i have no idea that how to connect to database in jsp such as i get user ID from portal, then i connect to database check the existence of user ID and the password then return true or false value. how to write all this in jsp?
    Thanks very much!
    yayun

    this is the required code
    i hope this will help u
    <html>
    <head>
    </head>
    <body>
    <%@ page import="java.sql.*" %>
    <%
    try
    String fu=request.getParameter("username");
    String fp=request.getParameter("password");
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection Con=DriverManager.getConnection("jdbc:odbc:wind","","");
    Statement stmt=Con.createStatement();
    ResultSet rs=stmt.executeQuery("select * from table1 where username='"+fu+"' and password='"+fp+"'");
    if(rs.next())
    %>
    <jsp:forward page="success.jsp"/>
    <%
    else{
    %>
    <jsp:forward page="unsuccess.jsp"/>
    <%
    catch(Exception e)
    %>
    </body>
    </html>

  • Hi guys Pls tell me a way to connect db4 database with jsp and which driver

    hi guys
    Pls tell me a way to connect db4 database with jsp and
    also tell me which driver i have to use
    also tell me how to connect with excel sheets

    take a look at the follwing links. There, you'll find all what you need :
    DB4:
    http://www.oracle.com/database/berkeley-db/je/index.html
    http://www.oracle.com/technology/products/berkeley-db/je/index.html
    http://www.oracle.com/database/berkeley-db/db/index.html
    http://www.oracle.com/database/docs/berkeley-db-je-datasheet.pdf
    Excel:
    http://64.18.163.122/rgagnon/javadetails/java-0516.html
    Hope That Helps

  • Trying to connect to a database via JSP

    I'm trying to make a simple connection to a database called testbase but to no prevail. As you can see the code is really simple but i keep getting "javax.servlet.ServletException: Table 'testbase.testbase' doesn't exist".
    //connection.jsp
    <HTML>
    <HEAD><TITLE>Employee List</TITLE></HEAD>
    <BODY>
    <%@ page import="java.sql.*" %>
    <TABLE BORDER=1 width="75%">
    <TR><TH>Data</TH></TR>
    <%
    Connection conn = null;
    Statement st = null;
    ResultSet rs = null;
    Class.forName("org.gjt.mm.mysql.Driver").newInstance();
    conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/testbase",
    st = conn.createStatement();
    rs = st.executeQuery("select * from testbase");
    %>
    <TR><TD><%= rs.getString("table01") %></TD>
    <TD><%= rs.getString("field01") %></TD></TR>
    </BODY>
    </HTML>
    Can anyone find something wrong with the code or do you think that there's a connection problem someplace else?
    Any replies are greatly appreciated

    DriverManager.getConnection("jdbc:mysql://localhost:33
    06/testbase",
    st = conn.createStatement();
    rs = st.executeQuery("select * from testbase");One of them or both might not be correct. Check if you have a database called testbase and it has a table called testbase.
    You could login from MySQL command prompt with your login name and password (which I hope is not *) and check.

  • Help needed: clarifying the use of beans to pass data from database to JSP

    Hi everyone,
    I am sure you all get fed up with being asked this question as I can see it is asked a lot when googled, but the answers given have not cleared things up for me.
    Anyway, I have a JSP page that contains a text box, submit button and a select box of size 10. The user enters a search string and the form submits the data and reloads the same page. From the code you can see the Name property of the bean is set.
    <jsp:useBean id="vtm" class="FinalYearProject.Types.VtmType" scope="page" />
    <jsp:setProperty name="vtm" property="NM" value="${param.NM}" />I then need to be able to use that name to query a postgresql database. I have a JDBCConnector class with the method:
        public ResultSet searchTable(String NM ) throws SQLException {
            String[] names = NM.split(" ");
            NM = "";
            for(int i = 0; i < names.length; i++) {
                NM = names[i] + "%";
            return stat.executeQuery("SELECT * FROM vtm WHERE nm ILIKE '" + NM + "';");
        }This method however can be changed.
    My question really is what is the best way for me to take the name, get the resultset and pass back the VtmType objects to the jsp so that I can populate my select box, and where should each part be handled i.e. the JSP page, the VtmType, the JDBCConnector.
    I may be going about it completely the wrong way and using beans incorrectly, but I just cant seem to get my head around the problem.
    Any help would be much appreciated,
    Thanks.

    Hi,
    Thanks for the help, I actually found some literature about the JSP Model 2 and realised that was what I needed to do. I have now re-written everything and it has made my life a lot eaiser, typically this was before I checked back on this post though!
    Anyway, I now have JSP pages requesting Servlets which create beans and call classes that access the database. The servlet then forwards the beans and where necessary a small of html to another JSP. Like you have suggested.
    One problem I have now however, is that the user needs to be logged in to access some of the pages. An error page with the correct message is displayed to the user when it is processed via the servlet.
    //Servlet detects an error
    request.setAttribute("errorMsg", "1");
    gotoPage("/loginError.jsp", request, response);
    //JSP detects which errorMsg to display
    <c:set var="errorMsg" value="${requestScope.errorMsg}" />However, when the user does not sign in and clicks a link which is blocked the JSP forwards directly to the error JSP.
    //Tests to see if user is logged in
    <c:if test="${empty user.username}">
        <jsp:forward page="/loginError.jsp">
            <jsp:param name="errorMsg" value="3" />
        </jsp:forward>
    </c:if>The problem with this is that the only way I can see of checking the errorMsg type is with:
    //JSP checks which errorMsg to display
    <c:set var="errorMsg" value="${param.errorMsg}" />Which is different to how I determine the errorMsg from the Servlet. Is there a way of getting the errorMsg type that is the same for both actions?
    Thanks.

  • Why yahoo/gmail retrieval and facebook app so so slow when in WIFI. But using the internet to check for emails and facebook is fast using the same WIFI connection??

    Why yahoo/gmail retrieval and facebook app so so slow when in WIFI. But using the internet to check for emails and facebook is fast using the same WIFI connection??

    Hi SandyS_VZW,
    Yes tried resetting the wifi connection and problem still persist.
    Here it is...to make it clear. Connected thru the same wifi at home...
    -> emails (yahoo/gmail) and facebook WEBSITES are working fine and fast when using/accessing thru a browser (chrome/samsung browser) - no problem with this.
    -> emails (yahoo/gmail) and facebook APP is soooooo sloooww (thru the App). Slow I mean comparing it to using their browser/websites... news feeds/emails refreshing so quickly but not when using the APP installed in Samsung Galaxy Note 4. Slow like - It will take around 5-10minutes just to get your emails and news feed refreshed.
    THIS HAPPENS ONLY WHEN CONNECTED THRU A WIFI which has a speed of 10-20mb. It is not happening when connected to the network data/plan.
    My wife has the same Samsung Galaxy Note 4 (coming from different provider at&t) - same setup (emails, fb app), same wifi connection, but she's not experiencing anything like it.
    Not sure why, I dont want to believe that while connected to a WIFI, Verizon is restricting anything and ******* me off to make me switch to my data plan connection everytime - which is Unfair!
    Was there a known issue similar about this case?
    thanks,

  • (Cisco Historical Reporting / HRC ) All available connections to database server are in use by other client machines. Please try again later and check the log file for error 5054

    Hi All,
    I am getting an error message "All available connections to database server are in use by other client machines. Please try again later and check the log file for error 5054"  when trying to log into HRC (This user has the reporting capabilities) . I checked the log files this is what i found out 
    The log file stated that there were ongoing connections of HRC with the CCX  (I am sure there isn't any active login to HRC)
    || When you tried to login the following error was being displayed because the maximum number of connections were reached for the server .  We can see that a total number of 5 connections have been configured . ||
    1: 6/20/2014 9:13:49 AM %CHC-LOG_SUBFAC-3-UNK:Current number of connections (5) from historical Clients/Scheduler to 'CRA_DATABASE' database exceeded the maximum number of possible connections (5).Check with your administrator about changing this limit on server (wfengine.properties), however this might impact server performance.
    || Below we can see all 5 connections being used up . ||
    2: 6/20/2014 9:13:49 AM %CHC-LOG_SUBFAC-3-UNK:[DB Connections From Clients (count=5)]|[(#1) 'username'='uccxhrc','hostname'='3SK5FS1.ucsfmedicalcenter.org']|[(#2) 'username'='uccxhrc','hostname'='PFS-HHXDGX1.ucsfmedicalcenter.org']|[(#3) 'username'='uccxhrc','hostname'='PFS-HHXDGX1.ucsfmedicalcenter.org']|[(#4) 'username'='uccxhrc','hostname'='PFS-HHXDGX1.ucsfmedicalcenter.org']|[(#5) 'username'='uccxhrc','hostname'='47BMMM1.ucsfmedicalcenter.org']
    || Once the maximum number of connection was reached it threw an error . ||
    3: 6/20/2014 9:13:49 AM %CHC-LOG_SUBFAC-3-UNK:Number of max connection to 'CRA_DATABASE' database was reached! Connection could not be established.
    4: 6/20/2014 9:13:49 AM %CHC-LOG_SUBFAC-3-UNK:Database connection to 'CRA_DATABASE' failed due to (All available connections to database server are in use by other client machines. Please try again later and check the log file for error 5054.)
    Current exact UCCX Version 9.0.2.11001-24
    Current CUCM Version 8.6.2.23900-10
    Business impact  Not Critical
    Exact error message  All available connections to database server are in use by other client machines. Please try again later and check the log file for error 5054
    What is the OS version of the PC you are running  and is it physical machine or virtual machine that is running the HRC client ..
    OS Version Windows 7 Home Premium  64 bit and it’s a physical machine.
    . The Max DB Connections for Report Client Sessions is set to 5 for each servers (There are two servers). The no of HR Sessions is set to 10.
    I wanted to know if there is a way to find the HRC sessions active now and terminate the one or more or all of that sessions from the server end ? 

    We have had this "PRX5" problem with Exchange 2013 since the RTM version.  We recently applied CU3, and it did not correct the problem.  We have seen this problem on every Exchange 2013 we manage.  They are all installations where all roles
    are installed on the same Windows server, and in our case, they are all Windows virtual machines using Windows 2012 Hyper-V.
    We have tried all the "this fixed it for me" solutions regarding DNS, network cards, host file entries and so forth.  None of those "solutions" made any difference whatsoever.  The occurrence of the temporary error PRX5 seems totally random. 
    About 2 out of 20 incoming mail test by Microsoft Connectivity Analyzer fail with this PRX5 error.
    Most people don't ever notice the issue because remote mail servers retry the connection later.  However, telephone voice mail systems that forward voice message files to email, or other such applications such as your scanner, often don't retry and
    simply fail.  Our phone system actually disables all further attempts to send voice mail to a particular user if the PRX5 error is returned when the email is sent by the phone system.
    Is Microsoft totally oblivious to this problem?
    PRX5 is a serious issue that needs an Exchange team resolution, or at least an acknowledgement that the problem actually does exist and has negative consequences for proper mail flow.
    JSB

  • How to connect sybase database in JDeveloper 11g using JConnect

    Hi
    How to connect sybase database in JDeveloper 11g using JConnect? Please help.

    User,
    It would help if you explained Sybase Jconnect instead of leaving us to google.
    At any rate, it appears you need to create a library definition in JDeveloper, add the appropriate JConnect JAR files to the library's classpath, and then add the library to your project.
    John

  • How  to connect .... MYSQL database via JSP

    Hello,
    I am not able to connect mysql database via JSP... everytime i try to connect the database i get the following error .....
    "java.lang.NoClassDefFoundError: org/aspectj/lang/Signature" ..
    my jsp code is ....
    <%@ page import = "java.sql.*" %>
    <%
    Connection conn = null;
    Statement smt = null;
    ResultSet rs = null;
    %>
    <%
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/mydatabase","username" ,"password");
    smt = conn.createStatement();
    rs = smt.executeQuery("select * from table");
    out.println("output is "+ rs.getString("my field"));
    rs.close();
    %>
    I have installed ............
    jdk1.5.0_02
    MySQL Server 4.1
    there are two jar files .. i tried with both jar files ..
    mysql-connector-java-3.1.8-bin.jar
    mysql-connector-java-3.1.8-bin-g.jar
    tomcat server 5.5.9
    my path .... is
    C:\Program Files\Java\jdk1.5.0_02\bin;C:\jakarta-tomcat-5.5.9\bin;C:\program files\mysql\mysql server 4.1\bin;
    any help on this error ..at the earliest ..
    ... am worried ..bcoz my deadlines is getting closer .....
    .. step by step .. procedure .. could be helpful ..
    anil

    Find out the JAR which contains the class and add it
    to WEB-INF/classes directory for your web application.WEB-INF/classes directory ..means ..C:\jakarta-tomcat-5.5.9\common\classes .. is that the one i need to keep my jar files ....???????????
    well i have downloaded .. mysql database connector from the website "http://www.mysql.com/products/connector/j/ " .. and i have downloaded MySQL Connector/J 3.1..under which i have downloaded "Source and Binaries (zip)" ..
    anil

  • How to connect MySql database with JSP

    Dear everyone,
    how to connect MySql database with JSP......

    It's too bad that nobody has ever asked this question before...

  • JD3.* could connecting Oracle database 5.05 but not new version

    Dear Sir,
    JD3.* could connecting Oracle database 8.05 but not new version of Oracle_Database at all(8I and 9I in OTN version), but could run on Borland JBuilder.
    Error message : IOException
    Could you tell me, help me too.
    steve chu
    (This week in Openworld and and email: [email protected])

    Steve -- My guess would be that you need to upgrade your JDBC drivers for your client program. They are downloadable from OTN. I expect that JBuilder has its own JDBC drivers which are newer than what you have and that is why it does not have a problem.
    Thanks -- Jeff

  • Connecting to database through jsp

    i want to connect to database through jsp actually my requirement is i want to populate data in one list box in accordance with the selected option in another list box this must done in the same jsp and i must manupulate every thing java script can i found any solution to this with example

    just write ur code in scriplets if it is jdbc code & if it is html then write it out side scriplet.

  • Database is started but Listener won't start

    Hi community,
    During the weekend, an outage took my Windows Server 2008 R2 down and my database by the same way.
    I Started the database back on but I'm having some issues starting the TNS LISTENER of my 11.0.2 database.
    I tried starting the service : OracleOraDb11g_home1TNSListener
    but i get the following error : The OracleOraDb11g_home1TNSListener service on Local computer started and then stopped. Some services stop automatically if they are not in use by other services or programs.
    the LSNRCTL Status gives me this :
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
    TNS-12541: TNS:no listener
    TNS-12560: TNS:protocol adapter error
      TNS-00511: No listener
       64-bit Windows Error: 2: No such file or directory
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=LIPCSATT.ireq.ca)(PORT=1521)))
    TNS-12541: TNS:no listener
    TNS-12560: TNS:protocol adapter error
      TNS-00511: No listener
       64-bit Windows Error: 61: Unknown error
    The lsnrctl start gives me this :
    Z:\>lsnrctl start
    LSNRCTL for 64-bit Windows: Version 11.2.0.1.0 - Production on 06-AUG-2013 07:55:03
    Copyright (c) 1991, 2010, Oracle.  All rights reserved.
    Starting tnslsnr: please wait...
    Failed to start service, error 0.
    TNS-12560: TNS:protocol adapter error
    Here are My ora files :
    # sqlnet.ora Network Configuration File: E:\app\da2803\product\11.2.0\dbhome_1\network\admin\sqlnet.ora
    # Generated by Oracle configuration tools.
    SQLNET.AUTHENTICATION_SERVICES= (NTS)
    NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT, LDAP)
    # tnsnames.ora Network Configuration File: E:\app\da2803\product\11.2.0\dbhome_1\network\admin\tnsnames.ora
    # Generated by Oracle configuration tools.
    OROBEE =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = OROBEE)
    LISTENER_OROBEE =
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    ORACLR_CONNECTION_DATA =
      (DESCRIPTION =
        (ADDRESS_LIST =
          (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
        (CONNECT_DATA =
          (SID = CLRExtProc)
          (PRESENTATION = RO)
    # listener.ora Network Configuration File: E:\app\da2803\product\11.2.0\dbhome_1\network\admin\listener.ora
    # Generated by Oracle configuration tools.
    SID_LIST_LISTENER =
      (SID_LIST =
        (SID_DESC =
          (SID_NAME = CLRExtProc)
          (ORACLE_HOME = E:\app\da2803\product\11.2.0\dbhome_1)
          (PROGRAM = extproc)
          (ENVS = "EXTPROC_DLLS=ONLY:E:\app\da2803\product\11.2.0\dbhome_1\bin\oraclr11.dll")
    LOGGING_LISTENER = OFF
    LISTENER =
      (DESCRIPTION_LIST =
        (DESCRIPTION =
       (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
          (ADDRESS = (PROTOCOL = TCP)(HOST = LIPCSATT.ireq.ca)(PORT = 1521))
    ADR_BASE_LISTENER = E:\app\da2803
    TRACE_LEVEL_LISTENER = OFF
    my variables are as follows :
    ALLUSERSPROFILE=C:\ProgramData
    APPDATA=C:\Users\db4626\AppData\Roaming
    BI_ORACLE_HOME=E:\app\Middleware_home\Oracle_BI1
    CLIENTNAME=PCS00427
    CommonProgramFiles=C:\Program Files\Common Files
    CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
    CommonProgramW6432=C:\Program Files\Common Files
    COMPUTERNAME=LIPCSATT
    ComSpec=C:\Windows\system32\cmd.exe
    DEFLOGDIR=C:\ProgramData\McAfee\DesktopProtection
    FP_NO_HOST_CHECK=NO
    GRAILS_HOME=C:\grails-2.0.0
    HOMEDRIVE=Z:
    HOMEPATH=\
    HOMESHARE=\\ireqhq\docireq\20032b\DB4626
    JAVA_HOME=C:\PROGRA~1\Java\jdk1.6.0_26
    LOCALAPPDATA=C:\Users\db4626\AppData\Local
    LOGONSERVER=\\WINDSOR
    NUMBER_OF_PROCESSORS=4
    ORACLE_HOME=E:\app\da2803\product\11.2.0\dbhome_1
    ORACLE_SID=OROBEE
    OS=Windows_NT
    Path=E:\app\da2803\product\11.2.0\dbhome_1\BIN;D:\oracle\product\11.2.0\client_1
    \bin;E:\app\Middleware_home\Oracle_BI1\bin;E:\app\Middleware_home\Oracle_BI1;C:\
    Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\Windows
    PowerShell\v1.0\;C:\Program Files\TortoiseSVN\bin;C:\PROGRA~1\Java\jdk1.6.0_26\b
    in;C:\grails-2.0.0\bin;C:\Program Files\TortoiseGit\bin;E:\app\Middleware_home\O
    racle_BI1\products\Essbase\EssbaseServer\bin;E:\app\Middleware_home\Oracle_BI1\b
    in;E:\app\Middleware_home\Oracle_BI1\opmn\bin;E:\app\Middleware_home\Oracle_BI1\
    opmn\lib;E:\app\Middleware_home\Oracle_BI1\perl\bin;C:\apps\FME\;E:\app\da2803\p
    roduct\11.2.0\dbhome_1\bin
    PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
    PROCESSOR_ARCHITECTURE=AMD64
    PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 44 Stepping 2, GenuineIntel
    PROCESSOR_LEVEL=6
    PROCESSOR_REVISION=2c02
    ProgramData=C:\ProgramData
    ProgramFiles=C:\Program Files
    ProgramFiles(x86)=C:\Program Files (x86)
    ProgramW6432=C:\Program Files
    PROMPT=$P$G
    PSModulePath=C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
    PUBLIC=C:\Users\Public
    SESSIONNAME=RDP-Tcp#0
    SystemDrive=C:
    SystemRoot=C:\Windows
    TEMP=C:\Users\db4626\AppData\Local\Temp\3
    TMP=C:\Users\db4626\AppData\Local\Temp\3
    TNS_ADMIN=E:\app\da2803\product\11.2.0\dbhome_1\NETWORK\ADMIN
    USERDNSDOMAIN=IREQ.CA
    USERDOMAIN=IREQHQ
    USERNAME=db4626
    USERPROFILE=C:\Users\db4626
    VSEDEFLOGDIR=C:\ProgramData\McAfee\DesktopProtection
    windir=C:\Windows
    _PENTAHO_JAVA=C:\PROGRA~2\Java\jre7\bin\javaw
    _PENTAHO_JAVA_HOME=C:\PROGRA~2\Java\jre7\bin\java
    PLEASE HELP ME COMMUNITY, I am out of ressources.

    My hosts file is there and i have the rights to access it because I am a member of the administrators group.
    I searched for it on the net and no one talks about a missing file...
    Besides here is the the content of my sqlnet.log
    Fatal NI connect error 12541, connecting to:
    (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SID=orobee)(CID=(PROGRAM=E:\app\da2803\product\11.2.0\dbhome_1\bin\emagent.exe)(HOST=LIPCSATT)(USER=SYSTEM))))
      VERSION INFORMATION:
      TNS for 64-bit Windows: Version 11.2.0.1.0 - Production
      Windows NT TCP/IP NT Protocol Adapter for 64-bit Windows: Version 11.2.0.1.0 - Production
      Time: 05-AUG-2013 13:46:29
      Tracing not turned on.
      Tns error struct:
        ns main err code: 12541
        TNS-12541: TNS:no listener
        ns secondary err code: 12560
        nt main err code: 511
        TNS-00511: No listener
        nt secondary err code: 61
        nt OS err code: 0

Maybe you are looking for

  • How to recover in a two phase commit ?

    I am implementing a two phase commit with Oracle XA in Oracle 8.1.6. I am wondering how I can recover from failures occur between the PREPARE and the COMMIT stage. If I lose the database connection after the changes have been prepared, then I can't f

  • Insertfrom.jsf problem on submit

    Hi Everyone, I appreciate if anyone can give me a clue on what could be the problem. I wasted few hours on this without any sign on resolving the problem. I have a form with data fields that are filled and submitted. There is validation check on each

  • HT1414 Error when backup iphone 4

    when I do backup, there are an error: An error occured while backing up this Iphone (-43). Continuing will result in the lost of all content on this iphone. What should I do ?

  • Running a web server along with Oracle XE - Port 8080 problem & solution

    Hi, My company is tight on computing power so we're using an older machine to run our Oracle XE instance and our Apache web server. The Apache server is using port 80 to host the website, while Oracle XE is using port 8080 for APEX. Initially this di

  • Can't update to 4.2???

    Hi Guys, I have tried like 9320485039458324 times but itunes will not update my iphone 4 4.1 to 4.2 .... it does not download the new software. It gets timed out every time... Is it me? Or is Apple going broke and can't afford server time? Just kiddi