mysqlruby
require "d:/ruby-mysql/ruby-mysql-0.2.6/mysql"
begin
#尝试连接mysql数据库
my = mysql.connect("localhost","root","123456","test")
#连接成功,显示mysql数据库版本
puts my.get_server_info
rescue mysql::error => err
#如果失败,显示错误信息
puts "错误代码:#{err.errno}"
puts "错误信息:#{err.error}"
ensure
my.close if my
end
运行以上代码,报这样的错误:
D:/ruby-mysql/ruby-mysql-0.2.6/mysql.rb:1019:in read': Packets out of order: 0 (RuntimeError)<br> from D:/ruby-mysql/ruby-mysql-0.2.6/mysql.rb:444:inread'
from D:/ruby-mysql/ruby-mysql-0.2.6/mysql.rb:110:in real_connect'<br> from D:/ruby-mysql/ruby-mysql-0.2.6/mysql.rb:91:ininitialize'
from D:/ruby-mysql/ruby-mysql-0.2.6/mysql.rb:1085:in new'<br> from D:/ruby-mysql/ruby-mysql-0.2.6/mysql.rb:1085:inreal_connect'
from D:/软件/eclipse-standard-kepler-SR2-win32/hello/testDb.rb:3:in `'
项目要用到ruby,新人,求大神帮忙,搞了一天了,没连上
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号