我已经安装了WAMP服务器。
尝试连接到Oracle时会出现此错误:
ORA-12541:TNS:没有听众
任何人都知道如何解决这个问题?
答案 0 :(得分:1)
您的听众未启动(发出命令lsnrctl start
)或您的tnsnames.ora错误。
答案 1 :(得分:0)
在php.ini文件中进行更改 通过删除启用oci驱动程序取消注释;分号 检查正确的dll文件 然后
试试这个简单的课程
def create
if @user = User.find_by_email(params[:email])
flash[:notice] = "Email address already in use!"
redirect_to new_merchant_path
else
render 'form'
end
end
只需保持error_reporting和display_errors为On即可查看错误。
class AdoConnection {
public $dbh;
public function __construct() {
include_once '../adoconnection/adodb5/adodb.inc.php'; // include your adodb.inc.php file
$server = "127.0.0.1";
$user = "USER/SCHEMA/Database";
$pwd = "password";
$db = "SID OR Service_Name";
$this->dbh = NewADOConnection('oci8');
$this->dbh->Connect(FALSE, $user, $pwd, '(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = ' . $server. ')(PORT = 1521)) (CONNECT_DATA = (SERVICE_NAME = ' . $db . ') (SID = ' . $db . ')))');
}
public function select($sql) {
$result = $this->dbh->Execute($sql);
$result = $result->GetRows();
return $result;
}
public function insert($sql) {
$result = $this->dbh->Execute($sql);
return $result;
}
}
$dbh = new AdoConnection();
$dbh->select($sql);
$dbh->insert($sql);