hi,
i just wanted to know why do we need drivers in java to connect to a database when we do not have any such driver for PHP?

String str = "com.mysql.jdbc.Driver"

any help will be greatly appreciated

because php is stupid and knows only about 1 database engine.
You can use any database engine with Java, so need to tell it which you're using and how to use it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.