Difference between revisions of "Relational and non-relational databases"

From Gridkaschool
Line 1: Line 1:
  +
<pre>
 
import sqlite3
 
import sqlite3
 
import MySQLdb
 
import MySQLdb
Line 4: Line 5:
 
 
 
 
s_con = sqlite3.connect(database='/home/username/student.db')
+
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()
+
p_con.close() </pre>
  +
 
 
   

Revision as of 14:12, 27 August 2013

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()                                                                                                                                                                  


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