hi all,
     here is my code iam using sqlserver 
iam getting following error
Exception java.sql.SQLException: [Atinav][JDBC SQL Server Driver] Address already in 
use: connect
plz plz tell where iam wrong
//package infiniteopps.WebWizard;
import infiniteopps.WebWizard.*;
import infiniteopps.db.local.DBTransaction;
import java.sql.*;
import java.io.*;
import java.text.*;
public class UpdateChildCountStand
{
      String name;
      public DBTransaction db;
     Connection con;
   Statement stat;
   DateFormat df;
    String strdt;
   public static void main(String[] args)throws Exception
    {
         try{
                      UpdateChildCountStand uc = new UpdateChildCountStand(1);
                     uc.check("raja0001");
                     uc.close();
               }
         catch(Exception e)
           {
                 Log1.out("Exception "+e);
         }
                 System.in.read();
 }
 public UpdateChildCountStand(int count)throws Exception
     {
                         db = new DBTransaction();
                               con = db.getConnection();
                      //con.setAutoCommit(false);
java.util.TimeZone indiaZone = java.util.TimeZone.getTimeZone("GMT+5:30");
                           df = DateFormat.getDateInstance(DateFormat.DATE_FIELD);
                           df.setTimeZone(indiaZone);
                          strdt = df.format(new java.util.Date());
                                Connection con = db.getConnection();

      }

   public int check(String id)throws Exception
      {
         //Log1.out("check begin");
               int intleft=0,intright=0;
             if(id.equals("null"))
                        return 0;
         //Log1.out("aaaaa begin");
                //ResultSet rs = db.getResult("select CustNo from CustHeadSide where 
HeadNo ='" + id +"'  and side='l'");

             Statement stat = con.createStatement();
             ResultSet rs = stat.executeQuery("SELECT CustomerDetls.CustNo FROM 
CustomerDetls INNER JOIN CustomerMaster ON  CustomerDetls.CustNo = 
CustomerMaster.CustNo where HeadNo ='" + id +"'  and CustomerMaster.Type='l'");

           if(rs.next())
             {
                 String tmp = rs.getString(1);
                        rs.close();
                       stat.close();
                     Log1.out("\nleft "+tmp);
                        intleft += check(tmp)+1;
                }
         else
                      check("null");
            //ResultSet rs1 = db.getResult("select CustNo from CustHeadSide where 
HeadNo ='" + id +"'  and side='r'");
               //Log1.out("bbbbb begin");
                stat = con.createStatement();
           ResultSet rs1 = stat.executeQuery("SELECT CustomerDetls.CustNo FROM 
CustomerDetls INNER JOIN CustomerMaster ON  CustomerDetls.CustNo = 
CustomerMaster.CustNo where HeadNo ='" + id +"'  and CustomerMaster.Type='r'");
            if(rs1.next())
         {
                 String tmp = rs1.getString(1);
                  rs1.close();
                     stat.close();
                     Log1.out("\nright "+tmp);
                 intright +=check(tmp)+1;
             }
         else
                      check("null");
            rs1 = db.getResult("select CustNo from custChCount1 where 
CustNo='"+id+"'");
             //Log1.out("custChCount begin");
          if(rs1.next())
            {
                 db.setTable("custChcount1");
                              db.setFields("rightchild",intright);
                         db.setFields("leftchild",intleft);
                                //db.setFields("checkbit",0);
                 db.setWhere("CustNo",id);
                 db.update();
                      //db.closeConnection();
                     Log1.out("\nupdated ");
           }
         else
          {
                 db.setTable("custChcount1");
                              db.setFields("CustNo",id);
                           db.setFields("rightchild",intright+"");
                           db.setFields("leftchild",intleft+"");
                      db.save();
                        Log1.out("\nsaved "+strdt);
          }
         rs1.close();
              return intright+intleft;
        }


 


___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to