0
How to connect mysql with java netbeans?
I've searched alot but still unable to connect the database? Please help!
3 Réponses
+ 1
Iterator you can connect Java to database by making an db file in which the connection code is written like this way
import java.sql.Connection;
import java.sql.DriverManager;
public class DB {
public static Connection getConnection(){
Connection con=null;
try{
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection("jdbc:mysql://localhost:8080/demo","","");
}catch(Exception e){System.out.println(e);}
return con;
}
}
+ 1
Iterator the code which I have posted is of connection file to any database you have to first write this code and include this file in all your other project file and use the database for any CRUD operation
0
first they ask to add connection file of sql server (which I'm unable to find) Mohit the coder (M.S.D)