473,385 Members | 1,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Database creation problems

I am creating a database as so:
Dim cat As New ADOX.Catalog()
Dim CurDB as String
Dim sCreateString As String

CurDB = "MyDatabase.mdb"
sCreateString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & CurDB
cat.Create(sCreateString)
cat = Nothing

The problem is that I wish to delete this database after copying it to
another folder. I can't because it says there is a sharing violation. It
also creates MyDatabase.ldb and this doesn't go even after I have set cat =
nothing. As soon as I stop my program, it frees it up and deletes the .ldb
file.

What do I have to do to close the database so I can delete it?

-Jerry
Nov 6 '06 #1
4 1671
I have the same issue.

I have a procedure that creates an adox table and creates some fields and
indexes and then fully closes.

However Even if i go into windows explorer I cannot move the file till the
application is done.
I couldnt figure out what it was, so now i create the file in the proper
spot, and on next load, if it was a temp file i check
for these temp files and delete it out then.

Prior to exiting out hte first time i make sure the data file is empty.

Miro

"Jerry Spence1" <1@2.comwrote in message
news:45**********************@ptn-nntp-reader02.plus.net...
>I am creating a database as so:
Dim cat As New ADOX.Catalog()
Dim CurDB as String
Dim sCreateString As String

CurDB = "MyDatabase.mdb"
sCreateString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & CurDB
cat.Create(sCreateString)
cat = Nothing

The problem is that I wish to delete this database after copying it to
another folder. I can't because it says there is a sharing violation. It
also creates MyDatabase.ldb and this doesn't go even after I have set cat
= nothing. As soon as I stop my program, it frees it up and deletes the
.ldb file.

What do I have to do to close the database so I can delete it?

-Jerry

Nov 6 '06 #2
It probably has to do with garbage collection.
You may close all of your connections to the file,
but until the garbage collector releases all of them,
the file will still be locked. That's my guess.

Robin S.

"Miro" <mi******@golden.netwrote in message
news:uw**************@TK2MSFTNGP02.phx.gbl...
>I have the same issue.

I have a procedure that creates an adox table and creates some fields and
indexes and then fully closes.

However Even if i go into windows explorer I cannot move the file till the
application is done.
I couldnt figure out what it was, so now i create the file in the proper
spot, and on next load, if it was a temp file i check
for these temp files and delete it out then.

Prior to exiting out hte first time i make sure the data file is empty.

Miro

"Jerry Spence1" <1@2.comwrote in message
news:45**********************@ptn-nntp-reader02.plus.net...
>>I am creating a database as so:
Dim cat As New ADOX.Catalog()
Dim CurDB as String
Dim sCreateString As String

CurDB = "MyDatabase.mdb"
sCreateString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & CurDB
cat.Create(sCreateString)
cat = Nothing

The problem is that I wish to delete this database after copying it to
another folder. I can't because it says there is a sharing violation. It
also creates MyDatabase.ldb and this doesn't go even after I have set cat
= nothing. As soon as I stop my program, it frees it up and deletes the
.ldb file.

What do I have to do to close the database so I can delete it?

-Jerry


Nov 7 '06 #3
I've cracked it

Dim cat As Catalog = New Catalog()
Dim CurDB As String
CurDB = DestPath & "MyDatabase.mbd"

