Sumeet Anand

Greenhorn
+ Follow
since Nov 16, 2002
Merit badge: grant badges
For More
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 Sumeet Anand

Hi All,
I am trying this out :
I have built a wrapper class around Log4j.Now I want to log through the methods of these wrapper classes.
I want to log in 2 different log files .
Some msgs need to be logged in 1 file and some in the other.
But the problem is what should I specify in configuration file for Log4j.
I am specifying this:
***********************************************
<appender name="A1" class="org.apache.log4j.FileAppender">
<param name="File" value="D:/bea/user_projects/CheckFreeDomain/applications/CheckFree/logs/SimpleLog.log" />
<param name="Append" value="true" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{DATE} %-6r %-5p %30.30c %x - %m\n" />
</layout>
</appender>

<category name="checkFree.MyApp">
<priority value="debug" />
<appender-ref ref="A1" />
</category>
<appender name="A2" class="org.apache.log4j.FileAppender">
<param name="File" value="D:/bea/user_projects/CheckFreeDomain/applications/CheckFree/logs/AuditTrail.log" />
<param name="Append" value="true" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%t %-5p %c{2} - %m%n"/>
</layout>
</appender>


<category name="checkFree.MyApp">
<priority value="debug" />
<appender-ref ref="A2" />
</category>
**********************************************
MyApp is the logger class.
But the problem is when I log messages it only writes to one of the log files and depends upon which wrapper class I am calling first.
why is that happening and its not logging in other file.
Can somebody point out where I am going wrong.
Sumeet.
HI All ,
I have this method in which I open a socket and then passs an XML file�and also after some processing I receive
that XML file.But the problem is that the program just hangs up when while loop is executed.
I can print the System.outs until------- Message to send is-------.After that the programme just hangs
Up and doesn,t print anything after that and the while loop is also not executed.
**************************************************
String xmlResponseFileName = xmlFileName;
File xmlResponseFile = null;
Socket socket = null;
BufferedReader sin = null;
PrintWriter sout = null;
PrintWriter fout = null;
String line = null;
try {

xmlResponseFile = new File(xmlFileName);
System.out.println("XML response file is"+xmlResponseFile);
fout = new PrintWriter(new FileOutputStream(xmlResponseFile));
socket = new Socket(hostName, port);
sout = new PrintWriter(socket.getOutputStream(), true);
sin = new BufferedReader(new InputStreamReader(socket.getInputStream()));
System.out.println("Message to send is"+messageToSend);
sout.println(messageToSend);
while ((line = sin.readLine()) != null){
System.out.println("Line starting is as"+line);
fout.println(line);
}
System.out.println("After the while loop");
fout.flush();
fout.close();
sin.close();
sout.close();
socket.close();
return xmlResponseFile;
}
catch (IOException e) {
System.err.println("ERR - IPCInProcessorAccessor - sendAndReceiveMessage: IOException: " + e);
e.printStackTrace(System.err);
}
Please pull me out of this soup.
Thanks in advance.
Regards,
Sumeet.
21 years ago
HI All ,
I have this method in which I open a socket and then passs an XML file�and also after some processing I receive that XML file.But the problem is that the program just hangs up when while loop is executed.
I can print the System.outs until------- Message to send is-------.After that the programme just hangs
Up and doesn,t print anything after that and the while loop is also not executed.
**************************************************
String xmlResponseFileName = xmlFileName;
File xmlResponseFile = null;
Socket socket = null;
BufferedReader sin = null;
PrintWriter sout = null;
PrintWriter fout = null;
String line = null;
try {


xmlResponseFile = new File(xmlFileName);
System.out.println("XML response file is"+xmlResponseFile);
fout = new PrintWriter(new FileOutputStream(xmlResponseFile));
socket = new Socket(hostName, port);
sout = new PrintWriter(socket.getOutputStream(), true);
sin = new BufferedReader(new InputStreamReader(socket.getInputStream()));

System.out.println("Message to send is"+messageToSend);
sout.println(messageToSend);

while ((line = sin.readLine()) != null){
System.out.println("Line starting is as"+line);
fout.println(line);
}

System.out.println("After the while loop");

fout.flush();
fout.close();
sin.close();
sout.close();
socket.close();
return xmlResponseFile;
}
catch (IOException e) {
System.err.println("ERR - IPCInProcessorAccessor - sendAndReceiveMessage: IOException: " + e);
e.printStackTrace(System.err);
}
Please pull me out of this soup.
Thanks in advance.
Regards,
Sumeet.
Hi All,
I am facing this problem.
When i try to print the one element of result set using the "while" loop,its not getting executed.
********************************************
connection = getConnection();
if(connection != null)
{
cstmt = connection.prepareCall("{call"+queryName+"(?,?) }");

System.out.println("Statement is "+cstmt);
cstmt.registerOutParameter(1,Types.INTEGER);
cstmt.registerOutParameter(2,Types.VARCHAR);
cstmt.execute();
rs = cstmt.getResultSet();
System.out.println("Result set object is "+rs);
}
while(rs.next())//While loop not executed.
{
String id_trans = rs.getString("cd_interface");
System.out.println("Trans id is as"+id_trans);
}
rs.close();
cstmt.close();
******************************************
I guess rs.next() is returning false but donno why ?
When i print out the statement and result set objects, it gives me this.
*******************************************
Statement is com.sybase.jdbc2.jdbc.SybCallableStatement@3f74d

