Author Topic: Cannot connect to database  (Read 15788 times)

0 Members and 1 Guest are viewing this topic.

Offline rick.ca

  • Global Moderator
  • *****
  • Posts: 3241
  • "I'm willing to shoot you!"
    • View Profile
Cannot connect to database
« on: November 21, 2009, 06:05:18 am »
My new computer finally arrived. I'm struggling with Vista x64 while waiting for my Win7 upgrade. (I know, it was released a month ago! I'll never buy a Dell again...) As if that's not enough, I can't get PvdImport working—or PVD to load while it's running. Trying to run PVD when PvdImport is connected to the database causes this error...

1:I/O error for file "C:\Data\PVD\MY MOVIES.PVD" Error while trying to open file
The process cannot access the file because it is being used by another process.
Unsuccessful execution caused by a system error that precludes successful execution of subsequent statements
Error Code: 24


Trying to run MC/PvdImport while PVD is connected to the database causes what appears to be a similar error...

Failed to open database! Exception: I/O error for file CreateFile (open) "C:\Data\PVD\My Movies.pvd" Error while trying to open file.

Didn't raldo have a problem similar to this a while back? I thought it might have something to do with me using the newer x64 version of Firebird, but I get the same results with the older x32 version.

I suspect PVD is actually connecting via Firebird Embedded, and thereby locking the database. Firebird Server Properties (the Control Panel applet) indicates no database/attachment when PVD is supposedly connected. When MC is running, it indicates one.

Nostra, I'll email a few exception reports, in case they include any useful information.

Offline raldo

  • Power User
  • ****
  • Posts: 140
    • View Profile
Re: Cannot connect to database
« Reply #1 on: November 21, 2009, 02:51:57 pm »

Didn't raldo have a problem similar to this a while back? I thought it might have something to do with me using the newer x64 version of Firebird, but I get the same results with the older x32 version.


Quite a few users have had this problem when using PVD and PvdImport simultaneously.

The last item in the newest PvdImport release thread FAQ shows how the .ini file should look. However, I'm not sure if the Network key in this file *really* tells the whole truth!

It's definitely related to how PVD connects to the database. If it's via embedded while your server (and PvdImport) is running, there will be this kind of exception.
« Last Edit: November 21, 2009, 02:53:40 pm by raldo »

Offline nostra

  • Administrator
  • *****
  • Posts: 2852
    • View Profile
    • Personal Video Database
Re: Cannot connect to database
« Reply #2 on: November 21, 2009, 04:46:36 pm »
Which path are you entering when connecting to server?
Gentlemen, you can’t fight in here! This is the War Room!

Offline rick.ca

  • Global Moderator
  • *****
  • Posts: 3241
  • "I'm willing to shoot you!"
    • View Profile
Re: Cannot connect to database
« Reply #3 on: November 21, 2009, 09:19:47 pm »
The last item in the newest PvdImport release thread FAQ shows how the .ini file should look. However, I'm not sure if the Network key in this file *really* tells the whole truth!

My configuration...

Code: [Select]
[DataBase]
Network=1
FileName=C:\Data\PVD\MY MOVIES.PVD
RecentFiles=..\..\Data\PVD\TEST.PVD|C:\Data\PVD\TEST.PVD
RecentTypes=0;1;
Mode=0

Quote
It's definitely related to how PVD connects to the database.

Yes, it seems so. I realize this is not conclusive, but here's another experiment: I disabled fbembed.dll. Not surprisingly, this caused an exception on starting the program, but it did start—without loading a database. Attempting to connect to server then caused the same exception, suggestion the program is trying to use the DLL instead of the server.

Which path are you entering when connecting to server?

As shown in the configuration above... C:\Data\PVD\MY MOVIES.PVD.

I didn't find this before my original post, but this issue seems to be exactly the same as that reported in April (version 0.9.9.5): PVD locks the Firebird database.

It seems I've stumbled onto a workaround. I shut down PVD, MC and Firebird, then restarted Firebird as an application (rather than a service. Then I started PVD and reloaded/connected databases as indicated here...

