I would like to connect to multiple databases in oracle

0 votes
How can I connect to multiple database in oracle using python library ?
Feb 16, 2020 in Python by Radhika
• 120 points

1 answer to this question.

0 votes

Hey Radhika,

To communicate any database with Python program, you required a connector which is nothing but the cx_Oracle module.

  • To installing cx_Oracle : 
  1. With this command, you can install the cx_Oracle package, but it is required to install the Oracle database first in your PC..
pip install cx_Oracle
  • Now you need to use some modules for connection:
  1. Import specific database module- import cx_Oracle
  2. Connect()  :- Now establish a connection between the Python program and the Oracle database by using connect() function.​
                  connect = cx_Oracle.connect('username/password@localhost')

       3. Cursor(): To execute SQL query and to provide a result, some special object required is nothing but cursor() object

                  cursor = cx_Oracle.cursor()

For more and clear cut information you can go through this https://datatofish.com/how-to-connect-python-to-an-oracle-database-using-cx_oracle/ I hope this will help.

answered Feb 17, 2020 by Gitika
• 65,970 points
Thanks Gitika. How about multiple DB's ? What is the approach to connect to multiple databases which are on multiple servers ?



Related Questions In Python

0 votes
2 answers

How do I connect to a MySQL Database in Python?

connect mysql database with python import MySQLdb db = ...READ MORE

answered Mar 28, 2019 in Python by rajesh
• 1,230 points
+3 votes
5 answers

How to read multiple data files in python

Firstly we will import pandas to read ...READ MORE

answered Apr 6, 2018 in Python by DeepCoder786
• 1,720 points
0 votes
1 answer

Connect to a MySQL DB in python?

db = MySQLdb.connect(host="localhost", # ...READ MORE

answered Jul 20, 2018 in Python by Nietzsche's daemon
• 4,260 points
+3 votes
2 answers

how to print array integer without [] bracket in python like result = 1,2,3,4,5

Hey @abhijmr.143, you can print array integers ...READ MORE

answered Aug 5, 2018 in Python by Omkar
• 69,170 points

edited Aug 8, 2018 by Omkar 6,212 views
+7 votes
2 answers

I want to build a recommender system incorporating diversity and accuracy in the recommender engine.

I dont know what exactly you are ...READ MORE

answered Sep 24, 2018 in Python by slayer
• 29,310 points
0 votes
1 answer

How do I append one string to another in Python?

If you only have one reference to ...READ MORE

answered Oct 22, 2018 in Python by SDeb
• 13,300 points
0 votes
2 answers

How can I rename multiple files in a certain directory using Python?

import os from optparse import OptionParser, Option class MyOption ...READ MORE

answered Jul 29, 2020 in Python by The real slim shady
0 votes
1 answer

Question on PyQt: How to connect a signal to a slot to start a background operation in Python

It shouldn't matter whether the connection is ...READ MORE

answered Nov 27, 2018 in Python by Nymeria
• 3,540 points
0 votes
4 answers

how to sort a list of numbers without using built-in functions like min, max or any other function?

Yes it is possible. You can refer ...READ MORE

answered Jun 27, 2019 in Python by Arvind
• 3,020 points