2016-08-03 53 views
-1

我试图运行的代码块,我得到这个错误:收到一个错误在Perl编码,当我尝试使用DBI使用SQLite

DBI connect('dbname=C:\Users\pdk11.UFAD\Desktop\RA\sap_populate','',...) failed: unable to open database file(1) at dbdimp.c line 94 at C:\Users\pdk11.UFAD\Desktop\RA\Perl\Extract items\04createheader_SAP_pk.pl line 41.

#!/usr/bin/perl -w 
use HTML::Scrubber; 
use HTML::TreeBuilder; 
use HTML::FormatText; 
use DBI; 
use Time::HiRes qw(gettimeofday); 
# Creates a table that holds heading information from Edgar 10-K Files. 

$total1=gettimeofday; 

#First specify the directory containing the files you want to get. 
#use random sort, a file containing 10 files 
$directory="D:\\ExternalFiles\\Edgar\\tenks\\"; 
#if windows, slash is "\\", mac "/"; 
$slash="\\"; 

#Connect to database 
#$DSN is data source name 
#$DSN='dbi:SQLite:dbname=A:\\MyFiles\\MyPapers\\Differential_Contagion\\Analysis\\Input\\acctgchanges.sqlite'; 
$DSN='dbi:SQLite:dbname=C:\\Users\\pdk11.UFAD\\Desktop\\RA\\sap_populate'; 
$use='';$pword=''; 
#connect to the sqlite database 
$dbh=DBI->connect($DSN,$use,$pword,{RaiseError=>1, AutoCommit=>1}); 

I've attached a picture of the SQL files that I've downloaded onto my hard drive.

+0

我编辑了你的问题来显示图像,但它看起来像是一个断开的链接 – Borodin

+0

你需要更多的空白空间来使你的代码可读。并且'严格使用'是强制性的。 – Borodin

+0

看起来你不熟悉电脑,更不用说编程了。你试图通过编辑你在某处找到的一些脚本来做某件事,但这肯定会以失望告终。 –

回答

0
$DSN='dbi:SQLite:dbname=C:\\Users\\pdk11.UFAD\\Desktop\\RA\\sap_populate'; 

在我看来,像C:\Users\pdk11.UFAD\Desktop\RA\sap_populate是一个目录。您需要在该目录中指定一个数据库文件。

+0

谢谢你的回应,我知道我有点慢,但我很欣赏它。我不确定你是否能看到我最初提交的图片,但将这些sqlite文件放入“sap_populate”文件然后运行它是否合理? 当你说我需要指定一个数据库文件,你可以慢慢地通过我的意思吗?再次感谢你。 – user6673821

+0

答案是否定的。 SO不是免费的一对一辅导服务。您目前缺乏完成此任务的知识和技能。 –

相关问题