Extension talk:External Data/Archive 2017 to 2018

Empty password not allowed – bug or feature?
I am using External Data to query MySQL database with passwordless read permission. I have noticed that supplying empty password in the configuration results in  being raised. However, I can get around by patching the ED_Utils.php (diff attached):

but that's not the way I would like to do it. I would like to know whether it's a bug or if there is any rationale behind asking non-empty password as open databases often provide passwordless access? Powermelon (talk) 10:56, 5 January 2015 (UTC)


 * Ah, good point; that was indeed a bug. I just checked in the change you suggested. Yaron Koren (talk) 17:14, 5 January 2015 (UTC)


 * Thank you very much! Powermelon (talk) 10:44, 6 January 2015 (UTC)

#get_db_data: stored procedure
Hi Guys,

I am using #get_db_data a lot on my internal Wiki and wonder whether #get_db_data can call a stored procedure in a SQL database? If yes, what would be the syntax for that?

Many thanks, Reiner


 * I don't think that's possible, unfortunately. If you're using MySQL, you might be able to create a "view" instead, and query on that - it can be queried like a regular DB table. Yaron Koren (talk) 18:32, 29 January 2015 (UTC)

Cannot connect to sqlite database
Hey all, some assistance on troubleshooting this would be appreciated. No matter how simple of a query I try, the page comes back with a 'Cannot contact the database server' error. This is what we have in settings: include_once "$IP/extensions/ExternalData/ExternalData.php"; $edgDBServerType['gameDB'] = "sqlite"; $edgDBDirectory['gameDB'] = "/public_html/repopnation.com/wiki/extensions"; $edgDBName['gameDB'] = "repopdata"; Is there somewhere I can go for more detailed logs? I've been assured that the file exists in that directory (with .sqlite extension), and the appropriate r/w permissions are on it. What else is there to check? Thanks, Echelar (talk) 20:55, 2 February 2015 (UTC)


 * I don't know; I've never actually connected to SQLite. Maybe someone else can help. Yaron Koren (talk) 21:27, 2 February 2015 (UTC)

Undefined index: ... ED_ParserFunctions.php on line 494
I keep getting error messages like: And it seems this is a timing / race condition issue. If I create a template in which I define #get_db_data and #display_external_table calls like this: Then I can't submit this wikitemplate in one step. The order: works. So when editing this I need to comment out the call to the template again to avoid the probably buggy notice error message. Very strange and would be nice if this would be fixed. --WolfgangFahl (talk) 12:48, 4 February 2015 (UTC)
 * 1) define #get_db_data
 * 2) define #display_external_table
 * 3) then add example call in

Notice: Undefined index: odbc in D:\xampp\htdocs\SNWiki\includes\db\Database.php on line 915
I Configured External Data and ODBC For Get Data from SQL Server When Show a Record I am getting Error

Notice: Undefined index: odbc in D:\xampp\htdocs\SNWiki\includes\db\Database.php on line 915

But SQL Server Connection was fine because when i am give a wrong table i am getting error like invalid table name but when typing correct table i am getting only Notice: Undefined index: odbc in D:\xampp\htdocs\SNWiki\includes\db\Database.php on line 915

plese do the needful

Ragu


 * Sorry, I don't know. What version of MediaWiki are you using, and what's on that line in that file? Yaron Koren (talk) 14:22, 12 February 2015 (UTC)


 * Thanks for your Reply Yaron Koren.

I am Using MediaWiki 1.24

for getting sql server am data adding

require_once "$IP/extensions/OdbcDatabase/OdbcDatabase.php"; include_once "$IP/extensions/ExternalData/ExternalData.php";

$edgDBServerType ['mydb'] = "odbc"; $edgDBServer     ['mydb'] = "my_dsn"; $edgDBName       ['mydb'] = "UNUSED"; $edgDBUser       ['mydb'] = "sa"; $edgDBPass       ['mydb'] = "sa@123"; $edgDBTablePrefix ['mydb'] = "dbo";

and i created my_dsn odbc in my windows wiki server in wiki page

