My partner and I are working on a project in which we have to connect to a MySQL database
from a Java program.
We're are able to connect to the database when it's deployed on the localhost
but the project will be run on another computer as well, and we have to make a .jar
file.
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection("jdbc:mysql://localhost:3306/database","root","");
st = con.createStatement();
rs = st.executeQuery("select * from program");
We used the above code to access the database running on localhost.
Is there a way to make the database portable? Like is there a way that we can include it in the .jar
file? Is it gonna perform the same way it performs on the IDE? Do we need to make some special adjustments?
Any help would be amazing.