I have an app developed by another collegue, no longer with the company.I'm using the same code he had, but I'm getting database errors. Below is the DBI code. I have SQLitePro installed on my computer. I suspect the original code was developed with an earlier version of Sqlite. Below is the error, web app and code:

Error from website:

Content-type: text/html <h1>Software error:</h1> <pre>unable to open database file(1) at dbdimp.c line 94 </pre> <p> For help, please send mail to this site's webmaster, giving this error + message and the time and date of the error. </p>

Code connecting to database:

#!c:\Perl\bin\Perl.exe # Created: 2006/03/28 use strict; use CGI qw {:cgi-lib :standard}; use CGI::Carp qw(fatalsToBrowser); use File::Copy; use DBI; my $form = Vars(); if ($$form{editnew} eq "edit") { print redirect("workplan.pl?workplan=$$form{createfrom}") } elsif ($$form{editnew} eq "new") { copy ("$$form{createfrom}.db","$$form{newname}.db"); my $database = DBI->connect("dbi:SQLite:dbname=$$form{newname}.db" +,"","") || die "$DBI::errstr\n"; $database->do("delete from edits"); $database->do("insert into edits values(0,0,0,0,'')"); $database->disconnect(); print redirect("workplan.pl?workplan=$$form{newname}") }

Web site code:

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w +3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <title>Page Title</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" + /> <link rel="stylesheet" type="text/css" href="css/main.css" /> <script src="javascript/index.js">function Submit1_onclick() { } </script> </head> <body> <h1>Work Tools</h1> <br /><br /><br /> <div> <h3>Create New Workplan</h3> <form method="post" name="Create New" action="workplan/createedit. +pl" onsubmit="javascript:return validate();"> <label for="createfrom">Create based on Workplan:</label> <select name="createfrom"> <option value="testplan">testplan</option> <option value="tiffany">tiffany</option> <option value="chris">chris</option> </select><br /> <label for name="newname">Name of Workplan:</label> <input type="text" name="newname" id="newname" /> <input type="hidden" name="editnew" value="new" /> <input type="submit" value="Create" id="Submit1" language="jav +ascript" onclick="return Submit1_onclick()" /> </form> <br /> <h3>Edit Existing Workplan</h3> <form method="post" name="Create New" action="createedit.pl"> <label for="createfrom">Workplan:</label> <select name="createfrom"> <option value="111Test">111Test</option> <option value="3-5k mix">3-5k mix</option> <option value="3-5k shuffle">3-5k shuffle</option> <option value="tiffany">tiffany</option> <option value="chris">chris</option> </select> <input type="hidden" name="editnew" value="edit" /> <input type="submit" value="Edit" /> </form> </body> </html>

20080915 Janitored by Corion: Added formatting, code tags, as per Writeup Formatting Tips


In reply to Database problem - dbdimp.c by Franco_1

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.