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
2,034 views

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,910 points
Thanks Gitika. How about multiple DB's ? What is the approach to connect to multiple databases which are on multiple servers ?

Thanks,

Radhika.

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,270 points
1,591 views
+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
14,789 views
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
556 views
+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,210 points

edited Aug 8, 2018 by Omkar 7,663 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,350 points
1,545 views
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
510 views
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
4,440 views
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,560 points
1,537 views
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,040 points
184,435 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP