Kettle连接MySQL报错的解决方法

使用Kettle报错的解决方法

1.当你在navicat上面测试数据库连接的时候可以看到数据库连接成功。而在Kettle上面连接同样的库的时候报出一大段错误出来,这时候是不是感觉有点懵逼了。

错误内容如下:

错误连接数据库 [test库] : com.tyky.di.core.exception.XbridgeDatabaseException:
Error occured while trying to connect to the database

Error connecting to database: (using class org.gjt.mm.mysql.Driver)
Connection setting too low for ‘maxAllowedPacket‘. When ‘useServerPrepStmts=true‘, ‘maxAllowedPacket‘ must be higher than 8203. Check also ‘max_allowed_packet‘ in MySQL configuration files.

com.tyky.di.core.exception.XbridgeDatabaseException:
Error occured while trying to connect to the database

Error connecting to database: (using class org.gjt.mm.mysql.Driver)
Connection setting too low for ‘maxAllowedPacket‘. When ‘useServerPrepStmts=true‘, ‘maxAllowedPacket‘ must be higher than 8203. Check also ‘max_allowed_packet‘ in MySQL configuration files.

at com.tyky.di.core.database.Database.normalConnect(Database.java:374)
    at com.tyky.di.core.database.Database.connect(Database.java:323)
    at com.tyky.di.core.database.Database.connect(Database.java:285)
    at com.tyky.di.core.database.Database.connect(Database.java:275)
    at com.tyky.di.core.database.DatabaseFactory.getConnectionTestReport(DatabaseFactory.java:76)
    at com.tyky.di.core.database.DatabaseMeta.testConnection(DatabaseMeta.java:2455)
    at com.tyky.ui.database.event.DataHandler.testDatabaseConnection(DataHandler.java:511)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.pentaho.ui.xul.impl.AbstractXulDomContainer.invoke(AbstractXulDomContainer.java:329)
    at org.pentaho.ui.xul.impl.AbstractXulComponent.invoke(AbstractXulComponent.java:139)
    at org.pentaho.ui.xul.impl.AbstractXulComponent.invoke(AbstractXulComponent.java:123)
    at org.pentaho.ui.xul.swt.tags.SwtButton.access$500(SwtButton.java:26)
    at org.pentaho.ui.xul.swt.tags.SwtButton$4.widgetSelected(SwtButton.java:119)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source)
    at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
    at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown Source)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
    at org.eclipse.jface.window.Window.runEventLoop(Window.java:820)
    at org.eclipse.jface.window.Window.open(Window.java:796)
    at org.pentaho.ui.xul.swt.tags.SwtDialog.show(SwtDialog.java:378)
    at org.pentaho.ui.xul.swt.tags.SwtDialog.show(SwtDialog.java:304)
    at com.tyky.di.ui.core.database.dialog.XulDatabaseDialog.open(XulDatabaseDialog.java:104)
    at com.tyky.di.ui.core.database.dialog.DatabaseDialog.open(DatabaseDialog.java:51)
    at com.tyky.di.ui.spoon.delegates.SpoonDBDelegate.editConnection(SpoonDBDelegate.java:78)
    at com.tyky.di.ui.spoon.Spoon.doubleClickedInTree(Spoon.java:3010)
    at com.tyky.di.ui.spoon.Spoon.access$19(Spoon.java:2974)
    at com.tyky.di.ui.spoon.Spoon$23.widgetDefaultSelected(Spoon.java:5960)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source)
    at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
    at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown Source)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
    at com.tyky.di.ui.spoon.Spoon.readAndDispatch(Spoon.java:1259)
    at com.tyky.di.ui.spoon.Spoon.start(Spoon.java:7896)
    at com.tyky.di.ui.spoon.Spoon.main(Spoon.java:582)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.pentaho.commons.launcher.Launcher.main(Launcher.java:134)
Caused by: com.tyky.di.core.exception.XbridgeDatabaseException:
Error connecting to database: (using class org.gjt.mm.mysql.Driver)
Connection setting too low for ‘maxAllowedPacket‘. When ‘useServerPrepStmts=true‘, ‘maxAllowedPacket‘ must be higher than 8203. Check also ‘max_allowed_packet‘ in MySQL configuration files.

at com.tyky.di.core.database.Database.connectUsingClass(Database.java:510)
    at com.tyky.di.core.database.Database.normalConnect(Database.java:358)
    ... 43 more
Caused by: java.sql.SQLException: Connection setting too low for ‘maxAllowedPacket‘. When ‘useServerPrepStmts=true‘, ‘maxAllowedPacket‘ must be higher than 8203. Check also ‘max_allowed_packet‘ in MySQL configuration files.
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:996)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:935)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:924)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:870)
    at com.mysql.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:3305)
    at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2278)
    at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2064)
    at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:790)
    at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:44)
    at sun.reflect.GeneratedConstructorAccessor32.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:377)
    at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:395)
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:325)
    at java.sql.DriverManager.getConnection(DriverManager.java:571)
    at java.sql.DriverManager.getConnection(DriverManager.java:215)
    at com.tyky.di.core.database.Database.connectUsingClass(Database.java:490)
    ... 44 more

