Javatpoint Logo
Javatpoint Logo

JSTL SQL <sql:setDataSource> Tag

The <sql:setDataSource> tag is used for creating a simple data source suitable only for prototyping.

It is used to create the data source variable directly from JSP and it is stored inside a scoped variable. It can be used as input for other database actions.


Consider the below information about your MySQL database setup:

  • We are using the JDBC MySQL driver
  • We are using the test database on local machine
  • We are using the "root" as username and "1234" as password to access the test database.

Let's see the simple example to understand the xml <sql:setDataSource> tag is:

The above code is used as input for other database actions. It is used for setting the connection with database server. Therefore you will start using the <sql:setDataSource> in subsequent SQL tags.

Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA