Add a data source to cfm 11/Tomcat

It is possible to add a to the tomcat container jdbc data source runs an instance of CF 11?  If so, is any documentation on how to do it?

Thanks in advance...

Ok. To answer your original question, yes it is possible to add a jdbc data source to the container tomcat running in ColdFusion. I will illustrate this by adding a PostgreSQL JDBC data source. Be aware that the following is experimental and, as far as I know, not documented elsewhere. Take notes that will help you, if necessary, to cancel the procedure and return the system to its original state.

The steps are:

1) download and install the latest version of PostgreSQL for your operating system database management system; make sure it is running. Write down the password you give to the server.

(2) download the driver JDBC41 of PostgreSQL, version 9.3 - 1102. It is the version that corresponds to Java 1.7 and 1.8, the versions of Java Virtual Machine from ColdFusion 11. The download is a JAR file. Copy it to the Tomcat lib directory located at {CF_HOME_DIRECTORY} \runtime\lib\.

3) you now add the driver details for the Tomcat configuration files, {CF_HOME_DIRECTORY}\runtime\conf\context.xml and {CF_HOME_DIRECTORY}\runtime\conf\web.xml. }} Make a backup of these files before continuing.

Open the context.xml file in a text editor and add the following element just before the last end tag:

Type = "javax. Sql.DataSource' driverClassName = "org.postgresql.Driver"

URL = "" jdbc:postgresql://127.0.0.1:5432 / booktown ' "

username = "cf_user" password = "cf_password" maxActive = "20" maxIdle = "10" maxWait = "-1" / >

Open the web.xml file in the text editor and add the following element just before the last end tag:

example of postgreSQL data source

JDBC/postgres

javax.sql.DataSource

Container

(4) the resource XML element points to the URL of the database of the booktown. I will now add this database and user for the PostgreSQL server.

Download booktown.sql. Use it to install the database of the booktown on the command line by running a PostgreSQL command as

psql-f /path/to/booktown.sql - U postgres template1

If it works without a hitch, then the booktown database will be installed. The user is initially the default superuser "postgres". Use it to connect on the command line:

psql - U postgres

It will ask you to enter the password, the one you threw down earlier. The command line begins with the command prompt:

Postgres = #.

Now, create another user, cf_user, also on the command line, corresponding to the resource XML element:

Postgres is # CREATE ROLE cf_user PASSWORD "cf_password" SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN;.

(5) you have now completed setup. Restart ColdFusion.

To test, save the following code in a CFM file and run it.

username = "cf_user";

password = "cf_password";

classObj = CreateObject ("java", "java.lang.Class");

classObj.forName ("org.postgresql.Driver");

driverManager = CreateObject ("java", "java.sql.DriverManager");

connectionURL = "" jdbc:postgresql://127.0.0.1:5432 / booktown '; "

Conn = driverManager.GetConnection (connectionURL, username, Password);

myQuery = "" SELECT * FROM books ";"

preparedStatement = conn.prepareStatement (myQuery);

RS = PreparedStatement.executeQuery()) ();