Code: [Select]
[DataBase]
Network=1
FileName=RIX:C:\Data\PVD\My Movies.pvd
RecentFiles=..\..\Data\PVD\TEST.PVD|C:\Data\PVD\MY MOVIES.PVD|C:\Data\PVD\TEST.PVD
RecentTypes=0;1;1;
Mode=0

...to reconnect using the computer name as well as the database filepath. Unlike previous attempts, the Firebird Server Manager instantly indicated a connection. I've since switched back to running Firebird as a service, and it still works fine.

Offline nostra

  • Administrator
  • *****
  • Posts: 2852
    • View Profile
    • Personal Video Database
Re: Cannot connect to database
« Reply #4 on: November 22, 2009, 05:10:48 am »
I am pretty sure the only thing you had to do is using path with computer name. It seems like there must be a bug that makes PVD only use local connection when using normal local paths in some circumstances.
Gentlemen, you can’t fight in here! This is the War Room!

Offline rick.ca

  • Global Moderator
  • *****
  • Posts: 3241
  • "I'm willing to shoot you!"
    • View Profile
Re: Cannot connect to database
« Reply #5 on: November 22, 2009, 05:43:37 am »
Perhaps so, but adding the computer name is one of the first things I tried—the bug might be trickier than it seems. Maybe the issue of not being able to connect a database that's already opened (a different one has to be opened first) and this bug are connected.

Offline raldo

  • Power User
  • ****
  • Posts: 140
    • View Profile
Re: Cannot connect to database
« Reply #6 on: November 23, 2009, 09:41:50 am »
PvdImport has been downloaded by a lot of users and occasionally this problem arises. It's hard for me to see a pattern other than "PVD may not be properly connected even if Network=1 and the path looks ok". The problem *may* be more frequent with Vista and Win7 than XP, but that may be just related to Win7 coming out of release.

Maybe it's related to Admin rights?

Anyways, I think it would have been nice with a clear indication in PVD on how it has connected, server or embedded, so we could ask "is PVD connected to the server? Look at the icon in the lower left corner, does it look like an x or a y?"

Offline rick.ca

  • Global Moderator
  • *****
  • Posts: 3241
  • "I'm willing to shoot you!"
    • View Profile
Re: Cannot connect to database
« Reply #7 on: November 23, 2009, 11:19:02 am »
Quote
Anyways, I think it would have been nice with a clear indication in PVD on how it has connected, server or embedded, so we could ask "is PVD connected to the server? Look at the icon in the lower left corner, does it look like an x or a y?"

It does that now in the title bar. Problem is, it lies. ;)

Offline raldo

  • Power User
  • ****
  • Posts: 140
    • View Profile
Re: Cannot connect to database
« Reply #8 on: November 23, 2009, 11:17:53 pm »
Check out: http://www.delphigroups.info/2/9/789896.html

Did you try 127.0.0.1:<path> ?


Offline rick.ca

  • Global Moderator
  • *****
  • Posts: 3241
  • "I'm willing to shoot you!"
    • View Profile
Re: Cannot connect to database
« Reply #9 on: November 23, 2009, 11:47:50 pm »
Quote
Did you try 127.0.0.1:<path> ?

No, but I imagine it would work as does including the computer name. I don't really understand the linked discussion, but it seems to indicate the problem originates with Firebird. Nevertheless, if this is the case, the "connect to database" should require the explicit including of a computer name or IP address, and use this in making the connection. It could default to the name of the local machine, so most users wouldn't notice the difference.

Offline Colin

  • Member
  • *
  • Posts: 5
    • View Profile
