專案上因為有需求,開發SAP額外的擴充功能,以下是簡單的筆記。
進行步驟
環境:windows 7×64,NetBean 6.9,SAP Business One 8.8
1.首先將SAP底下的lib檔複製到System32底下
2.使用netbean開啟新專案
3.將jar檔引入
4.進行連線
ICompany company = SBOCOMUtil.newCompany(); //Database settings: company.setServer("伺服器位置"); company.setDbPassword("資料庫密碼"); company.setDbUserName("資料庫使用者"); //Business One settings: company.setUserName("使用者"); company.setPassword("密碼"); company.setDbServerType(SBOCOMConstants.BoDataServerTypes_dst_MSSQL2008); company.setLanguage(SBOCOMConstants.BoSuppLangs_ln_Chinese); company.setCompanyDB("使用資料庫名稱"); System.out.println("connecting"); // connect now int nResult = company.connect(); // throw exception if failed if ( nResult != 0 ) { System.out.println("Could not connect"); System.exit(0); } System.out.println("connected"); company.disconnect(); System.out.println("disconnected");