开发者

Difference between database drivers and database dialects

开发者 https://www.devze.com 2022-12-17 04:48 出处:网络
What is the difference between database drivers and databa开发者_StackOverflow中文版se dialects?This question is not ambiguous , i think it should be answered correctly.

What is the difference between database drivers and databa开发者_StackOverflow中文版se dialects?


This question is not ambiguous , i think it should be answered correctly.

We often use Dialect and Drivers to connect a certain application with a certain database management system.

For example : in grails / java

We define a Dialect property to connect to mysql as having one of this types

MySQL5Dialect, MySQLInnoDBDialect, MySQLMyISAMDialect

Dialect is an English word that means variant of a language. For example, there are multiple dialects of English. For example, British English and American English.

In the context of databases, people talk about dialects of SQL. SQL is the main language just as English is. Then there are dialects with database specific syntax. For example, Oracle has the rownum keyword.Refe

And , The dialect of the database is simply a term that defines the specific features of the SQL language that are available when accessing that database.

Example of usage in application side

dataSource {
    pooled = true
    jmxExport = true
    driverClassName = "com.mysql.jdbc.Driver"
    dialect = "org.hibernate.dialect.MySQL5InnoDBDialect"
    username = "root"
    password = "root"
}

N.B . Dialect is a mandatory to connect to a database.

Another Hand , DataBase Driver is A program installed on a workstation or server to allow programs on that system to interact with a DBMS.[Refer]

In java we have something called JDBC/ODBC driver specification to connect to a relational Database.

Driver is something like a file or class file written to handle communication between the actual database and to the consuming application (Mysql and java application).

MySQL offers standard database driver connectivity for using MySQL with applications and tools that are compatible with industry standards ODBC and JDBC.After you have the driver file you place it on lib folder and then you need to call or associate it like this.i.e you need to specify URL ,DATABASENAME ,PORT ,PASSWORD .. to connect to the database.

dataSource {

     //url = "jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT
              =10000;DB_CLOSE_ON_EXIT=FALSE"
      databasename = "libdoc"
      url = "jdbc:mysql://localhost:3306/"+databasename
   }

Alloha , Happy Learning Day!


A database driver is a program for which implements a protocol (ODBC, JDBC) for connecting to a database. It is an Adaptor which connects a generic interface to a specific vendors implementation, just like printer drivers etc.

A database dialect is a configuration setting for platform independent software (JPA, Hibernate, etc) which allows such software to translate its generic SQL statements into vendor specific DDL, DML.

It appears that "database dialect" may be used by other types of database programs to mean something slightly different but broadly similar to what I have just written. That is, "database driver" is an acknowledged industry term with one single concrete meaning whereas "database dialect" is not similarly recognised and so refers to different concepts in different contexts.


Original question:

what is the difference between database drivers and database dialects?

The question is ambiguous; here is my take.

A driver is a piece of software for accessing a database.

A dialect is a variant on a query language (i.e. a protocol) used for accessing a database. Depending on the database software, it may support multiple different dialects.

I.e. not all sql are created equal ;-)

0

精彩评论

暂无评论...
验证码 换一张
取 消