无法加载驱动程序:com.mysql.jdbc.Driver [英] Unable to load driver: com.mysql.jdbc.Driver
问题描述
我尝试使用Jasper在Laravel生成报告。它的工作完美如果我没有使用数据库,如果我添加数据库从mysql数据库获取数据,他给我一个错误无法加载驱动程序:com.mysql.jdbc.Driver。我安装JDBC连接器和安装ODBC连接到本地mysql服务器:
我也建立了CLASSPATH到MySQL连接器:
因为laravel打印我有一些错误生成pdf与数据库连接我改变它打印输出命令并运行它在终端,他给我一个错误,无法加载驱动程序:com.mysql.jdbc.Driver,见下图:
如果您有任何想法,我将不胜感激。
的Java应用程序不使用 CLASSPATH
环境变量,看起来像jasperstarter是其中之一。
查看在 http://jasperstarter.cenote.de/usage.html 您需要使用命令行 - jdbc-dir<包含驱动程序jar的目录>
:
- jdbc-dir< dir>
jdbc驱动程序jar所在的目录。默认为./jdbc
或者,如注释中所述,您可以将驱动程序放在 JasperStarter / jdbc
文件夹,因为这是默认位置。
I try to use Jasper to generate report in Laravel. It's work perfect if I didn't use database, if I add database to get data from mysql database he gives me an error "Unable to load driver: com.mysql.jdbc.Driver". I install JDBC Connector and Setup ODBC connection to local mysql server:
Also I setup CLASSPATH to MySQL connector:
Because laravel print me that have some error to generate pdf with database connection I change it to print output command and ran it in terminal and he gives me an error that "Unable to load driver: com.mysql.jdbc.Driver", see next picture:
If you have ANY idea I will be grateful!
A lot of Java applications do not use the CLASSPATH
environment variable, and it looks like jasperstarter is one of them.
Looking at http://jasperstarter.cenote.de/usage.html you need to use the command line option --jdbc-dir <directory with driver jar(s)>
:
--jdbc-dir <dir>
directory where jdbc driver jars are located. Defaults to ./jdbc
Alternatively, as you indicated in the comments, you can put the driver in the JasperStarter/jdbc
folder, as that is the default location.
这篇关于无法加载驱动程序:com.mysql.jdbc.Driver的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!