Database Archive

Compact and Repair an Access Database

{ Here is a function I have made to compact and repair an access database. Exclusive access to the DB is required!! } uses ComObj; function CompactAndRepair(DB: string): Boolean; {DB = Path to Access Database} var v: OLEvariant; begin Result := True; try v := CreateOLEObject('JRO.JetEngine'); try V.CompactDatabase('Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+DB, 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+DB+'x;Jet OLEDB:Engine Type=5'); DeleteFile(DB); RenameFile(DB+'x',DB); finally V := Unassigned; end; except Result := False; end; …

Create database on local MS SQL Server 2000

Create database on local MS SQL Server 2000 procedure CreateDatabase(WindowsSecurity: Boolean; Username, Password: String); var ConnectionString: String; CommandText: String; begin if WindowsSecurity then ConnectionString := 'Provider=SQLOLEDB.1;' + 'Integrated Security=SSPI;' + 'Persist Security Info=False;' + 'Initial Catalog=master' else ConnectionString := 'Provider=SQLOLEDB.1;' + 'Password=' + Password + ';' + 'Persist Security Info=True;' + 'User ID=' + Username + ';' + 'Initial Catalog=master'; try try ADOConnection.ConnectionString := ConnectionString; …

Read a BlobStream with TADOQuery from an AccessDB

Read a BlobStream with TADOQuery from an AccessDB function GetBlobStream(Query: TADOQuery): TMemoryStream; begin result := TMemoryStream.Create; // You must connect to AccessDB first. // See: Query.Connection, TADOConection or Query.ConnectString // Send SQL command Query.Active := False; Query.SQL.Clear; // data is my row and email the table Query.SQL.Append('SELECT data FROM email WHERE id=1'); Query.Active := True; Result.LoadFromStream(Query.CreateBlobStream(Query.FieldByName('Data'), bmRead)); end;

Convert a ADO Recordset to XML and the reverse way

Convert a ADO Recordset to XML and the reverse way unit ADOXMLUnit; interface uses Classes, ADOInt; function RecordsetToXML(const Recordset: _Recordset): string; function RecordsetFromXML(const XML: string): _Recordset; implementation uses ComObj; { Example: ... Memo1.Lines.Text:=RecordsetToXML(ADOQuery1.Recordset); ... } function RecordsetToXML(const Recordset: _Recordset): string; var RS: Variant; Stream: TStringStream; begin Result := ''; if Recordset = nil then Exit; Stream := TStringStream.Create(''); try RS := CreateOleObject('ADODB.Recordset'); RS := Recordset; …

Amazon RDS – Event Notifications

All through the life cycle of amazon RDS DB situations, many DB occasions happen that are essential to be identified beforehand. For instance – A backup of the DB occasion has began, or an error has occurred whereas restarting MySQL or MariaDB. Notification Classes Primarily based on the character of the occasion, notifications might be categorized into following classes. Class Instance Availability DB occasion is …

Amazon RDS – DB Monitoring

With a view to preserve the reliability, availability, and efficiency of Amazon RDS, we have to gather monitoring information in order that we will simply debug a multi-point failure. With Amazon RDS, you may monitor community throughput, I/O for learn, write, and/or metadata operations, consumer connections, and burst credit score balances in your DB situations. We must also contemplate storing historic monitoring information. This saved …

Amazon RDS – Multi-AZ Deployments

In a Multi-AZ deployment, Amazon RDS mechanically provisions and maintains a synchronous standby duplicate in a unique Availability Zone. The first DB occasion is synchronously replicated throughout Availability Zones to a standby duplicate to offer knowledge redundancy, eradicate I/O freezes, and decrease latency spikes throughout system backups. Working a DB occasion with excessive availability can improve availability throughout deliberate system upkeep and assist shield your …

Amazon RDS – MySQL DBA Tasks

As with each different database, Amazon RDS MYSQL additionally wants DBA duties to wonderful tune the database and do periodic well being checks and many others. However because the AWS platform doesn’t permit the shell entry to the DB, there are a restricted variety of DBA duties that may be carried out as in comparison with the on-premise set up of MySQL. Under is an …

Amazon RDS – MySQL DB Export Import

Amazon RDS MySQL offers straightforward methods of importing knowledge into the DB and exporting knowledge from the DB. After we’re capable of efficiently hook up with the MySQL database we will use CLI instruments to run the import and export instructions to get the info from different sources out and in of the RDS database. Under are the eventualities to think about when deciding on …

Amazon RDS – MySQL Connecting to DB

To hook up with Amazon RDS MySQL DB we want a consumer software program. On this case we use MySQL Workbench. After it’s efficiently put in we observe the steps under to attach it to the Amazon RDS. Step-1 From the DB occasion particulars get the top level. Step-2 Use the top level and the grasp consumer credentials because the connection particulars. Step-3 As soon …