tailieunhanh - Bài giảng Lập trình Java: Buổi 8 - Industrial university of Ho Chi Minh City
Bài giảng "Lập trình Java - JDBC" trình bày các kiến thức: What is JDBC, features, architecture, development process, JDBC data access statements, Java JDBC Transactions. nội dung chi tiết. | JDBC JDBC Overview What is JDBC? Features Architecture Development process JDBC data access statements Java JDBC Transactions What is JDBC? JDBC Allows a Java application to connect to a relational database. The major databases are supported such as Oracle, Microsoft SQL Server, DB2 and many others. The database can be located on the same local machine as in the application. It can also be located in a network in a remote location. 3 Features The main feature of JDBC is that it is a standard API. You develop your application code to the JDBC API and you can connected to various databases. JDBC supported a large number of databases Oracle, Microsoft SQL server, MySQL, SyBase, DB2, PostgreSQL You can build your own custom SQL statement: select, insert, update and delete. Complex SQL queries: inner and outer joins. Call stored procedures. JDBC architecture JDBC architecture JDBC driver Provides a connection to a database. Converts JDBC calls to for specific database. JDBC driver implementations Provided by database vendor. JDBC Driver manager Driver manager helps connect an application based on a database connection string. In JDBC is version , the JDBC drivers are automatically loaded based on the classpath. Legacy JDBC drivers have to be explicitly loaded with Java code is (theDriverName) JDBC API The JDBC API is defined in two packages. and . Key classes Development Process Get a Connection to database. Create a Statement object. Execute SQL query. Process Results set. Close connection Step 1: Get a Connection to database In order to connect to database Need to connection string in form of JDBC URL. Basic syntax jdbc:: Examples Database JBDC URL MS SQL Server jdbc:sqlserver://:;DatabaseName=DB Oracle jdbc:oracle:thin:@:: MySQL . | JDBC JDBC Overview What is JDBC? Features Architecture Development process JDBC data access statements Java JDBC Transactions What is JDBC? JDBC Allows a Java application to connect to a relational database. The major databases are supported such as Oracle, Microsoft SQL Server, DB2 and many others. The database can be located on the same local machine as in the application. It can also be located in a network in a remote location. 3 Features The main feature of JDBC is that it is a standard API. You develop your application code to the JDBC API and you can connected to various databases. JDBC supported a large number of databases Oracle, Microsoft SQL server, MySQL, SyBase, DB2, PostgreSQL You can build your own custom SQL statement: select, insert, update and delete. Complex SQL queries: inner and outer joins. Call stored procedures. JDBC architecture JDBC architecture JDBC driver Provides a connection to a database. Converts JDBC calls to for specific database. JDBC driver .
đang nạp các trang xem trước