[英]Connecting to MySQL database using Java in command prompt
Since I don't have netbeans right now, I am trying to connect to MySQL database from my Java code through command prompt. 由于我现在没有netbeans,因此我试图通过命令提示符从Java代码连接到MySQL数据库。 But it it is not taking the mysql-coonectivity.jar file.
但是它没有采用mysql-coonectivity.jar文件。
Does anyone know any way to run my program??? 有谁知道任何方式来运行我的程序??? Please help.
请帮忙。
You need to add your MySQL connector jar file while compiling and running your program, you can do it the following way, 您需要在编译和运行程序时添加MySQL连接器jar文件,可以通过以下方式进行操作,
To compile : 编译 :
javac -g -cp mysql-coonectivity.jar; YourFileName.java
To Run 跑步
java -cp mysql-coonectivity.jar; YourMainClass
NOTE: The above written syntax assumes that your jar file is present at same location as of your program. 注意:以上书面语法假定您的jar文件与程序位于相同的位置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.