AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Datenbanken Attach/Dittach DB using Delphi
Thema durchsuchen
Ansicht
Themen-Optionen

Attach/Dittach DB using Delphi

Ein Thema von question · begonnen am 4. Dez 2013 · letzter Beitrag vom 4. Dez 2013
Antwort Antwort
question

Registriert seit: 17. Apr 2013
97 Beiträge
 
#1

Attach/Dittach DB using Delphi

  Alt 4. Dez 2013, 10:51
Datenbank: mssql • Version: 2005 • Zugriff über: win 7
Hi,
I have created a button called "DBAttached" using delphi and i would like to attached a MSSQL DB by clicking on this button. i am using the following query
Code:
CREATE DATABASE [database_name] ON
( FILENAME = 'C:\Program Files....\test.MDF'),
( FILENAME = 'C:\Program Files ....\test_log.LDF')
 FOR ATTACH ;
but when i run the program and click on the button , i get the error "test.MDF" kann nicht geöffnet werden. Betriebssystemfehler 5: "5(Zugriff verweigert)".
if i run the SQL server management studio as a administrator, then i can attached/dittached any DB using SQL server management studio only,
but how i can do the same using delphi as well?
  Mit Zitat antworten Zitat
Klaus01
Online

Registriert seit: 30. Nov 2005
Ort: München
5.755 Beiträge
 
Delphi 10.4 Sydney
 
#2

AW: Attach/Dittach DB using Delphi

  Alt 4. Dez 2013, 11:20
Hi,

can you put the database to some other folder (progData)?
In Program-files folder you don't have write permissions.

Best regards
Klaus
Klaus
  Mit Zitat antworten Zitat
question

Registriert seit: 17. Apr 2013
97 Beiträge
 
#3

AW: Attach/Dittach DB using Delphi

  Alt 4. Dez 2013, 11:28
Hi Klaus,
yes, i have tried from another directory(c:\user\public) as well but it has the same problem
  Mit Zitat antworten Zitat
Benutzerbild von sx2008
sx2008

Registriert seit: 15. Feb 2008
Ort: Baden-Württemberg
2.332 Beiträge
 
Delphi 2007 Professional
 
#4

AW: Attach/Dittach DB using Delphi

  Alt 4. Dez 2013, 20:08
your user account must have the disk admin server role to attach/detach databases.
The security system of the MS SQL server is quite complex and you need some time to understand it.
http://www.mssqlcity.com/articles/adm/sql70roles.htm
The local windows administrator has by default all rights on the SQL server.
If you're in the context of an normal windows user account you don't have the rights to create/delete/backup/attach/detach databases.
fork me on Github
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 14:34 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz