Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (6.1k points)

I am new to the JDBC and I am attempting to make a connection to my MySQL database. I am using Connector/J driver, however, I can't able to find the JDBC connection string for my Class.forName() method.

1 Answer

0 votes
by (12.7k points)

Pretending your driver is in the path,

String url = "jdbc:mysql://localhost/test";
Class.forName ("com.mysql.jdbc.Driver").newInstance ();
Connection conn = DriverManager.getConnection (url, "username", "password");

Want to become a SQL Expertise? Register now to the SQL Course and get certified.

For more details on MySQL, refer to the below MySQL Tutorial video. 

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...