What is a driver class? (Java)

后端 未结 4 1972
走了就别回头了
走了就别回头了 2020-12-06 04:34

I was reading through a Java textbook, and it mentions something called a \"driver class\". What is it, and how is it different from a normal class?

4条回答
  •  攒了一身酷
    2020-12-06 05:05

    Without context, it's hard to tell. Is it talking about a JDBC driver, perhaps? If so, the driver class is responsible for implementing the java.sql.Driver interface for a particular database, so that clients can write code in a db-agnostic way. The JDBC infrastructure works out which driver to use based on the connection string.

    If the book wasn't talking about JDBC though, we'll need more context.

提交回复
热议问题