Reputation: 761
my MYSQL DB can find in wamp\bin\mysql\mysql5.6.12\data
path called cament_factory_db
I copy that cament_factory_db
folder to my netbeans project folder and changed the connection string jdbc:mysql://localhost:3306/cement_factory_db
to jdbc:mysql://cement_factory_db
re-compiled it. then compiler says
Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. Communications link failure
I want to create portable jar file with MYSQL data base? How does it do ?
Upvotes: 1
Views: 1736
Reputation: 5369
MySQL is not a file based database management system. It always requires a MySQL server to which the application would connect to. If you want to distribute an application which uses a database, you have two options.
Use a flat file based database. Then you could add the flat file to your application's distribution. Examples of such database management systems are (SQL Server Compact, SQLite, HSQLDB,H2 and Derby).
Use a database server architecture. This means that your distributed applications would not transfer the database with them, but they would connect to your database hosted somewhere over the internet. As a server database, you could use MySQL which follows this architecture.
If I get it right, the first approach would be more suitable for you.
Hope I helped!
Upvotes: 4