Heim > Datenbank > MySQL-Tutorial > Hauptteil

MT6235 08B 的功能浏览 2

WBOY
Freigeben: 2016-06-07 15:27:23
Original
1239 Leute haben es durchsucht

6. FONT_ENGINE 矢量字库 7. CMMB_SUPPORT 中国移动多媒体广播 China Mobile Multimedia Broadcasting CMMB 规定了在广播业务频率范围内,移动多媒体广播系统广播信道传输信号的帧结构、信道编码和调制,该标准适用于 30MHz 到 3000MHz 频率范围内的广播业务

6. FONT_ENGINE

矢量字库

 

7. CMMB_SUPPORT

中国移动多媒体广播 China Mobile Multimedia Broadcasting CMMB规定了在广播业务频率范围内,移动多媒体广播系统广播信道传输信号的帧结构、信道编码和调制,该标准适用于30MHz3000MHz频率范围内的广播业务频率,通过卫星和/或地面无线发射电视、广播、数据信息等多媒体信号的广播系统,可以实现全国漫游。

 

8. SQLITE3_SUPPORT

1.SQLite简介
SQLite
是实现了以下特征的软件:
i.Self-Contained
SQLite最大程度的实现了self-contained。它实现了对外部程序库以及操作系统的最低要求,这使得它非常适合应用于嵌入式设备,同时,可以应用于一些稳定的,很少修改配置的应用程序中。
SQLite
是使用ANSI-C开发的,可以被任何的标准C编译器来进行编译。
SQLite
与操作系统和存储设备(磁盘)之间的通信是通过VFS(Virtual File System)来完成的,对于嵌入式设备来说,开发一个可用的VFS并不困难。
SQLite
使用互斥来保证多线程环境下的操作安全性。
SQLite
的源代码是一个单一的C文件-sqlite3.c,如果project需要使用它,只需要包含这个C文件和对应的头文件(sqlite3.h)


ii.Serverless
:大多数SQL数据库引擎都作为一个独立的服务器进程,应用程序通过使用一些协议,比如TCP/IP来发送请求给服务器,并接受结果,以这种方式来与数据库服务器进行通信。SQLite与此不同,进程可以通过访问数据库直接进行数据库文件的读写而不需要中间层的服务器进程。这样的实现的主要的好处是不需要进行安装,配置,初始化,管理以及维护单独的服务进程。但是,数据库引擎可以通过使用服务器来预防客户端应用程序的bug,确保服务器不被客户端的错误所损坏。大多数SQL数据库都是基于C/S模式的,在serverless的数据库中,SQLite是目前唯一允许多个应用同时访问的。


iii.Zero-Configuration
SQLite不需要任何配置---installsetupconfigure serveradministrationcreate instanceassign permissionsrecovertroubleshooting


iv.Transactional
SQLite实现了ACID(Atomic-原子性,Consistent-一致性,Isolated-隔离性,Durable-持久性)SQLite实现了序列化事务来保证ACID,即使发生程序异常,操作系统异常或者电源故障。


v.Most Widely Deployed SQL Database
:大多数数据库是C/S模式的,而一台服务器可以为很多人提供服务,而SQLite是嵌入式的数据库软件,大多数用户会同时使用多个数据库的拷贝。SQLite大量的被用于手机,PDAMP3播放器以及机顶盒设备。下面列举了一些使用SQLite作为嵌入式服务器的应用:
 Mozilla Firefox
使用SQLite作为数据库。
 Mac
计算机中的包含了多份SQLite的拷贝,用于不同的应用。
 PHP
SQLite作为内置的数据库。
 Skype
客户端软件在内部使用SQLite
 SymbianOS(
智能手机操作平台的领航)内置SQLite
 AOL
邮件客户端绑定了SQLite
 Solaris 10
在启动过程中需要使用SQLite
 McAfee
杀毒软件使用SQLite
 iPhones
使用SQLite
 Symbian