主机名       : 172.16.200.12
端口           : 3306
数据库名:test

2.解决办法:该错误由所连数据库中的max_allowed_packet字段引起,查询所连接数据库的该字段将字段大小设置更大问题解决。修改max_allowed_packet字段大小有两种方法,具体如下:

方法1:用语句设置,但是这种情况可能会出现mysql重启后所设置的值失效。

show VARIABLES like ‘%max_allowed_packet%‘;
set global max_allowed_packet = 1024*1024

2.1方法2:在数据库下my.ini文件中添加如下语句。将max_allowed_packet改为1G.如下图所示。修改完成后,需要重启mysql。

---------------------
作者:装会逼
来源:CSDN
原文:https://blog.csdn.net/spcsdn_18785143187/article/details/81133016
版权声明:本文为博主原创文章,转载请附上博文链接!

原文地址:https://www.cnblogs.com/LXL616/p/10822833.html

时间: 2024-11-08 11:08:36

Kettle连接MySQL报错的解决方法的相关文章

腾讯云二进制包安装mysql报错及其解决方法

报错及其解决方法:-bash:mysql: command not found [[email protected] mysql]# ./scripts/mysql_install_db   --user=mysql --datadir=/mydata/data Installing MySQL system tables... ./bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared 

连接mysql报错java.sql.SQLException: The server time zone value &#39;?й???????&#39; is unrecognized...解决方法

报错内容: java.sql.SQLException: The server time zone value '?й???????' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time

1130 - Host&#39;xxx.xxx.xxx.xxx&#39; is not allowed to connect to this MySQL server解决Navicat连接MySQL报错

最近使用Navicat for MySQl访问远程mysql数据库,出现报错,显示"1130 - Host'xxx.xxx.xxx.xxx' is not allowed to connect to this MySQL server".解决办法如下: 方法/步骤 首先看报错窗口. 经查阅,错误原因是:本地IP(xxx.xxx.xxx.xxx)没有访问远程数据库的权限. 于是下面开启本地IP(xxx.xxx.xxx.xxx)对远程mysql数据库的访问权限. 首先远程连接进入服务器,在

连接mysql报错Access denied for user &#39;root&#39;@&#39;localhost&#39; (using password: YES)解决办法

1.打开MySQL目录下的my.ini文件,在文件的最后添加一行"skip-grant-tables"(免密码登录),保存并关闭文件,重启MySQL服务. 2.通过命令行进入MySQL的BIN目录,输入"mysql -u root -p"(不输入密码),回车即可进入数据库. 3.执行"use mysql;",使用mysql数据库. 4.修改密码:执行" update MySQL.user set authentication_strin

MySQL 5.7 Invalid default value for &#39;CREATE_TIME&#39;报错的解决方法

出处:http://blog.itpub.net/15498/viewspace-2136006/ 由于数据库的升级,今天在执行从MySQL 5.6导出来的SQL文件时报错: mysql> source cms_user.sqlQuery OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected, 1 warning (0.04 sec) ERROR 1067 (42000): Invalid default value for 'CREA

【第一个项目】MySQL第二天早上第一次连接超时报错,解决方法com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:

MySQL第二天早上第一次连接超时报错,解决方法com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure Last packet sent to the server was 0 ms ago 最近碰到一个mysql5

MySQL中遇到的几种报错及其解决方法

MySQL中遇到的几种报错及其解决方法 1.[Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''xxx'' at line 1 解决方法:将所有的" '' "换成" ·· "(将所有的英文单引号换为Tab键上面的那个点号)

连接mysql报错:error 2003 (hy000):can&#39;t connect to mysql server on &#39;localhost&#39; (10061)

一.mysql 的bin目录下有个MySQLInstanceConfig.exe,运行就可以进行创建数据库实例,创建实例时也可以生成windows 服务,把服务设置成自动启动就可以了 二.安装在D盘的discuzz!打开后出现上述错误,请问应如何处理?winmysqladmin已经启动,但三色树上有一个小红点如果出现"ERROR 2003: Can't connect to MySQL server on 'localhost' (10061)",说明你的MySQL还没有启动.解决办法

PHP连接MySQL报错:SQLSTATE[HY000] [2002] Can&#39;t connect to local MySQL server through socket &#39;MySQL&#39; (2)

如下所示,PHP连接MySQL报错: SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket 'MySQL' (2) 测试代码如下: <?php try { $dsn = 'mysql:dbname=php-note;host=localhost;port=3306;charset=utf8'; $username = 'root'; $password = 'root'; new PDO( $dsn,