I am having a project in which I am using a database.
I pretty much finished the project except that I need to make a *.jar
file from it. I have a MySQL
database on my localhost
and whenever I start the *.jar
file on my laptop it works perfectly fine. But, the *.jar
file is going to be on another computer and that computer doesn't have the database that I made on my computer.
I am using the following to connect to the database on my computer:
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection("jdbc:mysql://localhost:3306/database","root"," ");
st = con.createStatement();
rs = st.executeQuery("select * from program");
So the question is, is there a way that I can export the mySQL database and then change some stuff in the code so that the database could be accessed? Do I need a remote server to do this? How can I make the database be portable and work on another computer?
Thank you all for your time :)