cat.Create("Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=5;Data
Source=" & CurDB)
cat.ActiveConnection.Close()
cat.ActiveConnection = Nothing
cat = Nothing
-Jerry


"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:YP******************************@comcast.com. ..
It probably has to do with garbage collection.
You may close all of your connections to the file,
but until the garbage collector releases all of them,
the file will still be locked. That's my guess.

Robin S.

"Miro" <mi******@golden.netwrote in message
news:uw**************@TK2MSFTNGP02.phx.gbl...
>>I have the same issue.

I have a procedure that creates an adox table and creates some fields and
indexes and then fully closes.

However Even if i go into windows explorer I cannot move the file till
the application is done.
I couldnt figure out what it was, so now i create the file in the proper
spot, and on next load, if it was a temp file i check
for these temp files and delete it out then.

Prior to exiting out hte first time i make sure the data file is empty.

Miro

"Jerry Spence1" <1@2.comwrote in message
news:45**********************@ptn-nntp-reader02.plus.net...
>>>I am creating a database as so:
Dim cat As New ADOX.Catalog()
Dim CurDB as String
Dim sCreateString As String

CurDB = "MyDatabase.mdb"
sCreateString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & CurDB
cat.Create(sCreateString)
cat = Nothing

The problem is that I wish to delete this database after copying it to
another folder. I can't because it says there is a sharing violation. It
also creates MyDatabase.ldb and this doesn't go even after I have set
cat = nothing. As soon as I stop my program, it frees it up and deletes
the .ldb file.

What do I have to do to close the database so I can delete it?

-Jerry



Nov 10 '06 #4
So it seems to be the cat.activeconnection = nothing

Thanks!

M.

"Jerry Spence1" <je**********@somewhere.comwrote in message
news:45**********************@ptn-nntp-reader02.plus.net...
I've cracked it

Dim cat As Catalog = New Catalog()
Dim CurDB As String
CurDB = DestPath & "MyDatabase.mbd"

cat.Create("Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=5;Data
Source=" & CurDB)
cat.ActiveConnection.Close()
cat.ActiveConnection = Nothing
cat = Nothing
-Jerry


"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:YP******************************@comcast.com. ..
>It probably has to do with garbage collection.
You may close all of your connections to the file,
but until the garbage collector releases all of them,
the file will still be locked. That's my guess.

Robin S.

"Miro" <mi******@golden.netwrote in message
news:uw**************@TK2MSFTNGP02.phx.gbl...
>>>I have the same issue.

I have a procedure that creates an adox table and creates some fields
and indexes and then fully closes.

However Even if i go into windows explorer I cannot move the file till
the application is done.
I couldnt figure out what it was, so now i create the file in the proper
spot, and on next load, if it was a temp file i check
for these temp files and delete it out then.

Prior to exiting out hte first time i make sure the data file is empty.

Miro

"Jerry Spence1" <1@2.comwrote in message
news:45**********************@ptn-nntp-reader02.plus.net...
I am creating a database as so:
Dim cat As New ADOX.Catalog()
Dim CurDB as String
Dim sCreateString As String

CurDB = "MyDatabase.mdb"
sCreateString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & CurDB
cat.Create(sCreateString)
cat = Nothing

The problem is that I wish to delete this database after copying it to
another folder. I can't because it says there is a sharing violation.
It also creates MyDatabase.ldb and this doesn't go even after I have
set cat = nothing. As soon as I stop my program, it frees it up and
deletes the .ldb file.

What do I have to do to close the database so I can delete it?

-Jerry



Nov 13 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: dustin lee | last post by:
Over the years I've gotten out of the habit of explicitly closing file objects (whether for reading or writing) since the right thing always seems to happen auto-magically (e.g. files get written...
6
by: Dim St Thomas | last post by:
I am a developer working on a database client program. I am testing this program on a Windows XP machine (1.5 GHz AMD chip, 480 Mb RAM, 60 Gb disk) This machine has Oracle 9.2.0.1.0 and RedBrick...
1
by: Ben M. | last post by:
Greetings all, This should be an easy task, and Im sure it is, but as many times as I have tried, I cant seem to get this to work properly. We changed ISPs recently from a shared host to a...
6
by: DH | last post by:
I have a VERY basic question about figuring database size. I've inherited a database which is generally similar to this basic one: Item, Red, Blue, Green, Yellow (text), (int),(int),(int),(int)...
4
by: robert d via AccessMonster.com | last post by:
When my app starts up, it creates a temporary database. This temp database is created from a 'model' database that is in the same folder as the application. Because there is a model, the creation...
25
by: Colin McKinnon | last post by:
Hi all, There's lots of DB abstraction layers out there, but a quick look around them hasn't turned up anything which seems to met my requirements. Before I go off and write one I thought I'd...
0
by: Jonathan Wood | last post by:
I seem to be having errors creating and accessing an SQL database. Unfortunatley, I am brand new to SQL setup and administration issues so this really is not my area of expertise. I know I had...
10
by: shsandeep | last post by:
The ETL application loaded around 3000 rows in 14 seconds in a Development database while it took 2 hours to load in a UAT database. UAT db is partitioned. Dev db is not partitioned. the...
3
by: Limunski Magarac | last post by:
Hi all :) My apologies if I posted in the wrong groups, but I just jumped in MS SQL waters, so any guidance will be appreciated. What I'm trying to do is the following process: present...
0
by: sam | last post by:
Hi, Hope you are doing well !!!! One of our clients is looking to augment their team with “Database Architect – DB2" please find below the details and respond with
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.