says could not find driver. we are using the demo version and would like to purchase the plugin if it can connect to our db.
]]>I have an mssql server connecteced and all fields mapped successfully with External Login.
]]>I am trying to build a web app where users can input a docket no./ consignment tracking no. and get an estimated time of arrival (ETA) on the website for their consignment. The ETA and other details of the consignment are on a MSSQL database hosted on AWS.
To fetch the result on the page, I have written some PHP code on a wordpress page but get the error that I don’t have the necessary driver installed. The code is as follows:
<?php
$servername = "xx.xxx.xx.xx,port";
$username = "xxx";
$password = "yyy";
try {
$conn = new PDO("mssql:host=$servername;dbname=OurDBName", $username, $password);
// set the PDO error mode to exception
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
echo "Connected successfully";
}
catch(PDOException $e)
{
echo "Connection failed: " . $e->getMessage();
}
?>
I understand from some research that I need to install a PDO driver for MSSQL in php. However, I do not understand where this would go, given that I made and ran my website from WordPress. I know goDaddy uses phpmyAdmin and I can access that but do not know ay further. Could you help?
Thank you in advance.
]]>Current Code:
if ($dbType == "mssql") {
$query_string =
'SELECT *' .
' FROM ' . esc_sql($db_data["dbstructure_table"]) .
' WHERE ' . esc_sql($db_data["dbstructure_username"]) . '=\'' . esc_sql($username) . '\'';
$stmt = sqlsrv_query($db_data["db_instance"], $query_string);
if (sqlsrv_has_rows($stmt) != true) {
return array("valid" => false);
}
while( $userData = sqlsrv_fetch_array($stmt)) {
$user_specific_salt = false;
if (exlog_get_option('external_login_option_db_salting_method') == 'all') {
$user_specific_salt = $userData[$db_data["dbstructure_salt"]];
}
$valid_credentials = exlog_validate_password($password, $userData[$db_data["dbstructure_password"]], $user_specific_salt);
if ($valid_credentials) {
$wp_user_data = exlog_build_wp_user_data($db_data, $userData);
$wp_user_data["exlog_authenticated"] = true;
return $wp_user_data;
}
}
return array("valid" => false);
}
My quick and dirty solution:
if ($dbType == "mssql") {
$query_string =
'SELECT *' .
' FROM ' . esc_sql($db_data["dbstructure_table"]) .
' WHERE ' . esc_sql($db_data["dbstructure_username"]) . '=\'' . esc_sql($username) . '\'';
$stmt = sqlsrv_query($db_data["db_instance"], $query_string);
if (sqlsrv_has_rows($stmt) != true) {
return array("valid" => false);
}
while( $userData = sqlsrv_fetch_array($stmt)) {
$user_specific_salt = false;
if (exlog_get_option('external_login_option_db_salting_method') == 'all') {
$user_specific_salt = $userData[$db_data["dbstructure_salt"]];
}
if ($userData) {
$user_specific_salt = false;
if (exlog_get_option('external_login_option_db_salting_method') == 'all') {
$user_specific_salt = $userData[$db_data["dbstructure_salt"]];
}
$hashFromDatabase = $userData[$db_data["dbstructure_password"]];
if (has_filter(EXLOG_HOOK_FILTER_AUTHENTICATE_HASH)) {
$valid_credentials = apply_filters(
EXLOG_HOOK_FILTER_AUTHENTICATE_HASH,
$password,
$hashFromDatabase,
$username,
$userData
);
} else {
$valid_credentials = exlog_validate_password($password, $hashFromDatabase, $user_specific_salt);
}
if ($valid_credentials) {
$wp_user_data = exlog_build_wp_user_data($db_data, $userData);
$wp_user_data["exlog_authenticated"] = true;
return $wp_user_data;
} else {
$user_data["exlog_authenticated"] = false;
return $userData;
}
} else {
return false;
}
$valid_credentials = exlog_validate_password($password, $userData[$db_data["dbstructure_password"]], $user_specific_salt);
if ($valid_credentials) {
$wp_user_data = exlog_build_wp_user_data($db_data, $userData);
$wp_user_data["exlog_authenticated"] = true;
return $wp_user_data;
}
}
return array("valid" => false);
}
I would love to see a version of the plugin updated to check for the exlog_hook_filter_authenticate_hash filter when using Microsoft SQL Server.
Thanks for the great plugin,
Brad
What I am trying to do is pull the products from our point of sale system (which uses Microsoft SQL Server) and display them on my online store (which is WordPress so it uses MySQL obviously) so that the two are always in sync (such as product titles, prices, stock quantity, etc.)
I don’t think it’s possible to pull it directly from the Microsoft SQL Server database since WordPress probably won’t understand it. I was considering developing an API that could convert the Microsoft SQL Server to MySQL and then use that database for my site. Is this even possible?
And once I get the converted MySQL database, how do I connect my site to it and pull my products from there?
I know that products are stored in the table wp_posts
but that seems to be a very complicated table. I need the table to have simple columns such as title, price, image link, quantity, etc.
I appreciate anyone’s help.
]]>My back ground is networking and server admin.
Is there a plug in can connect to MSSQL database over the internet to do report building in WordPress theme?
What I mean is plugin grab MSSQL database’s table to perform reports showing on WordPress website?
I can create a secure tunnel between WordPress server and SQL server so there is no issue with security.
]]>I installed sqlsrv and pdo extensions on my server, but can’t get this to work, so it’s time to ask the basic question – is this plugin compatible with MSSQL?
Thank you in advance for any response.
]]>The information about employes are on external MicrosoftSQL database.
How can I display data(tables,views) from external MicrosoftSQL database to WordPress page?
How I can connect to that separate server and query tables,views etc?
Best regards
ROxettero
]]>Not sure if this is the right forum?
[ Moderator note: moved to Fixing WordPress. ]
I am about to develop a new website for a client using a WP theme (not selected yet).
There is a legacy website which will eventually be replaced, hosted on HostDepot.
The hosting package at present is Windows based and part of the options is an MSSQL database.
The MSSQL database runs on a separate server to the website. It is connected via the client database application for syncing using adodb. It is connected from the website using classic asp ADODB connection.
I am unsure how to read the database using WordPress which, presumably, should be Linux based. The Linux based package option does not offer an MSSQL database.
To continue to use the MSSQL database would we have to keep the Windows subscription? Will it be necessary to have two hosting packages, one Windows, one Windows? If so, how would the two services interconnect?
Any advice will be appreciated.
Thank you.
]]>