Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JSP-Servlet Unable to connect servet, jsp to oracle 10g database.. Unable to retrieve data..
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


sushma
Unable to connect servet, jsp to oracle 10g database.. Unable to retrieve data..
0 Answer(s)      2 years and 6 months ago
Posted in : JSP-Servlet


I have a class file AbstractDataAccessObject with the below code.

package com.dts.core.dao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Properties;

import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;

import com.dts.core.util.LoggerManager;

public class AbstractDataAccessObject
{
    public Connection mCon;
    private static Properties mProps;

    /**
     * @return the props
     */
    public Properties getProperties()
    {
        return mProps;
    }

    /**
     * @param props
     *            application properties object
     */
    public void setProperties(Properties aProps)
    {
        mProps = aProps;
    }

    public Connection getConnection()
    {
        try
        {
            Properties aProps = getProperties();
            System.out.println(aProps.getProperty("driver"));
            Class.forName(aProps.getProperty("driver"));
            mCon = DriverManager.getConnection(aProps.getProperty("url"), aProps.getProperty("duser"), aProps.getProperty("dpass"));
            System.out.println(mCon);
        }
        catch (ClassNotFoundException cnfe)
        {
            LoggerManager.writeLogWarning(cnfe);
        }
        catch (SQLException se)
        {
            LoggerManager.writeLogWarning(se);
        }
        return mCon;
    }

/*  public Connection getConnection(String cp)
    {
        try
        {
            Properties aProps = getProperties();
            Class.forName( aProps.getProperty("driver") );

            String JNDI = aProps.getProperty("JNDI_NAME");

            try
            {
                InitialContext ictx = new InitialContext();
                DataSource ds = (DataSource) ictx.lookup(JNDI);
                mCon = ds.getConnection();
            }
            catch (NamingException ne)
            {
                LoggerManager.writeLogWarning(ne);
            }
        }
        catch (ClassNotFoundException cnfe)
        {
            LoggerManager.writeLogWarning(cnfe);
        }
        catch (SQLException se)
        {
            LoggerManager.writeLogWarning(se);
        }
        return mCon;
    }*/

    public int getSequenceID(String tableName, String pkid)
    {
        int id = 0;
        try
        {
            mCon = getConnection();
            Statement st = mCon.createStatement();
            ResultSet rs = st.executeQuery("select max("+pkid+") from "+tableName); 
            if(rs.next())
                id=rs.getInt(1);
            id++;
        }
        catch(SQLException se)
        {
            LoggerManager.writeLogWarning(se);
        }
        catch(Exception e)
        {
            LoggerManager.writeLogWarning(e);
        }
        finally
        {
            try
            {
                mCon.close();
            }
            catch(SQLException se)
            {
                LoggerManager.writeLogWarning(se);  
            }
            catch(Exception e)
            {
                LoggerManager.writeLogWarning(e);
            }
        }
        return id;
    }
}

The data for the connection to the database is specified in the Web-inf >> config >>system.properties.

The code is as follows

# Sample ResourceBundle properties file

JNDI_NAME=java:com/env/Oracle/jndi
db.login=   
db.password= 
driver=oracle.jdbc.driver.OracleDriver
url=jdbc:oracle:thin:@192.168.100.20:1521:server
duser=ware
dpass=ware
logfile=E:/log/warehouse_log.txt
dbname=oracle

Let me know what is the duser and dpass.. ? I have created a new user from oracle sql*plus as rajalakshmi and password by granting privilege from scott and tiger. should I use the duser and dpass as rajalakshmi and password for duser and dpass.. or scott and tiger.

But nothing of the duser and dpass works.

If I use it also, unable to connect to backend oracle database.

Let me know what is db.username and db.password? should I leave it blank ?


Advertisement
View Answers

Related Tutorials/Questions & Answers:
Unable to connect servet, jsp to oracle 10g database.. Unable to retrieve data..
Unable to connect servet, jsp to oracle 10g database.. Unable to retrieve data.... If I use it also, unable to connect to backend oracle database. Let me...) { LoggerManager.writeLogWarning(e); } } return id; } } The data
java script unable to connect to oracle database and insert data
java script unable to connect to oracle database and insert data  ... is to insert data from jsp to oracle database 8, so i create a table in oracle... jsp coding in rose india for sql and i changed the drivers for oracle.. when i try
Advertisements
unable to connect database in java
unable to connect database in java  Hello Everyone! i was trying to connect database with my application by using java but i am unable to connect... Driver Manager] Data source name not fou nd and no default driver specified
unable to connect database in java
unable to connect database in java  Hello Everyone! i was trying to connect database with my application by using java but i am unable to connect...: [Microsoft][ODBC Driver Manager] Data source name not fou nd and no default driver
unable to connect to server - JSP-Servlet
unable to connect to server  thank you for the program code for inserting and reteriving the image but i am unable to deploy these two programs..., create a web application folder inside the webapps folder and put the jsp file
unable to insert data into database
unable to insert data into database    hello.i have a problem in inserting data into database.i have used two prepared statement.one for retrieving the eid based on ename and the other is inserting data into database based
unable to insert data into database
unable to insert data into database    hello.i have a problem in inserting data into database.i have used two prepared statement.one for retrieving the eid based on ename and the other is inserting data into database based
unable to insert data into database
unable to insert data into database    hello.i have a problem in inserting data into database.i have used two prepared statement.one for retrieving the eid based on ename and the other is inserting data into database based
unable to insert data into database
unable to insert data into database    hello.i have a problem in inserting data into database.i have used two prepared statement.one for retrieving the eid based on ename and the other is inserting data into database based
unable to get datas from oracle database
unable to get datas from oracle database  Dear Sir, I am again struck in my project.. i want to display data from oracle database but i get... org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred
android connection to database oracle 10g
android connection to database oracle 10g  Hello, How i can connect my android application to my oracle 10g database
Unable to store the image into database
Unable to store the image into database  Hello, I have created below... button. The problem is coming due to JSP page is not able to find complete path of image. I have debug the JSP program and found that HTML form pass only image
Unable to execute JSP page
Unable to execute JSP page  I have written one jsp file. It contains html tags and jsp directives. I have saved the file with the extension .jsp. The tomcat server is already running onto my machine. I have saved the jsp file
data (image ,audio) inserting to data base (oracle 10g) and retriving the same data from jsp
data (image ,audio) inserting to data base (oracle 10g) and retriving the same data from jsp   data (image ,audio) inserting to data base (oracle 10g) and retriving the same data from jsp with script of data base plz help me
Insert or retrieve image into oracle 10g by using java
Insert or retrieve image into oracle 10g by using java   How can i insert or retrieve image into oracle10g using java plz i need it urgently,need guidance to do this plz
error in uploading image from jsp to oracle 10g database
error in uploading image from jsp to oracle 10g database  ... try to insert into the image into the database i got the above error please advice how to get rid of error   JSP upload image in Mysql database
Unable to compile class for JSP - WebSevices
Unable to compile class for JSP  org.apache.jasper.JasperException: Unable to compile class for JSP When I am trying to access a java file kept under src folder under a package from a jsp page placed under web directory, I am
how to retrieve data from database
how to retrieve data from database  unable to retrieve data from database using mySQL by using jsp sessions and beans for editing
Unable to get data from class - Development process
Unable to get data from class  I get this code from the internet which read from comm port of the computer & modify is as below:- package COM; /** * * @author kwngeaw */ import javax.comm.*; import java.io.
Unable to call .jrxml file from jsp
Unable to call .jrxml file from jsp  Hi, I am doing web application in jsp. To create report I have used ireport and interated with neatbeans using... then it unable to access it.Error also not showing. I will show my code and its output
Unable to run the jsp page - JSP-Servlet
Unable to run the jsp page  Expert:Naga Hi, I need solution this program. In cart.jsp I printed the total amount of the products then the next... details should be stored in ?orders? table in the ?shopping ? data base
unable to compile class file - JSP-Servlet
unable to compile class file  I wrote database connection in jsp file.... In database i have a employeeid field. How can i display all employee id...("/jsp/Combobox.jsp"); dispatcher.forward(request, response
Struts2...problem in JSP..unable to get the values for menuTitle!!!
Struts2...problem in JSP..unable to get the values for menuTitle!!!  **Hello everyone... i'm trying to make a dynamic menu from database in struts2... Jsp is displaying the menuId from database but not the menuTitle...where as its
java servet +jsp+mysqldatabase
java servet +jsp+mysqldatabase  I created three servlets(based on title, bookname, author) and one jsp page. in jsp page i put one dropdown list box(that is title, author, bookname) and created mysql database column values
unable to retrive the data from mysql using servlet using jdbc driver
unable to retrive the data from mysql using servlet using jdbc driver ... to the database"); stmt = con.createStatement(); rs...(request,response); } } .i am unable to redirect..here is the code..pls
unable to execute the examples
unable to execute the examples  unable to execute the examples given for struts,ejb,or spring tutorials.Please help I am a beginner
Unable to Create DSN for
Unable to Create DSN for   I have installed Oracle 11g R2 and JDK7... Driver. I'm unable to crate DNS for "Microsoft ODBC for Oracle", It gives eror message (like Oracle client and networking components were not found. etc). What
Unable to run jsp files on internet explorer - JSP-Servlet
Unable to run jsp files on internet explorer  Hi, I am Akhilesh Shrivastav. I am new to jsp and a new member of this site. My problem is i wrote a small jsp program stored in the Web-Apps folder of Apache Tomcat. But i
Unable to bind to a hashmap from jsp using spring tags - Spring
Unable to bind to a hashmap from jsp using spring tags  Hi, I am unable to bind a hashmap from my jsp page. Here is what i want to do: I have an arraylist in a jsp page. As i loop through the array list, for each element i
unable to open the service tomcat5
unable to open the service tomcat5  While trying to run tomcat server getting "unable to open the service tomcat5" error after installed tomcat
connect to the database from JSP
connect to the database from JSP  How do you connect to the database from JSP?   A Connection to a database can be established from a jsp page by writing the code to establish a connection using a jsp scriptlets
Advertisements
 

 

 

DMCA.com