Can I use a wpdb object to connect to a non-Wordpress Oracle database

This question already has answers here:Connecting to external oracle database(2 answers)Closed 5 years ago.I simply have

This question already has answers here: Connecting to external oracle database (2 answers) Closed 5 years ago.

I simply have a quick question. I've found information related to this, but I'm not completely sure if this is possible. I know that I can create a second database connection using the wpdb object as follows:

$new_db = new wpdb(usr, pw, name, host);

However, is this compatible with an Oracle database that wouldn't have any of the Wordpress tables?

This question already has answers here: Connecting to external oracle database (2 answers) Closed 5 years ago.

I simply have a quick question. I've found information related to this, but I'm not completely sure if this is possible. I know that I can create a second database connection using the wpdb object as follows:

$new_db = new wpdb(usr, pw, name, host);

However, is this compatible with an Oracle database that wouldn't have any of the Wordpress tables?

Share Improve this question asked Jun 11, 2019 at 19:07 EliEli 691 gold badge2 silver badges10 bronze badges 0
Add a comment  | 

2 Answers 2

Reset to default 0

This should be possible. You can try

    function seconddb() {
         global $seconddb;
         $seconddb = new wpdb('Username','password','database name','localhost')
     }
     add_action('init','seconddb');

in your functions.php. Then you can fire a query to the new db like
$seconddb->get_row( "SELECT * FROM yourtable..." ); instead of $wpdb->get_row().

Although this got asked some time ago, it came time to actually implement this and ran into issues (see: Connecting to external oracle database)

The answer is no. Oracle is not a mysql based database, thus wordpress will not be able to connect to it via wpdb.

For more information see the linked post.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745370685a4624780.html

相关推荐

  • Can I use a wpdb object to connect to a non-Wordpress Oracle database

    This question already has answers here:Connecting to external oracle database(2 answers)Closed 5 years ago.I simply have

    12小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信