Talk:How a client side script can connect to MySQL - Ex. Java Applet

From DreamHost

Jump to: navigation, search

This is doable in Python. The MySQLdb module must be installed (ubuntu is just 'sudo apt-get install python-mysqldb'). Also, you must modify your MySQL user (from the panel) to allow access from your hostname (my IP didn't work, but %.bellsouth.net did). Lastly, the MySQLdb module doesn't conform entirely to the Python database API specification, so be sure to read through MySQLdb's docs to see the differences. From there, it's pretty simple.

Here's an example:

import MySQLdb
connectionobject=MySQLdb.connect(user="your_mysql_username",passwd="your_mysql_password",host="database_hostname",db="your_database")
connectionobject.whatever()

I've never worked with databases before, so I don't know what the code would be for actually accessing the database once the connection is up, but the above should work for the connection at least. --AdamG 15:35, 26 Aug 2006 (PDT)

Personal tools