Re: Cannot connect to database
« Reply #10 on: December 17, 2010, 09:07:50 pm »
Hi
First of all thanks for what seems like a nice piece of software.  I'm still trying to figure out how to get the best out of it, but I've only had it for three days and have managed to build a database from existing files on HDD's of 1300 movies. I've had a couple of nasty scares when trying to reopen the database... It would open ok and show all the records but without the majority of the content... all the posters gone rattings basically everything but the Title, imdb URL and the date added fields... Not really sure how I managed to get it back on track (I was panicked :( thought I'd lost it all) but it all came back :)

Then I started getting error messages like those below:

-------------------------    ----------------------     -------------------------

1:I/O error for file "C:\Data\PVD\MY MOVIES.PVD" Error while trying to open file
The process cannot access the file because it is being used by another process.
Unsuccessful execution caused by a system error that precludes successful

execution of subsequent statements
Error Code: 24

Failed to open database! Exception: I/O error for file CreateFile (open) "C:\Data\PVD\My Movies.pvd" Error while trying to open file.


-------------------------    ----------------------     -------------------------

I was looking in the forums and noticed the same errors, but the dialogue was a

bit over my head :( and it didn't seem to be resolved.

I am running PVD v 0.9.9.21 on Win7 64bit os

I don't believe I have Firebird installed (it's not showing in Task Manager) and I used the installer program from PVD. So am I right in saying that it is embeded, that is the RDBMS engine is in the PVD programe?

Anyway's what I found was that:

viddb.exe *32 was still running in task manager (PVD was not open)

So I end the viddb.exe *32 task and PVD opens normally



Offline rick.ca

  • Global Moderator
  • *****
  • Posts: 3241
  • "I'm willing to shoot you!"
    • View Profile
Re: Cannot connect to database
« Reply #11 on: December 17, 2010, 10:11:59 pm »
Welcome, Colin.

First of all, I have to say the only way to avoid "nasty scares" with any application like this is to make regular backup. What "regular" means is up to you. If you don't mind losing a week's changes, then weekly. If you can only tolerate losing what you did today, then daily. And that backup should be automated. Otherwise, one way or another, sooner or later, you'll be blaming yourself for not making a backup when you should have. ;)

That being said, the first problem doesn't suggest anything is wrong with the data. The program does sometimes have difficulty displaying the information panel. These issues are often fixed by refreshing or changing records, but sometimes require the program be restarted.

Perhaps you know that, and you're associating the second issue with the first because it happens after you've attempted to restart the program. If the program is in serious trouble (and, from your description, it does seem more serious than the display problems I'm used to), it's quite likely it won't be able to close properly. You may need to use Task Manager to terminate the process.

This brings us to the second issue. Given that the program process is still running, this is exactly what should be expected. That process is still maintaining a connection to the database. The embedded version of Firebird doesn't support multiple connections. The error message you get when trying to start another instance of the program means exactly what it says.

This doesn't help much if the problem keeps happening. But maybe it will help you investigate further without fear you're going to lose all you data...After you've properly restarted the program, how long is it before it happens again? Does it only happen on startup? Is it ever not fixed by terminating the process and then starting the program again?

Offline Colin

  • Member
  • *
  • Posts: 5
    • View Profile
Re: Cannot connect to database
« Reply #12 on: December 18, 2010, 12:06:49 am »
After a bit more investigation I find that when I minimize PDV, it does not show up on the task bar.  So you think it's closed. If you check Task Manager's Applications tab it isn't there. But it is still running in the Processes tab.

But this doesn't always happen... at the moment it is in the taskbar and even pops up a small window on mouseover...  So I'm not really sure if it's a problem with PDV or windows. :)

Should I be running PDV in ... what's it called latency mode or something... like you sometimes have to do with winxp programs?

Offline rick.ca

  • Global Moderator
  • *****
  • Posts: 3241
  • "I'm willing to shoot you!"
    • View Profile
Re: Cannot connect to database
« Reply #13 on: December 18, 2010, 12:25:26 am »
Quote
After a bit more investigation I find that when I minimize PDV, it does not show up on the task bar.

That's a "feature" provided by the PVDtoTray plugin. You can disable it (and I recommend doing so) by deleting or renaming C:\Program Files (x86)\Personal Video Database\Plugins\pvdtotray.dll.

Quote
Should I be running PDV in ... what's it called latency mode or something... like you sometimes have to do with winxp programs?

You probably mean "PVD" and "compatibility mode," but no, it runs fine in Windows 7 x64. ;)