Apple以外的很多手机生产厂商使用SQLite
关于使用SQLiteFamous Users,请参考http://www.sqlite.org/famous.html


vi.OpenSource
SQLite处于public domain中,官方声明如下:
Anyone is free to copy, modify, publish, use, compile, sell, or distribute the original SQLite code, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.
一些其他的特色例如执行速度比C/S模式的数据库引擎快、简单易用、源代码注释良好、跨平台等请参考SQLite Features列表:
http://www.sqlite.org/features.html



2.SQLite
的应用场景
SQLite
具有小巧,快速和可靠的优点是源于其简单-管理简单,操作简单,嵌入简单以及维护自定义简单。
当然,SQLite也有一些缺点,这取决于用户的需求,SQLite不具有高度并发性,良好的存取权限控制,没有内置的函数集,不支持存储过程以及深奥的SQL语言特性(SQLite并不完全支持SQL92),不支持XML/Java扩展,不具有tera-byte或者peta-byte的可伸缩性等等。所以,当需要上面列举的这些功能时,SQLite就不在适合用户了。SQLite不是企业级的RDBMS
下面列举了一些应用场景:
 
应用文件格式
 
嵌入式设备和应用
 
中小型网站
 
内置或者临时数据库
 
命令行数据集分析工具
 
作为企业数据库的替代产品--demo阶段或者测试阶段
 
教学
如果为了学习它,以备将来使用,或者要开发类似的应用场景,可以使用SQLite作为数据库软件。
企业级的RDBMS适用于C/S应用,高吞吐量网站,非常大的数据集以及高度并发的应用。
关于SQLite区别于其他数据库的特有属性,请参考:http://www.sqlite.org/different.html



3.
下载与使用
根据不同的平台,可以在下载页面:http://www.sqlite.org/download.html下载对应的发布版本。笔者接下来将介绍SQLitewindows上的使用。多种编程语言可以通过使用wrapper或者driver来访问SQLite,下面将介绍使用java编程语言来访问SQLite并做一些常见的操作。
i.
下载SQLite
windows
版本的SQLite发布包解压缩之后只是一个二进制的sqlite3.exe文件。
可以直接运行该程序,即可进入sqlite3控制台(类似于mysql的控制台),可以通过输入.help来获取帮助信息。.quit可以推出控制台。控制台的一个简单操作如下:
//
可以直接使用sqlite3 databaseName来创建数据库
//SQLite
不支持create databasedrop database这样的语句,drop database时直接,删除数据库文件即可。

1.    E:/tools/sqlite>sqlite3.exe test

2.    SQLite version 3.6.11

3.    Enter ".help" for instructions

4.    Enter SQL statements terminated with a ";"

5.    sqlite> .help

6.    .backup ?DB? FILE Backup DB (default "main") to FILE

7.    .bail ON|OFF Stop after hitting an error. Default OFF

8.    .databases List names and files of attached databases

9.    //lots of other help information omitted here

10.  .width NUM NUM ... Set column widths for "column" mode

11.  sqlite> .databases

12.  seq name file

13.   

14.  --- --------------- ----------------------------------------------------------

15.   

16.  0 main E:/tools/sqlite/test

17.   

18.  sqlite> create table student(id varchar(10),name varchar(20),age smallint);

19.  sqlite> select * from student;

20.  sqlite> insert into student values('1001','lovesizhao',26);

21.  sqlite> select * from student;

22.  1001|lovesizhao|26

23.  sqlite> drop table student;

24.  sqlite> .quit


这种直接在命令行提示符下面使用SQLite3的方式不是本文介绍的重点。
关于SQLite3支持的SQL语法相关内容如下:
SQLite3
关键字:http://www.sqlite.org/lang_keywords.html
SQLite3
支持的SQL语法:http://www.sqlite.org/lang.html
SQLite3
不支持的SQL语法:http://www.sqlite.org/cvstrac/wiki?p=UnsupportedSql