While (RS. Next {}

WriteOutput (RS. "GetString ("title") &"
");

}

RS. Close();

Conn.Close ();

To cancel the procedure above, first stop ColdFusion. Then remove the jar from Tomcat lib direct and restore the context.xml and web.xml to their original state. You can also uninstall the PostgreSQL database management system.

Tags: ColdFusion

Similar Questions

  • Add the Data Source to load the data rule

    I created an ODBC system data source in both the 32-bit and 64-bit ODBC managers (just to be sure), but they do not stand as options for sources of data in the SQL interface in EA. Y at - there a step I'm missing?

    Thank you.

    Did you create the ODBC on the Essbase server or on the server hosting the EAS, it should be on the Essbase server.

    See you soon

    John
    http://John-Goodwin.blogspot.com/

  • 11g - why is it not add processes for multiple roles in new data sources?

    Anyone want to guess why Oracle chose to add roles both in the allocation of privileges to new data sources? If I have 40 different roles and add a new data source, I have to manually add this data source for each role, one at a time, 40 times. Horribly inefficient. Why?

    When you change the new data source (click on the data source), you have the option: "Move All" available to 'Authorized roles' roles under the security heading. Have you looked at this option? (Admin - Data Sources) and not passing is not by Admin-> roles and permissions...

    or have I misunderstood your question?

    Thank you
    BIPuser

  • Filtering data source based on the current user.

    Hello world


    I would like to add a Data Source Filter whenever a certain user connects.

    Any ideas on how to implement this?

    OEID v3.0

    Concerning

    Hi Omi,

    Use case sounds like a fairly standard security manager.  You're looking to filter the view of user data based on attributes of the user profile (be it from the LDAP or elsewhere).

    It is documented here for OEID v 3.0:

    Extension of Security Manager

    That should cover, if you're not a Java guy, or you're looking for some advice, don't hesitate to reach out in offline mode, we have built our fair share of complex and simple (as you describe).

    Patrick Rafferty

    Branchbird

    [email protected]

  • Adding data sources on the Windows Vista-based computer

    I have ColdFusion on my local workstation and I'm looking to add a data source by using the administrator Web site. It worked perfectly on my previous XP machine, but it does not work on my new Windows Vista machine. The data source is a Microsoft Access database stored locally on the c:\ drive. After clicking on the "send" button, the site administrator returns this error message:

    Cannot update the NT registry.
    DRIVERPATH variable is not defined.

    Any ideas? Thank you!

    TorreyBrown wrote:
    > I have ColdFusion on my local workstation and I try to add a
    > by using the data source administrator Web site. It worked perfectly on my
    > previous XP machine, but it does not work on my new Windows Vista machine.

    Windows Vista is not supported with CF 7. You have three options:
    -Try the CF 8 'Scorpio' beta from http://labs.adobe.com/
    -use a database that works with the driver of JDBC Type 4 over TCP/IP
    -use a supported operating system

    Jochem

    --
    Jochem van Dieten
    Adobe Community Expert for ColdFusion

  • Add a MS SQL data source error

    I just installed CF 10 on my Win 7 Home machine and tried to add a MS SQL Server data source and got following error.

    need to install a driver to add MS SQL Server as a data source?

    I'm able to add the MySQL database of MS SQL Server.

    Your information and help is much appreciated,

    Kind regards

    iccsi,

    Connection verification failed for data source: MyServer

    java.sql.SQLNonTransientConnectionException: error [Macromedia] [SQLServer JDBC Driver] establishing socket to host and port: MyServer:1433. Reason: Connection refused: connect

    The root cause was that: java.sql.SQLNonTransientConnectionException: error [Macromedia] [SQLServer JDBC Driver] establishing socket to host and port: MyServer:1433. Reason: Connection refused: connect

    I got it working now.

    Thanks for help and information.

    Kind regards

    Iccsi,

  • data source defined in application.cfm

    Hi guys,.

    My problem: need to define a data source in application.cfm so I don't: < cfset mydatasource = 'Hello' >

    application.cfm is in the root folder. my components are in the folder cf_components and if I try to use:

    < name cfquery = "getMe" datasource = "#mydatasource #" >

    .....

    < / cfquery >

    So overall, I get an error that mydatasource variable is not defined.

    any help much appreciated.

    see you soon,

    Simon

    Other options:

    1. turn your mydatasource variable within a scope which is visible from your components, extended query or request could be used for this.
    Replace mydatasource by application.mydatasource or request.mydatasource
    Scopes: http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec22c24-7fd5.html

    2 specify a default data using the CFAPPLICATION datasource attribute source.  This requires CF9.
    CFAPPLICATION: http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7d 69.le html
    CFQUERY: http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7f ae.html
    Note that "ColdFusion 9: Datasource attribute is now optional.".

  • Data source cannot be created: [MapperConfig] unable to add the source of card data.

    I get this error:
    * The data source cannot be created: [MapperConfig] unable to add the map data source.*

    While following step 2 of the installation Demo MapViewer tutorial.

    I have the BI server installed on a machine and to implement the demonstration on a data schema database RAC.

    I managed to configure the connection via OIC and TNS Planner,
    but now when I try to add, OracleAS MapViewer Admin, data MVDEMO source I get this error.

    I use:
    NAME mvdemo
    BASED ON: TNS is selected
    TNS name: ORCL_TAF
    User: mvdemo
    Password: mvdemo
    # Mappers: 3
    Max connections: 100

    Thank you
    Marco

    Hi Marco,.

    I had the same problem with the MapViewer and a RAC.

    You define your data source in the MapViewerConfig.xml? You will find this XML code under: j2ee/mapviewer/applications/mapviewer/web/WEB-INF/conf

    If so, you need to restart your OC4J Instance with the option "-userThreads. You can do this in the properties of the server administration/mapviewer/unter EnterpriseManager or with the opmn.

    So, I think, you have first to define your data source in the configuration file. Otherwise, it does not have with a CAR.

    I hope this helps.
    Andrea of CU

  • How to use datasource jndi in Weblogic instead of add a DB data source

    Hi all

    version: 11.1.1.4

    I'm trying to understand how in my ADF applications I use a datasource jndi existing on our servers weblogic instead of having to bury the source database db in my adf applications. As SOA, I would refer to the DB directly in the design so that I can pull in entities and build display objects, but when I deploy I want it references on the weblogic Server jndi datasource.

    Is this possible? If so I don't know how to configure it as I would a DB adapter in SOA.

    As always, appreciate the info.

    Thank you

    S

    If you use ADF in the model layer (application modules) you can configure them to use JNDI Datasources. Just right click on the application module and select "Configurations."... ». In the next dialog box, you see all currently available configurations (named xxxxxlocal and a xxxxxshared named at least). Select local and press change. This opening of the DB connection dialog where you can change the connection of the JDBC URL of JDBC (JNDI) data source. Save your work, and when you start now use the JNDI name.

    Timo

  • Query of queries on 2 data sources

    I'm doing a query of queries on 2 different data sources. I run a gaming site and have a 2 programs that are used for tracking. One is written in php, by someone else, following members point State. The other, I wrote it in CF, allows members to set priorities in Treasury. Both are independent on my server. What I'm trying to do is set up so that the program I wrote to FC shows the number of points, each Member has. I know how interrogate separate tables, but how do I combine them? In addition, how can I set up so that it only shows members that match. that is, I want to assure you that if John Smith has 100 points, the query will show John Smith 100 points on my table. Here is what the query looks like I did. As you can see, I'm confused about and WHERE statements. I played with him last night and could not make it work. Thank you.

    You can try the same correction/idea of what I posted in thread http://www.adobe.com/cfusion/webforums/forum/categories.cfm?forumid=1&catid=7

    Copied/Pasted from this thread:

    You can read through the first query and add content to a query to temp attributing some kind of field and then read through the second query and add same temp with a kind of field to the query. Then do a query of this temp query.

  • How to bind the data source to a custom class?

    Hi all.

    I use the chart control to draw two types of plots. One is a path of spectrum which refreshes all samples in a short time, and the other is a curve of time series which add than one sample of each time.  A chartcollection was related to the data source, however, and draw the spectrum seems to not cool off very quickly. Was it due to the propertychanged event? In order to improve the speed of response, what should I do to deal with the data source?

    I went through your response and the help files and found I made a stupid mistake - I always used to Append method (double, double) and did not notice its format void Append (list, list).

    Thanks for your patient response, Paul :-)

  • Logging data source expressions

    Hello

    We use NI TestStand 2012 here in our society, and I have a simple question.

    In any test pass/fail (numeric, String, pass/fail regular), is it possible to have the TestStand to include the data source expression in the default report?

    I can add it manually in the component "Other results", but I have to do for each step.

    I see that on conditional expressions and flow measures are included in the report, but not the my expressions of pass/fail, which are found in the data source tab.

    It seems obvious to me that the data source should be there, otherwise I just in the report the name of the step and the result and no information of what has been actually tested.

    Thank you in advance!

    Leandro

    It does not show what the '10' value means: speed, voltage, current, RPM, etc. unless we call actually step in this way.

    Thanks again.

    There is a 'units' set numerical limit markets which addresses this problem. You can even specify custom units if you would like, although there are many built in those you choose as well. Also the name of the step should usually give an idea of what exactly is being tested.

    For the recording of Boolean expressions, probably the simplest thing is to use a stage model that is preconfigured to connect to the data source, or you can create a new custom step based on the test of success/failure that connects to the default data source type, or you could write a tool that passes through the sequence files and change all tests pass/fail to connect their datasource.

    -Doug

  • A data source using an app does not not to start

    I'm adopting the tutorial: https://developer.blackberry.com/cascades/documentation/device_platform/data_access/using_data_sourc... at my request. The only difference is that my app is based on the tabs. Following however to add lines in my file qml, makes the application crashes the gray screen with BB10 logo.

        Tab {
            title: "edit list"
            imageSource: "asset:///images/note.png"
            content: Page {
                titleBar: TitleBar {
                    title: "editing list: " + workingOnList
                    visibility: ChromeVisibility.Visible
                }
                Container {
                    id: view
                    ListView {
                        layout: StackListLayout {
                        }
                        preferredWidth: 640.0
                        // Associate the list view with the data model that's defined in the
                        // attachedObjects list
                        dataModel: dataModel
    
                        listItemComponents: [
                            ListItemComponent {
                                type: "item"
    
                                // Use a standard list item to display the data in the model
                                StandardListItem {
                                    title: ListItemData.category_name
                                }
                            } // end of ListItemComponent
                        ]
                    }
    
                    attachedObjects: [
                        GroupDataModel {
                            id: dataModel
                        },
                        DataSource {
                            id: dataSource
    
                            // Load the data from an SQL database, based on a specific query
                            source: "database.db"
                            query: "select * from categories"
    
                            onDataLoaded: {
                                // After the data is loaded, insert it into the data model
                                dataModel.insertList(data);
                            }
                        } // end of DataSource
                    ]
    
                    onCreationCompleted: {
                        // After the root Page is created, direct the data source to start
                        // loading data
                        dataSource.load();
                    }
                }
            }
        }
    

    The only differences are: code is pasted in the {} instead of {Page} tab, and of course, the name of the database, the columns are changed.

    I added bb.data 1.0 import statement in the file .qml, the .pro file was also changed according to the tutorial. Path to the database file is correct.

    You have an idea, why this is happening?

    Another issue related to the data source:

    my main.qml file:

        Page {
            id: mainScreen
            titleBar: TitleBar {
                title: "your lists"
                visibility: ChromeVisibility.Visible
            }
            Container {
                ListView {
                    id: allListsView
                    objectName: "allLists"
    
                    layout: StackListLayout {
                        headerMode: ListHeaderMode.Sticky
                    }
    
                    dataModel: allListsModel
    
                    listItemComponents: [
                        ListItemComponent {
                            type: "item"
    
                            StandardListItem {
                                title: ListItemData.list_name
                            }
                        },
                        ListItemComponent {
                            type: "header"
                            Header {
                                title: ListItemData
                            }
                        }
                    ]
                    onTriggered: {
                        select(indexPath);
                        var page = listPage.createObject();
                        nav.push(page);
                    }
                }
    
                attachedObjects: [
                    ComponentDefinition {
                        id: listPage
                        source: "listPreview.qml"
                    },
                    GroupDataModel {
                        id: allListsModel
                        grouping: ItemGrouping.ByFirstChar
                        sortingKeys: ["list_name"]
                    },
                    DataSource {
                        id: allListsSource
    
                        source: "database.db"
                        query: "select * from lists"
    
                        onDataLoaded: {
                            allListsModel.insertList(data);
                        }
                    }
                ]
    
                onCreationCompleted: {
                    allListsSource.load();
                }
            }
    

    New screen grows without any problem after clicking on list items. But when I add the following lines to listPreview.qml, application stucks selection list item and nothing happens.

    Page {
    
        content: ListView {
            id: myListView
    
            dataModel: dataModel
    
            listItemComponents: [
                ListItemComponent {
                    type: "item"
    
                    StandardListItem {
                        title: ListItemData.article_name
                    }
                }
            ]
        }
    
        attachedObjects: [
            GroupDataModel {
                id: dataModel
            },
            DataSource {
                id: dataSource
    
                source: "database.db"
                query: "select * from articles"
    
                onDataLoaded: {
                    dataModel.insertList(data);
                }
            }
        ]
    
        onCreationCompleted: {
            dataSource.load();
        }
    }
    

    It looks like I can not query the DB for the second time commenting on the DataSource {...} of listPreview.qml pushed the new app screen without any problems.

    EDIT:

    a simple solution: I forgot to add the statement import bb.data 1.0 in listPreview.qml

  • Fill the drop-down list in the SQL data source

    I have a data source that retrieves data from an sqlite database. How do I pass two areas of this query to a drop-down list on the page. I want to create a drop down list with the value and the text of this data source

    Hello

    To extract the values you need to wait for onDataLoaded. "data" parameter is a list of cards.

    An example of code for data access :

    http://supportforums.BlackBerry.com/T5/Cascades-development/SQLite-count-query/m-p/2477699#M27180

    http://supportforums.BlackBerry.com/T5/Cascades-development/DataSource-data-in-JavaScript/m-p/244171...

    To add an option to the menu drop-down:

    attachedObjects: [
      ComponentDefinition {
        id: optionFactory
        Option {
        }
      }
    ]
    
    ... to add an option:
    
    var newOption = optionFactory.createObject()
    newOption.text = 'Text to add' // or a variable fetched from data source//newOption.otherfields = ...
    dropdownId.add(newOption);
    
  • EJB WebService to consume a data source

    Hello

    I use JDeveloper 12.1.3.0.

    I have to develop a Web of EJB Service that uses a data source in the WebLogic.

    I googled and looked, but I found no examples / tutorials that explains how it works and how to do it.

    The only examples that I found was by using a direct connection to the database, like this one http://waslleysouza.com.br/en/2014/10/restful-web-service-in-jdeveloper-12c/

    Can you help me?

    Thank you

    Even with respect to MySQL. Add the class name to the following.

    1. in WebLogic Server to set a data source with the name JNDI (jdbc/OracleDS)

    2. in persistence.xml specify the data source as a JTA data source.

    http://www.w3.org/2001/XMLSchema-instance '.

    xsi: schemaLocation =

    'http://java.sun.com/xml/ns/persistence '.

    http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd".

    xmlns ="http://java.sun.com/xml/ns/persistence" version = "1.0" > "

    org.eclipse.persistence.jpa.PersistenceProvider

    JDBC/OracleDS

      name of the class

    />

    value = "create tables" / >

Maybe you are looking for