简体   繁体   English

如何使netbeans项目一个嵌入数据库的jar文件?

[英]How to make a netbeans project a jar file embedded with database?

I want to make my Netbeans project executable with a database without opening any wamp or xampp. 我想使我的Netbeans项目与数据库可执行,而无需打开任何wamp或xampp。 I am new at java and I don't know how to do this. 我是java的新手,我不知道该怎么做。 Thanks in advance. 提前致谢。

There are several embedded databases which you can start from your Java application, like H2, HSQLDB, Derby. 您可以从Java应用程序启动几个嵌入式数据库,例如H2,HSQLDB,Derby。 Try one of them, and if you have a specific problem, ask another question here. 尝试其中的一种,如果您有特定问题,请在此处提出另一个问题。

if you want to use Database as a standalone java application. 如果要使用数据库作为独立的Java应用程序。 Then you can go for embedded database. 然后,您可以使用嵌入式数据库。 Netbeans comes with default Java DB (derby). Netbeans带有默认的Java DB(derby)。 1. Open services tab in Netbeans window -> services 2. Under Databases - Right click -> New connection -> Java DB (Embedded) -> next -> in the JDBC URl give jdbc:derby:myjavadb;create=true -> Click next and finish 1.在Netbeans窗口中打开服务选项卡->服务2.在数据库-右键单击->新建连接-> Java DB(嵌入)->下一步->在JDBC URl中,给jdbc:derby:myjavadb; create = true->单击下一步完成

  1. Now you have successfully created Embedded database. 现在,您已经成功创建了嵌入式数据库。

Check this link for the code http://www.codejava.net/java-se/jdbc/connect-to-apache-derby-java-db-via-jdbc 检查此链接以获取代码http://www.codejava.net/java-se/jdbc/connect-to-apache-derby-java-db-via-jdbc

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM