Qasim Shabbir

Greenhorn
+ Follow
since May 12, 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 Qasim Shabbir

thnx 4 yr replies.. i work tht way as u said.. but its not worthy in my case i didnt found any extra information if u'll find thn please tell me.
here is the complete exception stack.
java.sql.SQLException: General error
at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6135)
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:6263)
at sun.jdbc.odbc.JdbcOdbc.SQLExecute(JdbcOdbc.java:2564)
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.execute(JdbcOdbcPreparedStatement.java:214)
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.executeUpdate(JdbcOdbcPreparedStatement.java:136)
at DBConnection.addUser(DBConnection.java:95)
at Server.registerMeToServer(Server.java:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
at sun.rmi.transport.Transport$1.run(Transport.java:148)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:536)
Qasim Shabbir
thanx for reply
here is my method's code of the class which is communicate to DataBase
public void addUser(User user)
throws SQLException
{
PreparedStatement statement;
String add="Insert into chater "+
"(id,name,nick,status,email_address,contact_no,password) "+
"values(?,?,?,?,?,?,?)";
try{
statement=connection.prepareStatement(add);
statement.clearParameters();
statement.setInt(1,user.getId());
statement.setString(2,user.getName ());
statement.setString(3,user.getNick ());
statement.setByte (4,user.getStatus());
statement.setString(5,user.getEmail ());
statement.setString(6,user.getContactNo());
statement.setString(7,user.getPassword());
statement.executeUpdate();//throws exception here
connection.commit ();
}catch(SQLException sql){
String errorMessage=
"DBConnection:addUser:Record not safe :"+sql;
System.out.println(errorMessage);
throw new SQLException(errorMessage);
}
}
this is my test class snaped code which is working fine
public class testDB{
public void creatUser(){
System.out.println("testDB:main:creating user instance and fill the value");
user=new User();
user.setId(6);
user.setName ("Qasim Shabbir");
user.setNick ("Dragon Dreamz U");
user.setEmail ("qasimshabbir@hotmail.com");
user.setPassword ("Silent");
user.setStatus((byte)1);
System.out.println("testDB:main:add user to Database");
try{
db.addUser(user);
}catch(SQLException sql){
System.out.println("testDB:main:user not added to Database "+sql);
}
}
public static void main(String arg[]) throws SQLException{
testDB test=new testDB();
test.creatUser ();
}
}
// and here is my real class code which is cozing problem.
public int registerMeToServer(ClientInfo client)
throws RemoteException
{
User user=client.getUser();
int id=db.getMaxId ();
user.setId (id);
Integer key=new Integer(id);
System.out.println("Server:registerMeToServer: user: " +user);
try{
db.addUser (user);
clients.put(key,client);
System.out.println("Server:registerMeToServer: ClientID : " +id);
}catch(Exception e){
System.out.println("Server:registerMeToServer:Error : " +e);
if(clients.contains (key)){
clients.remove (key);
}
id=NOT_FOUND;
}
return id;
}
it throws SQLExcpetion General error
thanking you again
Qasim shabbir
Sun Certified Java Programer
thanx for reply.
i add a JScrollPane on JTextArea now i want tht JScrollPane make auto scroll and show me the last appended text.
i hope u understand..
thnx again
Qasim Shabbir
21 years ago
can any body know y general error occurs.. wht does it means..
i use a class to communicate with database now my test class is working fine.. but when i use my real class it throws a general error same code.
i m puzzled please help
Qasim shabbir.
hi
i want to focus on new line appended in text area how can i do it..
please help me in this regards..
thanking you
Qasim Shabbir
21 years ago
thnx 4 reply robertson..
well i implement yr suggestion. but sorry to say its still not working and throwing same error..
about hsql yes i cut and paste query string there and there is no problem of capitalization..
i m using access 2000 i didnt hv any other version of access.. is there any problen in access database regarding to relation. if any body know pls reply..
QASIM SHABBIR
here is the method which cozing exception..
i use jdbcodbc birdge for acess database.

