Jump to content

Weird database creation problem.


Gunder

Recommended Posts

Hello everyone, I'm using the latest version of WAMP on WinXP. I'm learning about Non-Relational Databases but I'm getting some weird permissions error and I don't know why. I should mention that my internet isn't working at home and I'm on a friends computer right now so hopefully I wrote down all the information you will need to help me understand the problem. Here is the code I'm using, it should be easy enough to understand.

 

<?php
// Set the db parameters
$dbPath = "myDatabase.db";
$dbType = "db3";

function CreateDatabase($thePath, $theType)
{
$db = dba_open($thePath, "c", $theType);
if(!$db)
{
	printf("Could not create the database");
	return 0;
}

return $db;
}

function OpenDatabase($thePath, $theType)
{
$db = dba_open($thePath, "r", $theType);
if (!$db)
{
	printf("Could not open the database");
	return 0;
}

return $db;
}

// Open the database, if it isn't there, create it.
$db = OpenDatabase($dbPath, $dbType);
if(!$db)
{
$db = CreateDatabase($dbPath, $dbType);
if(!$db)
{
	exit;
}
}

?>

 

Here is the error I'm getting.

 

error:

Warning: dba_open(myDatabase.db,r) [function.dba-open]: Driver initialization failed for handler: db3: Permission denied in C:\wamp\www\DBAtest\DBAtest.php on line 20

Could not open the database

Warning: dba_open(myDatabase.db,c) [function.dba-open]: Driver initialization failed for handler: db3: Permission denied in C:\wamp\www\DBAtest\DBAtest.php on line 8

Could not create the database

 

The error tells me that I'm having permission problems but when I open up PHPmyadmin and go into the Privileges tab it says that the user root on local host has all privileges. The weird thing is that the file myDatabase.db is actually created in the directory but I'm getting these errors. I wanted to test and make sure that I could actually read and write files so I dug through the PHP manual a bit and played with fopen and it works just fine.

 

I asked this on the WAMP forums and all I was told is to use sqlitemanager to open the database. Well I go into sqlitemanager and there is an option for version and I can select 2 or 3, 3 is grayed out. I'm assuming 3 is that one I want for DB3 but I could be wrong, I'm still learning about this. I looked through PHPinfo and under the section for DBA, DB3 is listed. I'm not sure what I'm doing wrong and I'm at a loss for where I should be looking.

 

-Gunder

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.