秒懂百科世界如此简单

…posted by davidjmedlock:

…由 davidjmedlock 发布

not

并非旨在为网站提供动力。 它适用于小型网站,但是很快会变得难以管理,有以下几种方式:

  • When the Access database is accessed via the website it is locked, making it virtually impossible to overwrite if you need to upload changes to the database.
  • If users are interacting with your site you’ll have to make sure you don’t lose any data when you make structural changes to the database. This means making the changes on your development machine, downloading the current version from your website, and combing through the database to make sure you’ve added and modified all the right columns and tables, then making sure the data holds up, then breaking the lock on the Access file (usually by changing the DSN), then uploading the new database… (Yes, it’s messy.)
  • An Access database is far more limited in the number of concurrent users it can support and once it reaches a certain size you’ll see some serious performance issues.

So, at some point moving to an actual database server is going to be a necessity for many rapidly growing sites. For Access users, the choice is often SQL Server, since it’s so incredibly easy to move data between Access and SQL Server, using Data Transformation Services.

因此,在某些时候,迁移到实际的数据库服务器对于许多快速增长的站点将是必需的。 对于Access用户,通常选择SQL Server,因为使用Data Transformation Services在Access和SQL Server之间移动数据非常容易。

Now, over the weekend, I found myself in the position of needing to move a database for a site over from Access to SQL Server. It was easier than I thought. Here’s all I had to do: [list=1][*]Create the SQL Server databases: one for testing, one for production.[*]Create the ODBC datasources[*]Export the data from Access to the test database[*]Change my DSN variable in my application.cfm file[*]Change any Now() functions in my queries to GetDate() functions.[*]Test the code on a subdomain of the site[*]Upload the new code[/list]In total, it might have taken two or three hours, just because I had to find a copy of Enterprise Manager that I could use with a remote host. Fortunately for those of us who are perpetually broke, you can download the trial version of SQL Server and you get a non-expiring version of Enterprise Manager. (See referenced thread above.) Once I had that, everything else was a breeeze. :)

现在,在周末,我发现自己需要将站点的数据库从Access移到SQL Server。 这比我想的要容易。 这就是我要做的全部事情:[list = 1] [*]创建SQL Server数据库:一个用于测试,一个用于生产。[*]创建ODBC数据源[*]将数据从Access导出到测试数据库[* ]在application.cfm文件中更改我的DSN变量[*]将查询中的所有Now()函数更改为GetDate()函数。[*]在站点的子域上测试代码[*]上传新代码[/ list]总共可能要花两三个小时,只是因为我必须找到可以用于远程主机的Enterprise Manager的副本。 幸运的是,对于那些永远崩溃的人来说,您可以下载SQL Server的试用版,然后获得Enterprise Manager的非过期版本。 (请参阅上面引用的线程。)一旦有了这些,其他所有内容都会微风轻拂。 :)

So, really, the only application level change I had to make was the DSN name and the current date function in my queries. The current date function could be solved in a couple of ways:

因此,实际上,我唯一需要做的应用程序级别更改是查询中的DSN名称和当前日期函数。 当前日期函数可以通过以下两种方法解决:

1. By setting a variable called “NowFunction” (or whatever) equal to the name of the function you need for the current database:

1.通过设置一个名为“ NowFunction”(或其他名称)的变量等于当前数据库所需的函数名称:

[left]INSERT INTO myTable ( date_added ) VALUES ( #NowFunction# )[/left]

[left]将INSERT INTO myTable(添加日期)(VALUES)(#NowFunction#)[/ left]

2. By using the ColdFusion function Now() to insert the date:

2.通过使用ColdFusion函数Now()插入日期:

INSERT INTO myTable ( date_added ) VALUES ( #Now()# )

INSERT INTO myTable ( date_added ) VALUES ( #Now()# )

always be sure to test everything fully in a testing environment before

始终确保部署之前在测试环境中对所有内容进行全面测试。 这就是我要说的。 目前…

(Note: The code blocks above aren’t working correctly just yet. I’ll let the guys at SP know so they can check it out.)

(注意:上面的代码块目前尚无法正常工作。我会通知SP的人员,以便他们进行检查。)

翻译自: https://www.sitepoint.com/it-should-be-this-easy/

秒懂百科世界如此简单