public Vector getBuddyList(int userId){
Statement statement;
String query="select buddylist.*, chater.nick from buddyList, chater where buddylist.id="+userId+" and chater.user_id=buddylist.buddy_id ";
Vector buddyList=new Vector();
try{
statement=connection.createStatement();
System.out.println("DBConnection:getBuddyList:query ="+query);
ResultSet rs=statement.executeQuery(query);
System.out.println("DBConnection:getBuddyList: executed :");
while(rs.next ()){
Buddy buddy=new Buddy();
buddy.setBuddyId (rs.getInt("buddy_id"));
buddy.setId (rs.getInt("id"));
buddy.setBlock (rs.getByte("isblock"));
buddy.setStatus (rs.getByte("status"));
buddyList.addElement(buddy);
}
return buddyList;
}catch(SQLException sql){
String errorMessage=
"DBConnection:getBuddyList roblem in query :"+sql;
System.out.println(errorMessage);
}
return null;
}
Qasim Shabbir
SCJP
hi thnx for replying..
actuly first i use.. prepared statement its throws "Too few Parameter expected 2. there after i use Statment then its throws "...Expected 1"
also as per yr suggestion i use complete table name and write complete field name instead of *.
but the error is same.. it work fine on single table query but again on join condition it throws error.
Qasim Shabbir
SCJP
Sorry! its not "too few arguments" instead the complete detail of error are:
DBConnection:getBuddyList roblem in query :
java.sql.SQLException: [Microsoft][O
DBC Microsoft Access Driver] Too few parameters. Expected 1.
i m useing Statement object to fire a query.
QASIM
SCJP
Sorry! its not "too few arguments" instead the complete detail of error are:
DBConnection:getBuddyList roblem in query :
java.sql.SQLException: [Microsoft][O
DBC Microsoft Access Driver] Too few parameters. Expected 1.
i m useing Statement object to fire a query.
i wanted to focus on new added item on list.. how can i do it if any body help me in tht regard.
when item is added default behaviour of JList is simple insert it downward the scroll bar is not moved downward. i wants to do it autmaticaly. when new item is added to a list the srollbar is also move downword.
simply stated is tht i wants tht list always show me new item added.. no matter how much item i added. it should focusing on last aded item.
thnks in advance.. for help in above matter.
qasim shabbir
SCJP
21 years ago
i m using access data base.. and following table i created..
1. chater
fields. user_id int,nick string,status int
2. buddys
fileds. id int,buddy_id int ,status int
here is my simple query String
String q1 = "select b.*,c.nick from buddylist b,chater c where b.id=? "+
"and b.buddy_id=c.user_id";
i use this same query on hsql managar its work fine but in my class it gives above error.
also if i write a query to fatch record from single table its work fine but in join condition it gives above error.. i dont know how to takle this error plesae help..
thanks in advance
Qasim Shabbir
SCJP
hi
i write a simple rmi program which throw exception :

Exception in thread "main" java.security.AccessControlException: access
denied (
java.net.SocketPermission qasim resolve)
at java.security.AccessControlContext.checkPermission(AccessControlConte
xt.java:272)
i dont know how to avoid this exception i do following changes in java.policy but its not working
grant codeBase "file:///f:/java/*" {
permission java.security.AllPermission;
};
my code is reside in f:\java\bank\
please help me to prevent this error..
thank in advance..
Qasim Shabbir
21 years ago
hi all.
i want to add some days on date but its not giving me perfect result i m adding days on date.. my code is written below, the problem is whn counter value reaches to 25 it reverse the month... i do not understand y it happens. plz help me in that regards..

import java.util.Date;
public class Test{
public static void main(String ar[]){
Date date=new Date("10/1/2002");
System.out.println(date);
for (int i=1;i<30;i++){
System.out.println("Value to be Multi : "+i);
long ldt=date.getTime()+(1000*60*60*24)*i;//add one day
System.out.println(ldt);
System.out.println(new Date(ldt));
}
}
}
thankyou all in advance.
Qasim Shabbir
21 years ago
<jsp:include page ="foo.jsp"
here this attribute is identify the document whose output is to be inserted into current page.
"flush" attribute actions is controls buffers output whether buffer is fulshed to current page.
(on jsp 1.1 specification, it is required tht flush attribute is set to true)
<jsp ram name=“user” value=“Bob” />
its just add parameter into request object passes on to including page
</jsp:include >
tag endes..
21 years ago
JSP