• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How do I create a table in a database using coldfusion

New Here ,
Nov 20, 2022 Nov 20, 2022

Copy link to clipboard

Copied

Most of the instructions online are retrieval and inserting new data on an existing database. I setup coldfusion builder and was able to add a datasource through the coldfsuion administrator. I am just trying to figure out how to create new tables in that new database. Any help would be much appreciated. Thank you.

Views

614

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 20, 2022 Nov 20, 2022

Copy link to clipboard

Copied

Gabe, you'll generally not do that WITH ColdFusion, though you indeed can. More on that in a moment.

 

Instead, when a web app built with something like cf interacts with databases, that interaction is generally focused on querying, updating, inserting, or deleting data in tables that ALREADY exist. That's why most of what you find discuss those operations. 

 

But you can indeed do all that AS WELL AS create (or delete or modify) tables in a cf web application since most such web apps interact with a database via SQL--and sql supports both kind of operations. The former are generally referred to (mostly by academics) as DML (data manipulation language) while the latter is DDL (data definition language).

 

Just Google the create table sql command, and you should be on your way (assuming you have/configure cf to use the proper authority to manipulate the db definition that way). 

 

But really, you'll probably find it far easier to define a table (and it's fields/columns and indexes and relations) using a UI tool dedicated the task of querying or manipulating databases and their design. There are many such tools, free and commercial: some are devoted to a specific db server, while others are generic to any.

 

Finally, if you may have hoped that CF Builder could have helped you here, if you saw mention of it offering a query builder interface, well again that's focused really more on doing DML rather than DDL. So it too will not likely be the right tool for your task.

 

Hope that helps. I'm sure others will have more to say, and may counter my assertions. There are always many ways to do (and consider) things. 


/Charlie (troubleshooter, carehart.org)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 20, 2022 Nov 20, 2022

Copy link to clipboard

Copied

Thanks for the response. What are these free DB tools called? I've downloaded dbweaver and learning how to configure it. Does adobe have a db tool that easily works with coldfusion?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 20, 2022 Nov 20, 2022

Copy link to clipboard

Copied

That's a good one for many. I keep a list of still many others here:

https://www.cf411.com/query

 

As for your last question, if you mean to create db tables, no. Again it's not in cf's purview to do that (nor any other Adobe product I know of), other than via sql. 

 

FWIW, most of those other db tools I point to can create sql--which you could then copy into a cfml application, if somehow you're determined to create db tables from within a cf app you'd write or modify. 


/Charlie (troubleshooter, carehart.org)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 22, 2022 Nov 22, 2022

Copy link to clipboard

Copied

LATEST

Most databases provide their own tools. There isn't that much to these tools in many cases. They just send strings of SQL data definition language (DDL) or data manipulation language (DML). If you're using MySQL, you can use the mysql client to do this from the command line. If you're using SQL Server, you can use SQL Server Management Studio which is a GUI to let you, well, manage SQL Server. Also, there are plenty of tools that can work with multiple database platforms.

 

Adobe doesn't provide any database management clients that I'm aware of. They do provide CF Builder, which can send SQL commands to any database CF can talk to via Remote Development Service (RDS). But I recommend you not use this to create tables etc using SQL DDL commands. You don't want your usually public CF applications having the power to do that. Usually, you want them to be able to create, read, update and delete records, but NOT actually change the structure of the database itself. You don't want your database security to rely on the security of your CF application any more than necessary.

 

On preview, I see @Charlie Arehart has answered a lot of this. So hopefully you'll know what to do next.

 

Dave Watts, Eidolon LLC

Dave Watts, Eidolon LLC

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 21, 2022 Nov 21, 2022

Copy link to clipboard

Copied

Hi @Gabe272096886ts3 ,

In a discussion like this it will be helpful if you mention:

  • the ColdFusion version and update level;
  • the database brand and version;

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation