Unable to connect servet, jsp to oracle 10g database.. Unable to retrieve data..
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 ?
View Answers
Related Tutorials/Questions & Answers:
Advertisements
unable to connect database in javaunable 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 javaunable 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-Servletunable 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 databaseunable 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
Unable to store the image into databaseUnable 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 pageUnable 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
Unable to compile class for JSP - WebSevicesUnable 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
Unable to run the jsp page - JSP-ServletUnable 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 call .jrxml file from jspUnable 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 compile class file - JSP-Servletunable 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
retrieve related data from database using jsp and mysqlretrieve related
data from
database using
jsp and mysql Hi sir,
please give some example of
jsp code for retrieving mysql
database values in multiple dropdown list. if we change a value in a dropdown its related value must
How to get data from Oracle database using JSP problem in
jsp in the sense to get
data from the
database like
oracle . I have...
data from the
database like
oracle), I have created one
jsp program like... the answer to
retrieve data from the
database by using servlet or
jsp program
connect to the database from JSPconnect 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
Unable to get data from class - Development processUnable 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.
Dropdown code to retrieve result from oracle databaseDropdown code to
retrieve result from
oracle database Hi Friends,
I...
retrieve the result from
Oracle database.We have procedures created already.Just... that will
retrieve values from the
database into dropdown. As the user choose any option
java servet +jsp+mysqldatabasejava
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 execute the examplesunable 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
JSP-Oracle connectivityJSP-
Oracle connectivity I have created a "dynamic web project" mainly with
jsp files in eclipse and now, want to
connect with
oracle 10g, so how can I proceed for the
database connection