Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 16th, 2004, 07:43 PM
Authorized User
 
Join Date: Mar 2004
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default Programmically create a database?

I found some ASP script to create a simple database using ADOX.Catalog, but it is possible to
programmically create a userID+password-protected database?

 
Old March 17th, 2004, 04:29 PM
Authorized User
 
Join Date: Mar 2004
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default


Better yet, is it possible to programmatically add a password to an existing
database that has no password?

 
Old March 19th, 2004, 11:34 PM
Authorized User
 
Join Date: Mar 2004
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default

No takers? Nevermind, I got it working.

It looks like password protecting a database only restricts access to the file.
I can still see my table data in a hex editor. But including the encryption option
helps that somewhat.

How secure are password protected and encrypted MS Access 2000 databases?
What is being used to encrypt it?

This is what I use to programmically create a password protected database:

<%
Sub CreateDatabase(Provider, DataSource)

    Dim catNewDB
    Set catNewDB = Server.CreateObject("ADOX.Catalog")

    catNewDB.Create Provider & DataSource & _
                    "Jet OLEDB:Database Password=mypwd;"
                    "Jet OLEDB:New Database Password=mypwd;" & _
                    "Jet OLEDB:Encrypt Database=True;"
    Set catNewDB = Nothing

End Sub
%>


 
Old March 19th, 2004, 11:35 PM
Authorized User
 
Join Date: Mar 2004
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Typo:

<%
Sub CreateDatabase()

    Dim catNewDB
    Set catNewDB = Server.CreateObject("ADOX.Catalog")

    catNewDB.Create Provider & DataSource & _
                    "Jet OLEDB:Database Password=mypwd;" & _
                    "Jet OLEDB:New Database Password=mypwd;" & _
                    "Jet OLEDB:Encrypt Database=True;"
    Set catNewDB = Nothing

End Sub
%>



 
Old March 20th, 2004, 05:52 AM
Authorized User
 
Join Date: Mar 2004
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Not quite sure if this is correct, but I think you can also convert an existing database using CompactDatabase. Not sure if this also compacts it though. I just want to make a exact duplicate of a database. But I guess this is the best/only way to programmically copy a database?

<%
Sub CompactDatabase(src_DB, dest_DB)

 Dim objJetEngine
 Dim src
 Dim dest

 Set objJetEngine = Server.CreateObject("JRO.JetEngine")

 src = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
       "Data Source=" & src_DB & ";"

 dest = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
        "Data Source=" & dest_DB & ";" & _
        "Jet OLEDB:Database Password=mypwd;" & _
        "Jet OLEDB:New Database Password=mypwd;" & _
        "Jet OLEDB:Encrypt Database=True;"

 objJetEngine.CompactDatabase src, dest

 Set objJetEngine = Nothing

End Sub
%>


 
Old March 20th, 2004, 06:10 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Jeff,

If you want to make an *exact* duplicate, wouldn't it be easier to do just a file copy?

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old March 20th, 2004, 05:22 PM
Authorized User
 
Join Date: Mar 2004
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sorry, I mean copy an existing database, but add a password/encrypt
option to it. I don't want the database to be compacted.

I probably misunderstand the meaning of 'compact'. I hope it doesn't mean compressed.

 
Old March 20th, 2004, 05:32 PM
Authorized User
 
Join Date: Mar 2004
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Found a definition. It looks like CompactDatabase is similar to defragging
your hard drive. It doesn't compress it, it just cleans it up. So, I guess
compacting your database doesn't hurt anything.

"As you change data in a database, the database file can become fragmented and use more
disk space than is necessary. Periodically, you can use the CompactDatabase method to
compact your database to defragment the database file. The compacted database is
usually smaller and often runs faster. You can also change the collating order,
the encryption, or the version of the data format while you copy and compact the database."






Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to create database. rupen SQL Server 2005 4 December 6th, 2007 02:39 AM
How to create a Database koushikroy2001 SQL Language 2 January 4th, 2006 04:03 AM
Create database Yee MySQL 2 November 5th, 2004 06:14 AM
How to create a new database? gpc Classic ASP Databases 17 December 19th, 2003 10:24 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.