[squeak-dev] MySQL question?

John Chludzinski john.chludzinski at gmail.com
Mon Jan 11 20:06:33 UTC 2010


Using MySQL in project and am pretty much repeating this code for every
query:

   spec := (JdmConnectionSpec new initialize
       user: 'root'; password: '...'
       host: (NetNameResolver addressForName: '...'
       database: '...'
       port: ...).
   connection := JdmConnection on: spec.
   statement := connection createStatement.
   sql := 'SELECT * FROM ... WHERE ...'.
   resultSet := statement executeQuery: sql.
                  ...
   connection close.

If I try to construct a different SQL statement and execute "resultSet :=
statement executeQuery: sql." without first executing a "connection close."
then repeating:

   connection := JdmConnection on: spec.
   statement := connection createStatement.
   sql := 'SELECT * FROM ... WHERE ...'.
   resultSet := statement executeQuery: sql.

it fails.  Am I missing something?

---John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20100111/3694f31a/attachment.htm


More information about the Squeak-dev mailing list