Relational and non-relational databases: Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
<verbatim> |
|||
import sqlite3 |
import sqlite3 |
||
import MySQLdb |
import MySQLdb |
||
Line 4: | Line 5: | ||
s_con = sqlite3.connect(database='/ |
s_con = sqlite3.connect(database='/tmp/student.db') |
||
m_con = MySQLdb.connect(host='localhost', user='student', passwd='student', db='student', ) |
m_con = MySQLdb.connect(host='localhost', user='student', passwd='student', db='student', ) |
||
Line 12: | Line 13: | ||
s_con.close() |
s_con.close() |
||
m_con.close() |
m_con.close() |
||
⚫ | |||
p_con.close() |
|||
</verbatim> |
|||
⚫ | |||
Revision as of 14:04, 27 August 2013
<verbatim> import sqlite3 import MySQLdb import psycopg2
s_con = sqlite3.connect(database='/tmp/student.db')
m_con = MySQLdb.connect(host='localhost', user='student', passwd='student', db='student', )
p_con = psycopg2.connect('host=localhost user=student password=student dbname=student')
s_con.close() m_con.close() p_con.close() </verbatim>
CREATE TABLE test_table (id integer, name varchar(255));
Hosts:
ssh <username>@<host>.scc.kit.edu -p24
- gks-148
- gks-149
- gks-150
- gks-151
- gks-152
- gks-153
- gks-154
- gks-155
- gks-156
- gks-157
- gks-158
- gks-159
- gks-160
- gks-161
- gks-162
- gks-163
- gks-164
- gks-165
- gks-166
- gks-167
- gks-168
- gks-169
- gks-170
- gks-171
- gks-172
- gks-173
- gks-174