无法通过rails连接到oracle(cannot connect to oracle through rails)
尝试通过Ruby On Rails连接到oracle时遇到问题
( ruby -r oci8 -e "OCI8.new('hr', 'password').exec('SELECT * FROM jobs ORDER BY 1') {|r| puts r.join}" )
如下:C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_re quire.rb:46:in `require': incompatible library version - C:/RailsInstaller/Ruby1 .9.3/lib/ruby/site_ruby/1.9.1/i386-msvcrt/oci8lib.so (LoadError) from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/core_ ext/kernel_require.rb:46:in `require' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/oci8.rb:20:in `<top (required)>' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/core_ ext/kernel_require.rb:46:in `require' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/core_ ext/kernel_require.rb:46:in `require'
这是我正在使用的:
1. ruby1.9.3p125 (2012-02-16) [i386-mingw32] 2. Rails 3.2.1 3. gem 2.0.3 4. Windows 7 5. Oracle 10g Express Edition
有谁知道如何解决上述问题?
提前致谢。
I got problem when trying to connect to oracle through Ruby On Rails
( ruby -r oci8 -e "OCI8.new('hr', 'password').exec('SELECT * FROM jobs ORDER BY 1') {|r| puts r.join}" )
as following:C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_re quire.rb:46:in `require': incompatible library version - C:/RailsInstaller/Ruby1 .9.3/lib/ruby/site_ruby/1.9.1/i386-msvcrt/oci8lib.so (LoadError) from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/core_ ext/kernel_require.rb:46:in `require' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/oci8.rb:20:in `<top (required)>' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/core_ ext/kernel_require.rb:46:in `require' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/core_ ext/kernel_require.rb:46:in `require'
Here is what I am using:
1. ruby1.9.3p125 (2012-02-16) [i386-mingw32] 2. Rails 3.2.1 3. gem 2.0.3 4. Windows 7 5. Oracle 10g Express Edition
Anyone know how to solve the above problem?
Thanks in advance.
原文:https://stackoverflow.com/questions/15518366
更新时间:2022-04-09 14:04
最满意答案
public List<Appo> getAllData() { List<Appo> appos = new ArrayList<Appo>(); // Select All Query String selectQuery = "SELECT * FROM " + APPOINTMENT_TABLE_NAME; SQLiteDatabase db = this.getWritableDatabase(); Cursor cursor = db.rawQuery(selectQuery, null); // looping through all rows and adding to list if (cursor.moveToFirst()) { do { Appo appo = new Appo(); appo.setTital(cursor.getString(0)); appo.setTime(cursor.getString(1)); appo.setDetails(cursor.getString(2)); appo.setday(cursor.getString(3)); //Adding contact to list appos.add(appo); } while (cursor.moveToNext()); } // return all list return appos; }
有关更多信息,请查看Android SQLite数据库
public List<Appo> getAllData() { List<Appo> appos = new ArrayList<Appo>(); // Select All Query String selectQuery = "SELECT * FROM " + APPOINTMENT_TABLE_NAME; SQLiteDatabase db = this.getWritableDatabase(); Cursor cursor = db.rawQuery(selectQuery, null); // looping through all rows and adding to list if (cursor.moveToFirst()) { do { Appo appo = new Appo(); appo.setTital(cursor.getString(0)); appo.setTime(cursor.getString(1)); appo.setDetails(cursor.getString(2)); appo.setday(cursor.getString(3)); //Adding contact to list appos.add(appo); } while (cursor.moveToNext()); } // return all list return appos; }
For more information check Android SQLite Database
相关问答
更多-
ios - 打开sqlite数据库(ios - open sqlite database)[2024-01-11]
这是我如何打开我的数据库。 我很长一段时间没有做SQLite,除了提供我在自己的应用程序中使用的代码之外,我无法给你很多帮助。 这是我在我的应用程序中使用的一个类。 static sqlite3 *database; static sqlite3_stmt *enableForeignKey; @implementation DBAdapter + (sqlite3 *)sharedInstance { if (database == NULL) { sqlite3 *newD ... -
使用此代码并检查数据库是否已连接并正确打开,然后再从中获取数据。 希望这会有所帮助。 -(void)readDatabase { // Set path NSArray *dirPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);//(customize the path based on ur database location) ...
-
在主活动中添加此代码并重新启动您的活动。 确保已调用此代码并设置正确的SD卡路径。 在Windows上安装sqlite manager工具并查看您的数据。 try { String inFileName = "//data/data/com.needzapp.debug/databases/your_db_name"; File dbFile = new File(inFileName); FileInputStream fis ...
-
作为pysqlite的作者,我很确定没有人将pysqlite 1.x移植到Python 3。 理所当然的唯一解决方案是theomega建议的那个。 如果你需要的只是从Python访问数据以便将它们导入其他地方,但是不能进行sqlite2 dump / sqlite3恢复舞蹈,有一个选项,但是不方便:使用builtin ctypes模块从中访问必要的函数SQLite 2 DLL。 然后,您将自己实现一个最小版本的pysqlite,它只包含您真正需要的内容。 As the pysqlite author I a ...
-
使用c无法将数组分配给另一个数组,您必须将源数组内容复制到目标数组,例如使用strcpy unsigned char *value = sqlite3_column_text(SQL,2); if ((value != NULL) && (strlen(value) < sizeof(Register[i].InstrumentType))) { strcpy(Register[i].InstrumentType, value); } 在您的特定情况下,您还可以使用指针来重构您的结构 ...
-
首先,对于一个Task,你只需要产生返回promise的东西,因此异步运行。 没有必要yield iDs.push(row[i].getResultByIndex(0)); ,因为push操作将同步返回数组的新长度。 尽管如此,这对代码本身来说应该不是什么大问题。 你真的需要ids是全球性的吗? 也许您可以重构代码,这样您就不需要在全局范围内保存它们。 如果这不是一个选项,则必须阻止所有将访问id的操作,直到SQL调用完成。 你可以依靠Task.spawn()本身也会返回一个promise的事实来做到这一点 ...
-
如果您真的对学习如何使用SQLite管理iPhone应用程序中的数据感兴趣,我建议您完成以下教程,因为它是一个非常好的介绍: 使用iPhone编程教程创造-A-待办事项列表- - sqlite的部分-1 本教程使用SQLite处理iPhone应用程序中的选择,更新,插入和删除数据。 If you're really interested in learning how to use SQLite to manage data in an iPhone app, I would recommend you t ...
-
我回答自己:不,似乎不可能。 read_uncommitted隔离模式需要启用共享缓存,目前只能用于生活在同一进程中的不同线程。 这似乎是研究这个的最佳场所: http : //www.sqlite.org/sharedcache.html 。 I answer to myself: no, it seems it is not possible. The read_uncommitted isolation mode requires to enable the shared cache, which i ...
-
实际问题与游标无关,游标读取下一行,但在第一次写入数据后关闭文档。 尝试关闭for循环外的文档对象。 把这条线放在for loop的外面 doc.close(); Actual Problem is not related to a cursor, cursor read the next line but you close the document after first data write. try to close the document object outside of for loop ...
-
public List
getAllData() { List appos = new ArrayList (); // Select All Query String selectQuery = "SELECT * FROM " + APPOINTMENT_TABLE_NAME; SQLiteDatabase db = this.getWritableDatabase(); Cursor cursor = db.rawQuery ...