now submit the page i got a below error message on top of the page

Undefined index: odbc in D:\xampp\htdocs\SNWiki\includes\db\Database.php on line 915

In Database.php the line 915 is below bold line

if ( class_exists( $class ) && is_subclass_of( $class, 'DatabaseBase' ) ) {

$params = array(

'host' => isset( $p['host'] ) ? $p['host'] : false,

'user' => isset( $p['user'] ) ? $p['user'] : false,

'password' => isset( $p['password'] ) ? $p['password'] : false,

'dbname' => isset( $p['dbname'] ) ? $p['dbname'] : false,

'flags' => isset( $p['flags'] ) ? $p['flags'] : 0,

'tablePrefix' => isset( $p['tablePrefix'] ) ? $p['tablePrefix'] : 'get from global',

schema' => isset( $p['schema'] ) ? $p['schema'] : $defaultSchemas[$dbType],'''

'foreign' => isset( $p['foreign'] ) ? $p['foreign'] : false

);

If i type wrong table name in wiki page it showing Below Errors

Notice: Undefined index: odbc in D:\xampp\htdocs\SNWiki\includes\db\Database.php on line 915

Warning: odbc_exec: SQL error: [Microsoft][SQL Server Native Client 10.0][SQL Server]Invalid object name 'Testtable1'., SQL state S0002 in SQLExecDirect in D:\xampp\htdocs\SNWiki\extensions\OdbcDatabase\OdbcDatabase.body.php on line 26

so i think connectivity is not a problem.

Kindly Help me

-- Ragu


 * That's a lot of information! Well, my guess is that this is an issue with the OdbcDatabase extension - that it needs to be updated for use with MW 1.24. I would suggest contacting the author of that extension. Yaron Koren (talk) 14:09, 13 February 2015 (UTC)

Retrieves nested variable before primary
Hi,

I'm trying to receive data from this URL, which lists data in JSON. However, whenever I try to retrieve "name", I get "chlorophyll" returned, not "bulbasaur". The top-level "name" is "bulbasaur", while "chlorophyll" is inside "abilities". How would I say I want to top-level instead of the first found?--Immewnity (talk) 17:18, 19 February 2015 (UTC)

Here's what I've got right now:


 * I don't think it's possible, unfortunately. If this were XML, I'd recommend using the XPath option; there is a comparable thing known as JSONPath, but it's poorly supported and External Data doesn't handle it. The only solution I can think of is to create some sort of web-based script that reads and parses that other URL, then displays only the relevant information in a format that External Data can then in turn read from. Yaron Koren (talk) 18:48, 19 February 2015 (UTC)

Difficulty recognizing MongoDB
Hello, I'm trying to use this extension with a local instance of MongoDB, still testing it and am getting an "Error: Unknown Database Type" aka externaldata-db-unknown-type error. Here's the config I placed into LocalSettings.php:

$edgDBServer['foo-db'] = "127.0.0.1"; $edgDBServerType['foo-db'] = "mongodb"; $edgDBName['foo-db'] = "foo"; $edgDBUser['foo-db'] = "foo"; $edgDBPass['foo-db'] = "foobar";

I then restarted the apache service and created a test page with the following:

The error manifests itself as:

&lt;p&gt;Error: Unknown database type. &lt;/p&gt;

as the first line of HTML when viewing the source of my test page. I reviewed the code in ED_Utils.php @ https://github.com/wikimedia/mediawiki-extensions-ExternalData and it looks like this error only triggers when  - any idea why this is happening? Do I have to do something else besides restart apache for the new LocalSettings.php configuration to take effect?


 * First, you definitely don't need to restart Apache for the settings to take effect (actually, I don't think you need to restart Apache for anything MediaWiki-related). So - this is very odd; the code shouldn't even be reaching that line, because there's a check for "mongodb", with special handling, about 60 lines earlier in the code. Could it be that you have those settings in LocalSettings.php before the inclusion of External Data? They need to come after. Yaron Koren (talk) 03:09, 20 February 2015 (UTC)