Spring Certified Professional 2023 · Free Practice Question Medium

Question 35

Which of the following statements are true about the DataSource interface? (select 2)

  • A

    The DataSource interface is intended for use with relational databases and is not suitable for NoSQL databases.

  • B

    All of the above

  • C

    DataSource is a Spring framework interface.

  • D

    The DataSource interface is implemented by a driver vendor.

Reveal correct answers

Correct answers: A, D

Explanation

DataSource is a javax.sql framework interface.

See:  https://docs.oracle.com/javase/7/docs/api/javax/sql/DataSource.html



The javax.sql.DataSource interface is designed for use with relational databases and is part of the Java Database Connectivity (JDBC) API. It provides a standard way to establish and manage connections to relational databases and perform SQL operations. Therefore, it is not directly compatible with NoSQL databases.

NoSQL databases have their own APIs and data access mechanisms that are specifically designed for their data models and query languages. Common NoSQL databases like MongoDB, Cassandra, Redis, and Elasticsearch have their own Java libraries and APIs that should be used to interact with them.

If you want to work with a NoSQL database in Java, you should use the appropriate library or driver provided by the NoSQL database vendor or the community. These libraries are designed to work with the unique data models and features of the respective NoSQL database. While you can use Java to work with NoSQL databases, it would involve a different set of classes and APIs than those used for traditional relational databases like those supported by javax.sql.DataSource.


The DataSource interface is implemented by a driver vendor.

See:  https://docs.oracle.com/javase/7/docs/api/javax/sql/DataSource.html

Discussion

Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.

You must be logged in to post a comment.

Preparing For

Your Certification?

255+ certifications
Detailed explanations
Free PDF samples

Has All The Questions You Need