如何在TheSchwartz中将数据库从MySQL更改为Oracle

问题描述 投票:0回答:1

我想在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错误的线索(ex密码错误或网络错误......)。

我的问题是 1.是否可以在perl的TheSchwartz中使用Oracle? 2.对于dubugging,如何在TheSchwartz中获取ORA-Error消息?

任何帮助都会受到欢迎。 问候,

perl perl-module
1个回答
0
投票

使用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也很有用。

© www.soinside.com 2019 - 2024. All rights reserved.