ii.
下载Java JDBC Driver for SQLite3
在下载页面http://www.sqlite.org/cvstrac/wiki?p=SqliteWrappers,选择下载JDBC Driver for SQLite3
笔者使用的是SQLiteJDBC(http://www.xerial.org/trac/Xerial/wiki/SQLiteJDBC)
JDBC DriverLicenseApache Software Foundation 2.0 License


iii.
使用SQLite3数据库
笔者使用了NetBeans作为开发环境,写了简单的Java类,注:笔者并非要讲解SQLite3的所有功能以及细节的Features,只是作为一个介绍,如果有兴趣的话,请更多的参考SQLite3官方网站及相关资源。
NetBeans
的使用不属于本文的介绍范围。下面介绍两个简单的Java类。
笔者使用的SQLiteJDBC Driver版本为3.6.11

SQLite3Util.java

1.    package sqlite3;

2.    import java.sql.Statement;

3.    import java.sql.Connection;

4.    import java.sql.DriverManager;

5.    import java.sql.ResultSet;

6.    import java.sql.SQLException;

7.    import java.util.logging.Level;

8.    import java.util.logging.Logger;

9.     

10.   

11.  public final class SQLite3Util {

12.   

13.   private final static String URL = "jdbc:sqlite:";

14.   private final static String TEST = "test";

15.   

16.   private static Connection getConnection(String url) throws SQLException {

17.   Connection conn = null;

18.   try {

19.   Class.forName("org.sqlite.JDBC");

20.   conn = DriverManager.getConnection(url);

21.   

22.   catch (ClassNotFoundException ex) {

23.   Logger.getLogger(SQLite3Util.class.getName()).log(Level.SEVERE, null, ex);

24.   finally {

25.   return conn;

26.   }

27.   }

28.   

29.   public static Connection getSQLite3Connection() throws SQLException {

30.   return getConnection(URL + TEST);

31.   }

32.   

33.   public static Connection getSQLite3Connection(String database) throws SQLException {

34.   //Here database can be database name, database file name or memory:

35.   //Connection connection = DriverManager.getConnection("jdbc:sqlite:C:/work/mydatabase.db");

36.   //Connection connection = DriverManager.getConnection("jdbc:sqlite:/home/leo/work/mydatabase.db");

37.   //Connection connection = DriverManager.getConnection("jdbc:sqlite::memory:");

38.   return getConnection(URL + ((database == null || database.equals("")) ? TEST : database));

39.   }

40.   

41.   public static void close(Connection conn, Statement stmt, ResultSet rs) throws SQLException {

42.   if (conn != null) {

43.   conn.close();

44.   }

45.   if (stmt != null) {

46.   stmt.close();

47.   }

48.   if (rs != null) {

49.   rs.close();

50.   }

51.   }

52.   

53.   public static void closeQuiet(Connection conn, Statement stmt, ResultSet rs) {

54.   try {

55.   if (conn != null) {

56.   conn.close();

57.   }

58.   catch (SQLException e) {

59.   Logger.getLogger(SQLite3Util.class.getName()).log(Level.WARNING, null, e);

60.   }

61.   try {

62.   if (stmt != null) {

63.   stmt.close();

64.   }

65.   catch (SQLException e) {

66.   Logger.getLogger(SQLite3Util.class.getName()).log(Level.WARNING, null, e);

67.   }

68.   try {

69.   if (rs != null) {

70.   rs.close();

71.   }

72.   catch (SQLException e) {

73.   Logger.getLogger(SQLite3Util.class.getName()).log(Level.WARNING, null, e);

74.   }

75.   }

76.  }


SQLite3Test.java

1.    package sqlite3;

2.     

3.    import java.sql.Statement;

4.    import java.sql.Connection;

5.    import java.sql.DatabaseMetaData;

6.    import java.sql.ResultSet;

7.    import java.sql.SQLException;

8.    import java.util.logging.Level;

9.    import java.util.logging.Logger;

10.   

11.  public class SQLite3Test {

12.   

13.   /**

14.   * @param args the command line arguments

15.   */

16.   public static void main(String[] args) {

17.   // declare and initialize database names and java.sql objects

18.   Connection conn = null;

19.   Statement stmt = null;

20.   ResultSet rs = null;

21.   String studentDB = "D:/NetBeans/NetbeansProjects/SQLite3/student.db";

22.   String inmemoryDB = ":memory:";

23.   

24.   // the dbmd is used to check what SQLite3JDBC driver provide for JDBC

25.   DatabaseMetaData dbmd = null;

26.   

27.   try {

28.   // get connection to default database:test

29.   conn = SQLite3Util.getSQLite3Connection();

30.   if (conn == null) {

31.   return;

32.   }

33.   dbmd = conn.getMetaData();

34.   // just print information to standard console instead of output file

35.   System.out.println("DatabaseProductName:" + dbmd.getDatabaseProductName());

36.   System.out.println("SQLKeywords:" + dbmd.getSQLKeywords());

37.   System.out.println("JDBCMajorVersion:" + dbmd.getJDBCMajorVersion());

38.   System.out.println("JDBCMinorVersion:" + dbmd.getJDBCMinorVersion());

39.   

40.   // get connection to database:D:/NetBeans/NetbeansProjects/SQLite3/student.db

41.   conn = SQLite3Util.getSQLite3Connection(studentDB);

42.   stmt = conn.createStatement();

43.   stmt.executeUpdate("drop table if exists student.student");

44.   stmt.executeUpdate("create table student(id smallint primary key, name varchar(20))");

45.   stmt.executeUpdate("insert into student values(1,'zhangzhongliang')");

46.   stmt.executeUpdate("insert into student values(2,'liusizhao')");

47.   rs = stmt.executeQuery("select * from student");

48.   int i = 1;

49.   while (rs.next()) {

50.   System.out.println("row no=" + i);

51.   System.out.println("id=" + rs.getInt("id"));

52.   System.out.println("name=" + rs.getString("name"));

53.   i++;

54.   }

55.   stmt.executeUpdate("drop table student");

56.   

57.   // get connection to database in memory

58.   // this will not create a database data file in your disk

59.   conn = SQLite3Util.getSQLite3Connection(inmemoryDB);

60.   stmt = conn.createStatement();

61.   stmt.executeUpdate("drop table if exists student.student");

62.   stmt.executeUpdate("create table student(id smallint primary key, name varchar(20))");

63.   stmt.executeUpdate("insert into student values(1,'zhangzhongliang')");

64.   stmt.executeUpdate("insert into student values(2,'liusizhao')");

65.   rs = stmt.executeQuery("select * from student");

66.   i = 1;

67.   while (rs.next()) {

68.   System.out.println("row no=" + i);

69.   System.out.println("id=" + rs.getInt("id"));

70.   System.out.println("name=" + rs.getString("name"));

71.   i++;

72.   }

73.   stmt.executeUpdate("drop table student");

74.   catch (SQLException ex) {

75.   Logger.getLogger(SQLite3Test.class.getName()).log(Level.SEVERE, null, ex);

76.   finally {

77.   SQLite3Util.closeQuiet(conn, stmt, rs);

78.   }

79.   }

80.  }


4.
小结
本文主要介绍了SQLite3作为数据库软件,与其他数据库不同的特性,优缺点以及应用场景的选择。最后通过使用JDBC Driver进行了一个简单的程序测试,介绍了如何通过JDBC来访问SQLite数据库。

5.参考资料
SQLite
官方地址http://sqlite.org/
SQLite
文档http://sqlite.org/docs.html
SQLite JDBC Driver
http://www.xerial.org/trac/Xerial/wiki/SQLiteJDBC
Java JDBC
http://java.sun.com/products/jdbc/overview.html

 

Verwandte Etiketten:
Quelle:php.cn
Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!