开发者

Uploading existing database through Plesk

开发者 https://www.devze.com 2023-02-04 13:31 出处:网络
I was trying to upload the database of my ASP.NET website. On the local machine, if I copy the database from another machine, I have to attach it through SQL Server Management Studio and then use it i

I was trying to upload the database of my ASP.NET website. On the local machine, if I copy the database from another machine, I have to attach it through SQL Server Management Studio and then use it in the connection string like

<add name="cn" connectionString="Data Source=.\sqlexpress;Initial Catalog=database;Integrated Security=True;Pooling=False" providerName="System.Data.SqlClient"/>

My database is approx. 10 MB in size for now. If I upload it via ftp to App_Data folder, how would I have to attach this database?

In Plesk, I have the option to create the database and its user (as shown in the screenshots):

1) Web Applications and services-Plesk

Uploading existing database through Plesk

2) Add New Database

Uploading existing database through Plesk

and add new database user

开发者_运维知识库3) Webadmin>ASP.ET Enterprise Manager

Uploading existing database through Plesk

But this is for the new database I created. My problem is to upload an existing one.

There's also a section in Plesk for ASP.NET settings (as shown below)

Uploading existing database through Plesk

This has the option to change the connection string etc.

I also asked my hosting provider about the method to be followed for attaching the database that I would upload. This was the reply in quote.

mdf ldf files perhaps will be working at your local computer but this way database of mssql will not work on web server as on web server you will be required to create and restore your database backup file using plesk control panel.

Sample connection string for asp.net mssql Standard Security: "Provider=SQLOLEDB;Data Source=Your_Server_Name;Initial Catalog= Your_Database_Name;UserId=Your_Username;Password=Your_Password;"

Server name to be used in coding: localhost Catalog/ database name , database user and database password you will be required to create your own using plesk control panel"[/quote]

I would be really be appreciative for the steps I have to take to upload my existing database. How do I have attach it? What connection string I have to use? Thanks!


Can you run a sql script on your "new" database in Plesk? If so, you can script the object creation and data in your existing db and execute it thusly. In SSMS:

  1. Right click db.
  2. Tasks...
  3. Generate scripts.

Good luck!

0

精彩评论

暂无评论...
验证码 换一张
取 消