package com.chenyang.nse.bussiness.webtools.tools.jdbc;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

public class MysqlJdbc {
   public static void main(String[] args) {
      try {
         Class.forName("com.mysql.cj.jdbc.Driver");
         System.out.println("Success loading Mysql Driver!");
      } catch (Exception e) {
         System.out.print("Error loading Mysql Driver!");
         e.printStackTrace();
      }

      try {
         Connection connect = DriverManager.getConnection("jdbc:mysql://192.168.2.202:3306/test?zeroDateTimeBehavior=convertToNull&rewriteBatchedStatements=true", "root", "root");
         System.out.println("Success connect Mysql server!");
         Statement stmt = connect.createStatement();
         ResultSet rs = stmt.executeQuery("select NAME,MOBILE,TELEPHONE,EMAIL,CHINESEADDRESS,IP,COMPANYNAME,IDCARD,MIXEDTELEPHONE,BANKCARD,BIRTHDAY33,AGE,CVN2,POSTALCODE,SOCIALSECURITYCARD,LICENSEPLATE,ORGANIZATIONCODE,BUSINESSLICENSE,TAXID,MIXEDIDNUMBER,OPENINGBANK,STOCKCODE,SOCIALUNIFORM,FLIGHTTICKET,CREDITCARDEXPIRATION,MERCHANTNAME,PLACECODE from syl.at_test where 1=1 ");

         while(rs.next()) {
            System.out.println(rs.getString(1));
         }
      } catch (Exception e) {
         System.out.print("get data error!");
         e.printStackTrace();
      }

   }
}
