Java入门指南:探索Java 7的核心概念和技术

4星 · 超过85%的资源 需积分: 10 2 下载量 46 浏览量 更新于2024-07-29 收藏 10.77MB PDF 举报
"Beginning.Java.7 是一本针对初学者的Java编程入门书籍,涵盖了Java语言的基础知识、类和对象、高级语言特性、API接口、集合、图形用户界面、文件系统交互、网络和数据库操作、XML处理、Web服务以及Java与Android的结合应用。" 在本书中,作者旨在引导读者逐步了解并掌握Java技术。第一章"Getting Started with Java"从基础知识开始,为读者解答“什么是Java?”这一问题。对于初次接触Java的人来说,这一章将提供Java的基本概念,包括它是一种描述程序的语言,同时也是一个运行平台,支持用Java以及其他如Groovy、Jython和JRuby等语言编写的程序。 书中随后的章节深入到Java的核心元素。第二章"Discovering Classes and Objects"介绍了面向对象编程的基础,讲解如何定义和使用类以及创建和操作对象。第三章"Exploring Advanced Language Features"探讨了如多态性、继承和接口等高级语言特性,帮助读者理解Java的强大之处。 第四章"Touring Language APIs"带领读者遍历Java的标准库,学习如何使用各种API来实现常用功能。第五章"Collecting Objects"则专注于集合框架,如ArrayList、LinkedList和HashMap等数据结构的使用。第六章"Touring Additional Utility APIs"进一步介绍其他实用工具类和库,如并发和I/O操作。 第七章"Creating and Enriching Graphical User Interfaces (GUIs)"教授读者如何利用Java构建图形界面,提供用户友好的交互体验。第八章"Interacting with Filesystems"讲解文件和目录操作,而第九章"Interacting with Networks and Databases"则涉及网络通信和数据库连接,使读者能够开发网络应用程序和数据库驱动的应用。 第十章"Parsing, Creating, and Transforming XML Documents"涵盖了XML的处理,包括解析、创建和转换XML文档,这对于数据交换和配置文件管理至关重要。第十一章"Working with Web Services"介绍了如何利用Java开发和消费Web服务,包括SOAP和RESTful API。 最后一章"Chapter12: Java7 Meets Android"将Java 7与Android平台相结合,向读者展示了如何在Android设备上开发应用程序。 此外,书后还附有索引,方便读者查找特定主题。这是一本全面覆盖Java 7基础的教程,适合那些希望踏入Java世界的新手,通过学习可以建立坚实的基础,并为更深入的Java编程打下良好基础。

[root@zhaosai conf]# sqoop import --connect jdbc:mysql://zhaosai:3306/mydb --username root --password jqe6b6 --table news --target-dir /user/news --fields-terminated-by “;” --hive-import --hive-table news -m 1 Warning: /opt/programs/sqoop-1.4.7.bin__hadoop-2.6.0/../hbase does not exist! HBase imports will fail. Please set $HBASE_HOME to the root of your HBase installation. Warning: /opt/programs/sqoop-1.4.7.bin__hadoop-2.6.0/../hcatalog does not exist! HCatalog jobs will fail. Please set $HCAT_HOME to the root of your HCatalog installation. Warning: /opt/programs/sqoop-1.4.7.bin__hadoop-2.6.0/../accumulo does not exist! Accumulo imports will fail. Please set $ACCUMULO_HOME to the root of your Accumulo installation. Warning: /opt/programs/sqoop-1.4.7.bin__hadoop-2.6.0/../zookeeper does not exist! Accumulo imports will fail. Please set $ZOOKEEPER_HOME to the root of your Zookeeper installation. 23/06/10 16:07:14 INFO sqoop.Sqoop: Running Sqoop version: 1.4.7 23/06/10 16:07:15 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead. 23/06/10 16:07:15 INFO manager.MySQLManager: Preparing to use a MySQL streaming resultset. 23/06/10 16:07:15 INFO tool.CodeGenTool: Beginning code generation 23/06/10 16:07:15 ERROR sqoop.Sqoop: Got exception running Sqoop: java.lang.RuntimeException: Could not load db driver class: com.mysql.jdbc.Driver java.lang.RuntimeException: Could not load db driver class: com.mysql.jdbc.Driver at org.apache.sqoop.manager.SqlManager.makeConnection(SqlManager.java:875) at org.apache.sqoop.manager.GenericJdbcManager.getConnection(GenericJdbcManager.java:59) at org.apache.sqoop.manager.SqlManager.execute(SqlManager.java:763) at org.apache.sqoop.manager.SqlManager.execute(SqlManager.java:786) at org.apache.sqoop.manager.SqlManager.getColumnInfoForRawQuery(SqlManager.java:289) at org.apache.sqoop.manager.SqlManager.getColumnTypesForRawQuery(SqlManager.java:260) at org.apache.sqoop.manager.SqlManager.getColumnTypes(SqlManager.java:246) at org.apache.sqoop.manager.ConnManager.getColumnTypes(ConnManager.java:327) at org.apache.sqoop.orm.ClassWriter.getColumnTypes(ClassWriter.java:1872) at org.apache.sqoop.orm.ClassWriter.generate(ClassWriter.java:1671) at org.apache.sqoop.tool.CodeGenTool.generateORM(CodeGenTool.java:106) at org.apache.sqoop.tool.ImportTool.importTable(ImportTool.java:501) at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:628) at org.apache.sqoop.Sqoop.run(Sqoop.java:147) at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70) at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:183) at org.apache.sqoop.Sqoop.runTool(Sqoop.java:234) at org.apache.sqoop.Sqoop.runTool(Sqoop.java:243) at org.apache.sqoop.Sqoop.main(Sqoop.java:252)

