【问题标题】:How to change database from MySQL to Oracle in TheSchwartz如何在 TheSchwartz 中将数据库从 MySQL 更改为 Oracle
【发布时间】:2018-08-05 14:38:11
【问题描述】:

我想在 perl 的 TheSchwartz 模块(作业队列系统)中将数据库从 MySQL 切换到 Oracle。我怀疑以下代码是关键。

my $client = TheSchwartz->new(
    databases => [{
    dsn  => 'dbi:mysql:TheSchwartz',
    user => 'dbi',
    pass => 'xxxxxxx',
    }],
    verbose => 1,
);  

我更改了代码。

dsn  => 'dbi:mysql:TheSchwartz',  

dsn  => 'dbi:Oracle:OraDB01',    

然后我收到了消息。

#Disabling DB 9e410d44ac4b9ede28c9ef34f6c1e817 because unknown

TheSchwartz 没有告诉我有关 Oracle 错误的任何线索(例如密码错误或网络错误 ....)。

我的问题是
1. perl的TheSchwartz可以使用Oracle吗?
2. 调试时,如何在 TheSchwartz 中获取 ORA- 错误信息?

欢迎任何帮助。
问候,

【问题讨论】:

标签: perl perl-module


【解决方案1】:

在这里使用 TheSchwartz 几乎可以肯定是一个完全的红鲱鱼。 TheSchwartz 只是在创建一个 DBI 连接。因此,一旦您可以在 TheSchwartz 外部成功创建 DBI 连接,您应该能够在 TheSchwartz 内部进行相同的操作。

我会分两个阶段处理它:

  • 编写一个简单的 DBI 程序来连接到 Oracle 数据库。
  • 将您成功连接的详细信息复制到您的 TheSchwartz 代码。

我要写的简单DBI程序,只要这么简单:

#!/usr/bin/perl

use strict;
use warnings;

use DBI;

my $dbh = DBI->connect('dbi:Oracle:OraDB01', 'dbi', 'xxx')
  or die $DBI::errstr;

这可能会以与您现有代码相同的方式失败,但您会收到原始 DBI 连接错误,这应该可以让您找出问题所在。

显然,您可能会发现DBD::Oracle documentation 也很有用。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-05-03
    • 2013-02-10
    • 1970-01-01
    • 1970-01-01
    • 2021-10-01
    • 2011-07-18
    • 2011-09-30
    • 2019-07-17
    相关资源
    最近更新 更多