Result set object is com.sybase.jdbc2.jdbc.SybResultSet@6102dc
*******************************************
Can somebody help me out with some good ideas ?
Thanks in advance.
Regards,
Sumeet Anand.
[ January 02, 2003: Message edited by: Sumeet Anand ]
[ January 02, 2003: Message edited by: Sumeet Anand ]
Hi,
Now the problem is with retrieving the contents of the result set.
I am writing this code.
*********************************************
if(connection != null)
{
cstmt = connection.prepareCall("{ call "+queryName+"(?,?) }");

cstmt.registerOutParameter(1,Types.INTEGER);
cstmt.registerOutParameter(2,Types.VARCHAR);

rs = cstmt.executeQuery();

int errorcode = cstmt.getInt( 1 );
String errmsg = cstmt.getString( 2 );
System.out.println("Error code"+errorcode+" and error msg is "+errmsg);
}

while(rs.next())
{
int id_trans = rs.getInt("id_trans");
System.out.println("Trans id is as"+id_trans);
}
rs.close();
cstmt.close();
Now it gives me an error.
**************************************************
java.sql.SQLException: JZ0R0: ResultSet has already been closed.

Could anyone pull me out of this soup ?
Regards,
Sumeet.
Thanks a lot for your timely help.
It works now.
Regards,
Sumeet.
[ December 27, 2002: Message edited by: Sumeet ]
Hi All,
I am using Callable Statements with SybaseJconnect5_2
CallableStatement cstmt = connection.prepareCall("{ call FEE_accinfo_fee_management_Q(???) }");
The stored proc FEE_accinfo_fee_management_Q takes 2 input parameters and gives 2 output parameters.
For this i am doing the following:
********************************************
cstmt.setInt( 1,2000050 );
cstmt.setInt( 2,6 );
cstmt.registerOutParameter(1,Types.INTEGER);
cstmt.registerOutParameter(2,Types.VARCHAR);
cstmt.execute();
int feeuser = cstmt.getInt( 1 );
String profile = cstmt.getString( 2 );
cstmt.close();
*********************************************
Now when i execute this code it gives me this error.
//////////////////////////////////////////
java.sql.SQLException: JZ0SA: Prepared Statement: Input parameter not set, index: 2.
at com.sybase.jdbc2.jdbc.ErrorMessage.raiseError(Erro rMessage.java:426)
at com.sybase.jdbc2.tds.TdsParam.prepareForSend(TdsParam.java:88)
at com.sybase.jdbc2.jdbc.ParamManager.checkParams(ParamManager.java:574)
at
com.sybase.jdbc2.tds.Tds.rpc(Tds.java:662)
at com.sybase.jdbc2.jdbc.SybCallableStatement.sendRpc(SybCallableStatement.java:416)
at com.sybase.jdbc2.jdbc.SybCallableStatement.execute(SybCallableStatement.java:121)
at TestDatabase.main(TestDatabase.java:39)

PLease help out with this one.
Thanks in advance.
Regards,
Sumeet.
Hi All,
I am using callable statements to execute stored procs.But I have a doubt.Suppose we call a stored proc as :
CallableStatement cstmt = con.prepareCall( "{ call sp_C( ? ? ? ) }" );
Now whether the question mark placeholders are the total parameters(sum of input and output parameters)or just the output parameters.
Please clarify.
Thanks in advance.
Sumeet.
Hi All ,
I was just wondering whether we can use Connection Pools on Sybase with Swing applications.An example or two of the code will help a lot.
Thanks in advance.
Cheers,
Sumeet.
Thanks a lot Manish for ur timely information.
Cheers,
Sumeet
21 years ago
Hi All,
Does anybody know about a good Java Swing book in which event handling is discussed nicely.Please tell with the name of author or publication house.
Also if somebody can tell the price then it wud be great.
Cheers,
Sumeet.
21 years ago
Hi All,
Does anybody know about a good Java Swing book in which event handling is discussed nicely.Please tell with the name of author or publication house.
Also if somebody can tell the price then it wud be great.
Cheers,
Sumeet.
21 years ago
Hi Dirk,
I have changed my name as demanded by you.
Now moving on the problem part.
I have a DPJTable class defined in a separate package.It overrides the clone() method defined in Object class.The method is:
public Object clone() throws CloneNotSupportedException
{
return super.clone();
}
Now i call this method from a class in another package .This file is PendingTransactions.java.
DPJTable clone_pendingTransactionsDPJTable = (DPJTable)pendingTransactionsDPJTable.clone();
But it gives me an exception saying :- clone() has protected access in java.lang.Object.
Now i am unable to find out why this happening so.
Could u please shed some light on this.....
Thanks in advance.
21 years ago
Hi Manivannan,
I wrote a custom clone() method over riding the clone method in object class.
The method is as :
public Object clone() throws CloneNotSupportedException
{
return super.clone();
}
The class which has this method implements Cloneable interface.But still when i write this code it gives me the same error.
DPJTable clone_pendingTransactionsDPJTable = (DPJTable)pendingTransactionsDPJTable.clone();
Please suggest a way out.
21 years ago
Hi All,
I have an object which i want to clone.But when i call the clone method on that object it gives me a compile time error " clone() has protected access in java.lang.Object".
Can u please tell me where i am wrong.
I am attaching the code lines.
DPJTable clone_pendingTransactionsDPJTable = (DPJTable)pendingTransactionsDPJTable.clone();
Kindly suggest a way out.
Sumeet Chopra.
21 years ago