One of the Hibernate learning notes (JDBC Review-orm specification)

Source: Internet
Author: User

JDBC Review-orm specification

JDBC Operation steps
    • Registering Database Drivers
      Class.forName ("Jdbcdriverclass")
Database Driver Class Source
Access Sun.jdbc.odbc.JdbcOdbcDriver In the JDK
Mysql Com.mysql.jdbc.Driver Download MySQL Driver pack
Oracle Oracle.jdbc.driver.OracleDriver Download the corresponding driver package
SQL Server Com.microsoft.sqlserver.jdbc.SQLServerDriver Download the corresponding driver package

In order to use the driver package, you need to add the downloaded driver package to the CLASSPATH

    • Create a connection type Object
      Connection Connection = drivermanager.getconnection (Databaseurl,username,password);
      Access does not require the Username,password parameter
Database URL pattern
Access Jdbc:odbc:dataSource
Mysql Jdbc:mysql://hostname/dbname
Oracle Jdbc:oracle:thin: @hostname:p Ort#:oracledbsid (port# represents the port number, ORACLEDBSID is the database name of the location database)
SQL Server Jdbc:sqlserver://hostname:port;databasename= database name
    • Get Statement type Object
      Statement Statement = Connection.createstatement ()

    • Perform a query or update
      You can use Executeupdate () to execute SQL DDL (data definition Language) or UPDATE statements
      Query statements can be executed using executequery ()

    • Working with ResultSet type objects
      Query results exist in resultset, you can use next () to move the cursor to the next line, using getxxx (XXX for data type) to get the column values of the current row

    • Freeing resources
      Connection.close ()

Orm
    全称Object/Relation Mapping,对象/关系映射    ORM框架:完成面向对象的程序设计语言到关系数据库的映射    目前的产品很多,如:Apache组织下的OJB,Oracle的TopLink,JDO,JPA等    优点:提高生产效率,可维护性

One of the Hibernate learning notes (JDBC Review-orm specification)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.