問題描述
我的 Jar 應用程序(myapplication.jar + Mysql 連接器)在其他計算機上不起作用 (My Jar application(myapplication.jar + Mysql connector) doesnt work on other computer)
Guy i developt a simple GUI application to access mySQL database program, i created a jar file, everthings works great on my computer , my application could access database greatly, but the problem is when i run this myapplication.jar on others computers, my GUI (application) showed up but can't access the database.
my questions are:
- did i have to copy "C:\Program Files\MySQL\MySQL Server 6.0\data\MyDatabase\" files inside my applications folder ?
i've create a manifest file to link myapplication.jar to mysql‑connector‑java‑5.1.17.jar , plus i put mysql‑connector‑java‑5.1.17.jar in same folder, but it seem my application can't access the database on others computers .
參考解法
方法 1:
The first thing you need to know is how MySQL works. It is a client and a server, which is probably local in this case.
When you bring the application to the other computer, you'll want to install a MySQL server on that machine as well and set it up with the same tables and data(via MySQL backup and restore).
I would become more acquainted with intermediate Java programming and other databases such as DB4) before creating business‑critical applications.
方法 2:
You need to connect to sql through that computer. You can either copy your sql on that or you can point it the sql on you computer using the ip path.
(by user2713275、nanofarad、Crickcoder)