English 中文(简体)
Difference between database drivers and database dialects
原标题:

What is the difference between database drivers and database 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 ;-)





相关问题
what is wrong with this mysql code

$db_user="root"; $db_host="localhost"; $db_password="root"; $db_name = "fayer"; $conn = mysqli_connect($db_host,$db_user,$db_password,$db_name) or die ("couldn t connect to server"); // perform query ...

Users asking for denormalized database

I am in the early stages of developing a database-driven system and the largest part of the system revolves around an inheritance type of relationship. There is a parent entity with about 10 columns ...

Easiest way to deal with sample data in Java web apps?

I m writing a Java web app in my free time to learn more about development. I m using the Stripes framework and eventually intend to use hibernate and MySQL For the moment, whilst creating the pages ...

join across databases with nhibernate

I am trying to join two tables that reside in two different databases. Every time, I try to join I get the following error: An association from the table xxx refers to an unmapped class. If the ...

How can I know if such value exists in database? (ADO.NET)

For example, I have a table, and there is a column named Tags . I want to know if value programming exists in this column. How can I do this in ADO.NET? I did this: OleDbCommand cmd = new ...

Convert date to string upon saving a doctrine record

I m trying to migrate one of my PHP projects to Doctrine. I ve never used it before so there are a few things I don t understand. In my current code, I have a class similar to this: class ...

热门标签