21 lines
478 B
Python
21 lines
478 B
Python
import psycopg2
|
|
from pymongo import MongoClient
|
|
|
|
|
|
def get_database():
|
|
client = MongoClient("mongodb://root:password@localhost:27017")
|
|
return client['documents']
|
|
|
|
|
|
if __name__ == "__main__":
|
|
dbname = get_database()
|
|
print(dbname['docs'].find_one())
|
|
conn = psycopg2.connect(
|
|
host="localhost",
|
|
database="bd2",
|
|
user="root",
|
|
password="password")
|
|
cur = conn.cursor()
|
|
cur.execute('SELECT version()')
|
|
print(cur.fetchone())
|