Solved

Drupal Module for Interacting with Second Database?

Posted on 2014-09-11
1
197 Views
Last Modified: 2014-09-29
Our Drupal site is to leverage data from a second MySQL database. The conneciton is already in place in settings.php

I'm wondering now if there is a module I can use to interact with it (select, update, etc). Or at least what's the best practice working with SQL queries - GUI with a module, or code?

One goal is to display the results on screen, and allow the User to filter rows and columns.
0
Comment
Question by:sandshakimi
1 Comment
 
LVL 13

Accepted Solution

by:
Arrow_1 earned 500 total points
ID: 40317523
I'm not aware of a specific module that helps you work with multiple databases, but you can certainly access and manipulate that data within your own module using the Drupal's Database API.

This Stack Exchange question addresses accessing the second database.

You can also leverage the Views module for building queries and displaying/filtering content.

This article explains how to build a module that exposes your second database to the Views module. In his example, he uses the hook_views_data() function to describe the database schema to Views. That function is documented here and includes some examples on how to use it. Here are some more Views API references:
https://api.drupal.org/api/views
https://api.drupal.org/api/views/views.api.php/7
https://api.drupal.org/api/views/includes!view.inc/class/view/7
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question