Im newbie, wanted to connect to DB2 n view files

Advertisement

package bean;
import java.io.*;
import java.sql.*;
import java.lang.*;
import java.util.*;
import java.text.*;
public class testagtinithash{
     Connection con=null;
     Statement stmt;
     ResultSet rs;
     public static void main (){
public Vector getOpenDatedCover(String compcode,String insertstmp1,String insertstmp2,String covernoteno,String agentcode,String branchcode){
     Vector vecoc=new Vector();
     Connection cnt=null;
     DB2conBean2 conbn=new DB2conBean2();
     cnt=conbn.getConn(compcode);
     conbn=null;
     try{
          if(cnt!=null){
               String lastagtcode="",agencyname="";
               PreparedStatement pstmt=null,pstmt2=null;
               ResultSet rst=null,rst2=null;
               String strsql="select cnname,cnregno,cncovernoteno,cngrossdue,cnnetdue,cnbranchcode,cnagentcode,cnsuminsured,"+
                              "cnengineno,cnchassisno,cninsertstmp from mtcnmaster";
               if(insertstmp1.length()>0 && insertstmp2.length()>0 && covernoteno.equals("")){
                    strsql=strsql+" where cninsertstmp between '"+insertstmp1+"' and '"+insertstmp2+"'";
               }else if(covernoteno.length()>0){
                    strsql=strsql+" where cncovernoteno='"+covernoteno+"'";
               if(agentcode.length()>0){
                    strsql=strsql+" and cnagentcode='"+agentcode+"'";
               if(branchcode.length()>0){
                    strsql=strsql+" and cnbranchcode='"+branchcode+"'";
               strsql=strsql+" and cncompcode='"+compcode+"' and cnstatus='1' and cnregno='' and cneffectivedate is null order by cnagentcode,cninsertstmp";
               pstmt=cnt.prepareStatement(strsql);
               rst=pstmt.executeQuery();
//System.out.println(strsql);
               while (rst.next()){
                    String cnname=rst.getString("cnname");
                    cnname=cnname==null?"":cnname.trim();
                    String cnregno=rst.getString("cnregno");
                    cnregno=cnregno==null?"":cnregno.trim();
                    String cncovernoteno=rst.getString("cncovernoteno");
                    cncovernoteno=cncovernoteno==null?"":cncovernoteno.trim();
                    double grossdue=rst.getDouble("cngrossdue");
                    double netdue=rst.getDouble("cnnetdue");
                    String cnbranchcode=rst.getString("cnbranchcode");
                    cnbranchcode=cnbranchcode==null?"":cnbranchcode.trim();
                    String cnagentcode=rst.getString("cnagentcode");
                    cnagentcode=cnagentcode==null?"":cnagentcode.trim();
                    double suminsured=rst.getDouble("cnsuminsured");
                    String cnengineno=rst.getString("cnengineno");
                    cnengineno=cnengineno==null?"":cnengineno.trim();
                    String cnchassisno=rst.getString("cnchassisno");
                    cnchassisno=cnchassisno==null?"":cnchassisno.trim();
                    String cninsertstmp=rst.getString("cninsertstmp");
                    if (cninsertstmp!=null){
                         if (cninsertstmp.length()>=10){
                              cninsertstmp = cninsertstmp.substring(8,10)+"-"+cninsertstmp.substring(5,7)+"-"+cninsertstmp.substring(0,4);
                    else{
                         cninsertstmp="";
                    String cnpaystat="",cnjpjcaptured="",cnpayamt="";
                    String strsql2="select cnpaystat,cnjpjcaptured,cnpayamt from covernote where cncvnoteno='"+cncovernoteno+"' and cncompcode='"+compcode+"'";
//System.out.println(strsql2);
                    pstmt2=cnt.prepareStatement(strsql2);
                    rst2=pstmt2.executeQuery();
                    if(rst2.next()){
                         cnpaystat=rst2.getString("cnpaystat");
                         cnpaystat=cnpaystat==null?"":cnpaystat.trim();
                         if(cnpaystat.equals("PD")){
                              cnpaystat="Pending";
                         }else if(cnpaystat.equals("P")){
                              cnpaystat="Paid";
                         }else if(cnpaystat.equals("NP")){
                              cnpaystat="Not Paid";
                         cnjpjcaptured=rst2.getString("cnjpjcaptured");
                         cnjpjcaptured=cnjpjcaptured==null?"":cnjpjcaptured.trim();
                         if(cnjpjcaptured.equals("C")){
                              cnjpjcaptured="Successful";
                         }else if(cnjpjcaptured.equals("S")){
                              cnjpjcaptured="Pending";
                         }else if(cnjpjcaptured.equals("R")){
                              cnjpjcaptured="Rejected";
                         }else if(cnjpjcaptured.equals("N")){
                              cnjpjcaptured="Not Sent";
                         double payamt=rst2.getDouble("cnpayamt");
                    rst2.close();
                    Hashtable param= new Hashtable();
                    param.put("cnname",cnname);
                    param.put("cnregno",cnregno);
                    param.put("cncovernoteno",cncovernoteno);
                    param.put("cnbranchcode",cnbranchcode);
                    param.put("cnagentcode",cnagentcode);
                    param.put("cnengineno",cnengineno);
                    param.put("cnchassisno",cnchassisno);
                    param.put("cninsertstmp",cninsertstmp);
                    param.put("cnpaystat",cnpaystat);
                    param.put("cnjpjcaptured",cnjpjcaptured);
                    param.put("cnpayamt",cnpayamt);
                    param.put("agencyname",agencyname);
                    vecoc.addElement(param);
               rst.close();
               pstmt.close();
     catch(Exception e){
          System.out.println("agtinit.getOpenDatedCover ERROR : "+e.toString());
     finally{
          if(cnt!=null){
               try{
                    cnt.close();
               }catch(SQLException e){}
          return vecoc;
}

Advertisement

1. use code tags
2. whats your question

November 30, -0001

Im newbie, wanted to connect to DB2 n view files

package bean; import java.io.*; import java.sql.*; import java.lang.*; import java.util.*; import java.text.*; public class testagtinithash{      Connection con=null;      Statement stmt;      ResultSet rs;      public static void main (){ public Vec

OK, Downloaded OSXVCN And Want To Connect To My Neighbor's Mac, How?

Hi folks. I just downloaded OSX VCN for my iBooK G4, OSX 10.4.7 and want to connect to my neighbor's Mac with the same OS. She and I want to experiment and see if we can get this going. Does she download the same app I did? Am I the viewer or server?

Want to connect MDM server

hi friends, I want to connect MDM server using JCO can you please provide me the sample java code for that. Regards, Venki.Hi Venki: Check the blog below: Using MDM5.5 Java Connector with  SAP Enterprise Portal 6.0 Thanks, GLMRead other 2 answers

Numerous "web process wants to connect to"

I did a routine update of my Macbook and now every step I take is hindered by "Web process wants to connect to...." This is driving me crazy and slowing everything down. Can't believe this is from Apple......does my virus resistant Mac have a bu

I want to connect a Belkin router to my TC

I want to connect a Belkin router to my TC via cable to extend my network to my garage.  Can anyone tell me how to go about it, if it is possible to do?966?? That is not its full model number and revision. I cannot find any listing for 966. Belkin nu

Airport does not want to connect to a weaker signal

my airport has decided that it does not want to connect to a weaker signal. at home if i am next to the wireless source my computer connects just fine, but if i go downstairs to my room the signal strength starts dropping and then will disconnect all

Why does Perl 5.12 want to connect to daryl.dostech.ca and who the heck is Daryl?

After recently installing Lion I'm getting a lot of Little Snitch hits from Perl.  WTH?  OK, I know perl is a proramming language great for string manipulation and widely used in network programming but why does something like that want to connect to

HT4623 hi i have ipad 2 and i want to connect my external hard disk to transfer data from ipad to directly to external drive?

hi i have ipad 2 and i want to connect my external hard disk to transfer data from ipad to directly to external drive?Only if you have an app and a wifi hard drive like this http://www.seagate.com/external-hard-drives/portable-hard-drives/wireless/wi

Want to connect 2 cinema display

hi i want to connect 2 cinema display to an iMac what do i have to do? is it compatible? what do i have to bue? thanks peterIf you don't need high speed for one display, you could use a USB to DVI adapter <http://www.gefen.com/kvm/dproduct.jsp?prod_i

I want to connect a FLIR camera to my iPad. How can I submit a PAL signal to my iPad?

I want to connect a FLIR camera to my iPad. How can I submit a PAL signal to my iPad?Thanks, too bad. Now I have to get a different tablet, ****.Read other 3 answers

Hi Guys. I have an ipad version 5.1.1 that I want to connect to my office PC server via wifi. Any ideas.

Hi Guys. I have an ipad version 5.1.1 that I want to connect to my office PC server via wifi. Any ideas.You can only import photos from the camera roll into the computer. Is that the album that you are seeing? Any albums that you create on the device

I want to connect to my PC but need an upgrade?

I want to connect my ipad2 to my pc but iTunes on y pc says I need iTunes 10.5 or more on my iPad.  How do I download iTunes 10.5 or more on my ipad2? I cannot find how to do this anywhere!Do you mean that you've downloaded and installed iTunes 10.5

Smbclient wants to connect to TCP port 139

On my Powerbook, using Little Snitch under certain conditions (undetermined) I get the following message repeatedly, I am not connected to a network (except for Airport) or printer: The application "smbclient" wants to connect to 192.168.131.65

I want to connect keyboard at iPad and I couldn't

I want to connect wireless,keyboard at my iPad I tried itMiriam- If you go to Settings-General-Bluetooth, is Bluetooth set to ON?  If it is, does your keyboard appear under Devices?  If it does but is not connected, press on Not Connected.  You shoul

Hi! I sold my Iphone on ebay. The seller wants to connect the Iphone with his Apple ID, but it did not work because it says that the Iphone is already connected with another Apple ID. How can I get rid of this old connection? What do I have to do?

Hi! I sold my Iphone on ebay. The seller wants to connect the Iphone with his Apple ID, but it did not work because it says that the Iphone is already connected with another Apple ID. How can I get rid of this old connection? What do I have to do?Wha

How long does it take to connect to Wi-Fi the first time I use my Ipad? It's been over 30 minutes. I see that it wants to connect but it keeps on turning.

How long does it take to connect to Wi-Fi the first time I use my Ipad? It's been over 30 minutes. I see that it wants to connect but it keeps on turning.It should not take very long. Up to thirty seconds tops depending on your Wi-Fi network. Try reb

My computer was restarted and now i want to connect and update my iphone with a new itunes. how do i do this without losing all my stuff on my iphone?

my computer was restarted and now i want to connect and update my iphone with a new itunes. how do i do this without losing all my stuff on my iphone? i didnt get a chance to back my phone up before the comp crashed will i lose any of my stuff?When y

Crystal Report Connect to DB2 z/OS

Post Author: pabhijit CA Forum: Data Connectivity and SQL Hi I am trying to make a DB2 connection from the crystal report interface using JDBC(JNDI).Using com.ibm.db2.jcc.DB2Driver as the database class name. Database  - Mainframe DB2 z/OSCrystal rep

I want to connect a DataBase(oracle) through Tomcat5.

i want to connect a DataBase(oracle) through Tomcat5. pls tell me the steps how can i do this .or pls give me any link thanks previouslyThe bottom line is. If you can't figure this part out on your own then you have no business doing any JDBC program

Want to connect an older Amplifier to AEX. Input data is 200mV for the amp. When I connect sound level is very low. What is output on AEX?

Want to connect an older amplifier to AEX. Input (AUX)data is 200mV. The soundlevel is very low. What is output from AEX? Phono input is 2,5mV and gives too high soundlevel as well as a strange sound(Isuppose some preamp is there) Anyone to give some