Home > TC2 > TC232CPE
TC232CPE Datasheet | Microchip Technology
Part No. : TC232CPE
Description : DUAL RS-232 TRANSMITTER/RECEIVER AND POWER SUPPLY
Download : TC232CPE Click to Download
Page Number : 6
Manufacturer : Microchip Technology
File Size : 53 Kb

TC232CPE Article About

The following code is attached to a Demo, there are two functions: one POI to read Excel, the second is the DB2 database connection and SQL execution. import Java.io.FileInputStream; import java.io.IOException; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Statement; import org.apache.poi.hssf . usermodel.HSSFCell; import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi . poifs.filesystem.POIFSFileSystem; public class POITest {private static Connection conn = null; private static Statement stmt = null; private static boolean connectDB2 {String url = ""; String username = "username"; String password = "password"; / / load the driver to connect to the database try {/ / add the class library driver package db2jcc.jar and db2jcc_license_cu.jarClass.forName; url = "JDBC: db2: / / 192.168.0.1:50000 / dbname"; / / add class Library driver package db2java.jar / / Class.forName.newInstance; / / url = "jdbc: db2: njtcdata"; conn = DriverManager.getConnection; stmt = conn.createStatement;} / / load the driver caught exception catch {System . err.println; cnfex.printStackTrace; return false;} / / capture connect to database exception catch {System.err.println; sqlex.printStackTrace; / / System.exit; / / terminate programreturn false;} return true;} private static boolean readExcelToDB2 {POIFSFileSystem fs = null; HSSFWorkbook wb = null; try {fs = new POIFSFileSystem); wb = new HSSFWorkbook;} catch {e.printStackTrace; return false;} HSSFSheet sheet = wb.getSheetAt; HSSFRow row = null; HSSFCell cell = null; String name = ""; int id = 0; int rowNum, cellNum; int i; rowNum = sheet.getLastRowNum; for {row = sheet.getRow; / / cellNum = row.getLastCellNum; cell = row.getCell 0); name = cell.getStringCellValue; cell = row.getCell 1); id = cell.getNumericCellValue; String sql = "insert into TEST values"; try catch {e1.printStackTrace; return false;}} return true;} public static void main {if == true) {if == true) System.out.println; elseSystem.out.println;} else}}
Mail is a non-real-time information exchange method is more suitable for broadcast relay stations, in order to facilitate the users to communicate with the outside world through e-mail, mail-Founder broadcast stations broadcast function, to achieve the message receiver, and will ensure that information on the internal network will not leak to the Internet, by mail, to ensure that internal network information security. Two agents have many units there are many branches, and would like to visit the headquarters of the branches can also broadcast content, between the affiliates and the headquarters of the network connection is usually slow connection, it will cause these branches to access the contents of the headquarters of the anchor when the speed is very slow, in order to solve this problem, Founder broadcast relay station design of the two agents, the use of two relay agent can do if the user visits the page in the secondary relay agent is not found within the secondary relay to the headquarters of the proxy server agent request the page and the page into their own

All rights reserved:iceach.com © 2000-2010 Certificate No.:Guangdong ICP No.08108781