在Netbeans中制作一个包含SQL命令的jar文件 [英] Making a jar file containing SQL commands in Netbeans
问题描述
我在Netbeans中有一个程序,该程序使用SQL连接到Access数据库.我已经准备好敲定程序,并用该程序制作一个jar文件,但是当我构建并清理"然后尝试在命令中运行该程序时,我得到了:
I have a program in Netbeans that uses SQL to connect to an Access Database. I am ready to finalize and make a jar file out of the program, but when I 'build and clean' and then try to run the program in command I get:
java.sql.SQLException:[Microsoft] [ODBC驱动程序管理器]数据源名称未找到且未指定默认驱动程序
java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
在我的代码中,我直接使用:
In my code I access the Database directly using:
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=C:\\Users\\d9t\\Desktop\\Resource_DB.accdb");
推荐答案
我偶然发现了此修补程序 http://ucanaccess.sourceforge.net/site.html
I stumbled upon this fix http://ucanaccess.sourceforge.net/site.html
安装UCanAccess-2.0.1-bin.zip并包含所有文件.我遇到了一些小错误,例如无法将'和'传递给Access,但它成功地允许64位计算机连接32位Access.
Install UCanAccess-2.0.1-bin.zip and include all the files. I encountered some minor bugs such as not being able to pass ' and " into Access, but it successfully allows 64bit computers to connect 32bit Access.
希望这可以帮助您访问程序员!
Hope this helps you Access programmers!
这篇关于在Netbeans中制作一个包含SQL命令的jar文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!