Difference between database drivers and database dialects

user244634 picture user244634 · Jan 18, 2010 · Viewed 16.1k times · Source

What is the difference between database drivers and database dialects?

Answer

Daniel Adenew picture Daniel Adenew · Apr 16, 2014

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!