From: <yu...@co...> - 2004-10-13 00:49:53
|
Hi, all- A couple of weeks ago I set out to start using Jython for my development. My plan is to convert a suite of Python applications that help manage volunteer fire departments over to Jython because I like the swing library. Tkinter just wears me out. It's good, but I've got too much to do to spend a lot of time fighting syntax. And Jython just feels cool. 'nuff said. I'm developing on Windows XP Home running Jython 2.1 and MySQL and I've had a devil of a time trying to figure out how to connect the two. I did get help from Brian Zimmer, but got side-tracked with my "real" job and 2 funerals in 2 weeks, so here I go again. I pulled up the information from http://www.jython.org/docs/zxjdbc.html and have elected -- mainly because I don't know any better -- to connect via a Driver. Here is the text with my comments in <>'s Using a Driver The most common way to establish a connection is through a Driver. Simply supply the database, username, password and JDBC driver classname to the connect method. If your driver requires special arguments, pass them into the connect method as standard Python keyword arguments. You will be returned a connection object. <O.K. That sounds cool to me!> Jython 2.1b1 on java1.4.0-beta3 (JIT: null) Type "copyright", "credits" or "license" for more information. >>> from com.ziclix.python.sql import zxJDBC <I can do this in the interactive Jython shell, so I figure I have the driver.> >>> d, u, p, v = "jdbc:mysql://localhost/test", None, None, "org.gjt.mm.mysql.Driver" <Here's where you can help me out. d = database, u = user, p = password and v = driver? On windows, would I set the first to "jdbc:mysql:C:\\mysql\\data\\test". The user and password I can figure out, but don't have a clue as to what "v" is and what to set it to (I've tried leaving it as is, but don't know what it's function is)> >>> db = zxJDBC.connect(d, u, p, v) optionally >>> db = zxJDBC.connect(d, u, p, v, CHARSET='iso_1') <I think I'm O.K. if I can get to this point. I've been coding in Python for 5 years almost full-time, and SQL for longer than that. I've noticed that this topic has been on the mailing list a few times over the past couple of years, and pledge to write a "how-to" for newbies once I get it figured out. Thanks so much for your help.> Greg Lindstrom Python, and now Jython, Developer Conway, Arkansas ----------------------------------------------------------------------------- This message was sent using Conway Corporation WebMail -- www.conwaycorp.net |