changeset 441:da332a670378

successful connect to mysql testdb
author catherine@dellzilla
date Mon, 01 Feb 2010 16:32:13 -0500
parents e1a962dd7139
children 5497ae28bc70
files sqlpython/connections.py
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/sqlpython/connections.py	Mon Feb 01 15:56:15 2010 -0500
+++ b/sqlpython/connections.py	Mon Feb 01 16:32:13 2010 -0500
@@ -111,7 +111,7 @@
                             pass
         self.set_corrections()     
         if not self.password:
-            self.password = getpass.getpass()        
+            self.password = getpass.getpass()    
     def parse_connect_uri(self, uri):
         results = self.connection_uri_parser.search(uri)
         if results:
@@ -149,6 +149,7 @@
     def set_defaults(self):
         self.port = self.default_port       
         self.hostname = 'localhost'
+        self.database = os.getenv('USER')
     def connection(self):
         return MySQLdb.connect(host = self.hostname, user = self.username, 
                                 passwd = self.password, db = self.database,
@@ -161,6 +162,7 @@
         self.port = os.getenv('PGPORT') or self.default_port
         self.database = os.getenv('ORACLE_SID')
         self.hostname = os.getenv('PGHOST') or 'localhost'
+        self.username = os.getenv('USER')
     def connection(self):
         return psycopg2.connect(host = self.hostname, user = self.username, 
                                  password = self.password, database = self.database,