0

I watched a video in relations to creating and working with databases in Delphi. The video states that you can create the database using code, the data explorer or the SQLite3 console application, but I am unable to find out how to create the database using the Data Explorer. Does anyone know a way I can go about doing this?

Thank you in advanced.

ple103
  • 2,080
  • 6
  • 35
  • 50

1 Answers1

5

The instructions that follow are for XE3, but they should work for XE as well.

Right-click on the SQLite item in the Data Explorer, and choose New connection.

Enter the full path to your new database file (which, of course, won't exist yet) in the Database edit control.

Click the Advanced button in the lower right corner of the dialog. Find the entry for FailIfMissing, and change the value from True to False, and then click the OK button to close the Advanced Properties dialog.

Click the Test connection button in the lower left corner of the dialog (directly across from the Advanced button you clicked before). You should get a dialog that says Test connection successful. Close the New Connection dialog. (If you don't get a successful test connection at this point, check the path to the database you entered; it will fail if the folder doesn't exist. It can also fail if the SQLite3.dll isn't on your Windows PATH or is the wrong version.)

To create tables, expand the Data Explorer entry for your new connection created above, so you can see the Tables, Views, and Procedures branches. Right-click on Tables, and choose New table from the pop-up menu.

Ken White
  • 123,280
  • 14
  • 225
  • 444
  • At the moment, I only have DataSnap and Interbase in the Data Explorer. Is there a way I can add SQLite to that list? – ple103 Oct 24 '12 at 23:33
  • 1
    What SKU (Starter, Professional, etc) are you using? IIRC, SQLite wasn't included in XE Starter or Professional, and therefore can't be used via `DBExpress` (which is what Data Explorer uses). (It's in XE2 and XE3 Pro, but not in Starter, BTW.) There are third-party components that will allow you to use SQLite, but you can't use Data Explorer to work with it. (If you use FireFox, there's an SQLite Manager add-in that works pretty well and is free; it adds a new button to the toolbar that opens an IDE for SQLite.) – Ken White Oct 24 '12 at 23:49
  • I believe I have the Ultimate Edition. – ple103 Oct 25 '12 at 00:49
  • 1
    "You believe"? :-) `Help->About`, and look at the `Product Status` near the bottom of the dialog. It should say `Product Status: Registered`, and right below that show the SKU (mine in XE3 clearly says `Professional`). If you have `Ultimate` and don't have `SQLite`, you didn't install something and need to re-run the installer to include the missing pieces. – Ken White Oct 25 '12 at 01:06
  • I've re-run the installer several times now; DBXPool, DBXTrace and IBToGo have appeared in my Data Explorer. I don't understand why they're just randomly appearing and why SQLite isn't there ... P.S. I have XE3 Ultimate Edition. – ple103 Oct 25 '12 at 06:48
  • 1
    You should probably open a new question on that, then; it's a totally separate topic from this one. (Make sure you tag it `delphi`, `delphi-xe3`, and `dbexpress`.) You can also open a free support case with [Embarcadero](http://support.embarcadero.com) for an installation issue. They're actually fairly quick at responding. – Ken White Oct 25 '12 at 11:01