This week's book giveaway is in the Spring forum.
We're giving away four copies of Spring Boot in Practice and have Somnath Musib on-line!
See this thread for details.
Win a copy of Spring Boot in Practice this week in the Spring forum!

Raghavendra Rao

Greenhorn
+ Follow
since Apr 13, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Raghavendra Rao

Hi! all
i have used the following method after inserting the record to retrieve the primarykey.please verify and tell me whether this will give the exact primary key for the record i have inserted...i am giving the database field description also after this method..
public static int getLastPrimaryKey(String tableName, String pkFieldName)
{
int key = -1;
String query = "SELECT MAX(" + pkFieldName + ") FROM " + tableName;
Statement stmt = null;
ResultSet rs = null;
Connection connection = SQLUtil.getConnection();
try
{
stmt = connection.createStatement();
rs = stmt.executeQuery(query);
rs.next();
key = rs.getInt(1);
return key;
}
catch (Exception ex)
{
return -1;
}
finally
{
//rs = SQLUtil.closeResultSet(rs);
//stmt = SQLUtil.closeStatement(stmt);
if (connection != null)
{
connection = null;
}
}
}

postgres Database
------------------
message_cod | bigint | not null default nextval('messages.b2l_message_sequence'::text)
Thanks in advance
Raghavendra Rao
thank U
i also expected the same reason behind it.i.e no implementation in the driver.
but how to solve my problem regarding postrgresql database....
please help me..
Hi all!
i have tried the following code snippet.....(i am giving the required part only...)
preparedStatement = connection.prepareStatement(query,Statement.RETURN_GENERATED_KEYS);
resultSet = preparedStatement.getGeneratedKeys();
Integer primaryKey = null;
if(resultSet.next()) {
primaryKey = new Integer(resultSet.getInt(1));
}
At Runtime i am getting the following message
"This method is not yet implemented."
i have used the postresql jdbc driver(i.e pg73jdbc3.jar in my classpath)
so how to proceed can any one please help me.....
Thanks in Advance
Raghu

Originally posted by Raghavendra Rao:
Hi All!!
i have used DailyRollingFileAppender in properties file and used DatePattern. This properties file is being used by a servelt and i want to create a new file for every minute but i am not able to do this . The log statements are overwritten and i am able to log only the latest minute log statements in the file log/log4joutput3.txt. (i am able to get in a standalone program but not able to get the same through servlets)
the properties file i have used is given below :
log4j.logger.demo.log4j.servlet.LogonServlet=debug, R1
log4j.additivity.demo.log4j.servlet.LogonServlet=false
log4j.appender.R1=org.apache.log4j.DailyRollingFileAppender
#log4j.appender.R1.Append=false
log4j.appender.R1.File=log/log4joutput3.txt
#log4j.appender.R1.DatePattern='.'yyyy-MM-dd-HH-mm
log4j.appender.R1.layout=org.apache.log4j.PatternLayout
log4j.appender.R1.layout.ConversionPattern=%d %5p [%t] (%F:%L) - %m%n
Please help me....
thanks in advance...

Hi All!
i don't know how to use log4j in jsp's .... can any one please help me by giving some sample code and properities files......

thanks in advance
Hi all!
i have placed the classes111 and classes12.jar files in web-inf/lib folder and used a servlet which reads this properties file and log the statement to database.i am not able to log the statements in to the database ....i have use the following properties file:
log4j.appender.R=org.apache.log4j.jdbc.JDBCAppender
log4j.rootLogger=debug, R
log4j.appender.R.Driver=oracle.jdbc.driver.OracleDriver
log4j.appender.R.URL = jdbc racle:thin@192.168.0.200:1521:itsr
log4j.appender.R.user=hpabopa1
log4j.appender.R.password=hpa
log4j.appender.R.sql=INSERT INTO jdbctest(message) VALUES ('%d - %c - %p - %m')
#
# These defines the layout to be used.
#
log4j.appender.R.layout=org.apache.log4j.PatternLayout
can anyonle please help me....

thanks in advance..
Hi All!!
i have used DailyRollingFileAppender in properties file and used DatePattern. This properties file is being used by a servelt and i want to create a new file for every minute but i am not able to do this . The log statements are overwritten and i am able to log only the latest minute log statements in the file log/log4joutput3.txt. (i am able to get in a standalone program but not able to get the same through servlets)
the properties file i have used is given below :
log4j.logger.demo.log4j.servlet.LogonServlet=debug, R1
log4j.additivity.demo.log4j.servlet.LogonServlet=false
log4j.appender.R1=org.apache.log4j.DailyRollingFileAppender
#log4j.appender.R1.Append=false
log4j.appender.R1.File=log/log4joutput3.txt
#log4j.appender.R1.DatePattern='.'yyyy-MM-dd-HH-mm
log4j.appender.R1.layout=org.apache.log4j.PatternLayout
log4j.appender.R1.layout.ConversionPattern=%d %5p [%t] (%F:%L) - %m%n
Please help me....
thanks in advance...
18 years ago
Hi All!!
i have used DailyRollingFileAppender in properties file and used DatePattern. This properties file is being used by a servelt and i want to create a new file for every minute but i am not able to do this . The log statements are overwritten and i am able to log only the latest minute log statements in the file log/log4joutput3.txt. (i am able to get in a standalone program but not able to get the same through servlets)
the properties file i have used is given below :
log4j.logger.demo.log4j.servlet.LogonServlet=debug, R1
log4j.additivity.demo.log4j.servlet.LogonServlet=false
log4j.appender.R1=org.apache.log4j.DailyRollingFileAppender
#log4j.appender.R1.Append=false
log4j.appender.R1.File=log/log4joutput3.txt
#log4j.appender.R1.DatePattern='.'yyyy-MM-dd-HH-mm
log4j.appender.R1.layout=org.apache.log4j.PatternLayout
log4j.appender.R1.layout.ConversionPattern=%d %5p [%t] (%F:%L) - %m%n
Please help me....
thanks in advance...