2023-06-11 上传

root@zhaosai conf]# sqoop import --connect jdbc:mysql://192.168.160.130:3306/mydb --username root -P --table news --hive-import --hive-table mydb.news --incremental append --check-column id --last-value 0 --split-by id --target-dir /hdfs://zhaosai:9000/user/hive/warehouse/news --num-mappers 1 23/06/07 17:23:56 INFO sqoop.Sqoop: Running Sqoop version: 1.4.7 Enter password: 23/06/07 17:24:04 INFO tool.BaseSqoopTool: Using Hive-specific delimiters for output. You can override 23/06/07 17:24:04 INFO tool.BaseSqoopTool: delimiters with --fields-terminated-by, etc. 23/06/07 17:24:04 INFO manager.MySQLManager: Preparing to use a MySQL streaming resultset. 23/06/07 17:24:04 INFO tool.CodeGenTool: Beginning code generation Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary. 23/06/07 17:24:04 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM `news` AS t LIMIT 1 23/06/07 17:24:04 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM `news` AS t LIMIT 1 23/06/07 17:24:04 INFO orm.CompilationManager: HADOOP_MAPRED_HOME is /opt/programs/hadoop-2.7.6 注: /tmp/sqoop-root/compile/b07035b094b6ac39b87f2ef11261c934/news.java使用或覆盖了已过时的 API。 注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。 23/06/07 17:24:05 INFO orm.CompilationManager: Writing jar file: /tmp/sqoop-root/compile/b07035b094b6ac39b87f2ef11261c934/news.jar 23/06/07 17:24:05 INFO tool.ImportTool: Maximal id query for free form incremental import: SELECT MAX(`id`) FROM `news` 23/06/07 17:24:05 ERROR tool.ImportTool: Import failed: java.io.IOException: java.sql.SQLSyntaxErrorException: Unknown column 'id' in 'field list' at org.apache.sqoop.tool.ImportTool.initIncrementalConstraints(ImportTool.java:322) at org.apache.sqoop.tool.ImportTool.importTable(ImportTool.java:511) at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:628) at org.apache.sqoop.Sqoop.run(Sqoop.java:147) at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70) at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:183) at org.apache.sqoop.Sqoop.runTool(Sqoop.java:234) at org.apache.sqoop.Sqoop.runTool(Sqoop.java:243) at org.apache.sqoop.Sqoop.main(Sqoop.java:252) Caused by: java.sql.SQLSyntaxErrorException: Unknown column 'id' in 'field list' at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) at com.mysql.cj.jdbc.StatementImpl.executeQuery(StatementImpl.java:1200) at org.apache.sqoop.tool.ImportTool.getMaxColumnId(ImportTool.java:238) at org.apache.sqoop.tool.ImportTool.initIncrementalConstraints(ImportTool.java:309)

2023-06-08 上传