From: Alfonso R. <ms...@re...> - 2007-10-20 18:55:59
|
The following is another basic example that illustrates the use of a SQLite driver for Java. Python already enjoys of a package for SQLite called pysqlite but unfortunately is not callable from Jython. I am attaching the SQLite database alpha.db that is part of the example. References: sqliteJDBC: http://www.zentus.com/sqlitejdbc/ http://www.zentus.com/sqlitejdbc/ Tutorial: http://www.pysquared.com/files/Java/JavaSQLiteExample/ http://www.pysquared.com/files/Java/JavaSQLiteExample/ Add to classpath or /jre/lib/ext: sqlitejdbc-v037-nested.jar Sample Code: from java.sql import DriverManager from java.sql import SQLException from java.lang import Class import sys class SQLiteDB: def __init__(self): self.database = "alpha.db" driver = "org.sqlite.JDBC" self.url = "jdbc:sqlite:" + self.database Class.forName(driver); def open(self): try: self.db = DriverManager.getConnection(self.url); stat1 = self.db.createStatement() print self.db except SQLException, e: print e.message print "cannot create connection with current driver" print "revise url and try again. Will exit application ..." sys.exit() def view(self): try: stmt = self.db.createStatement(); rs = stmt.executeQuery("SELECT * FROM letters ORDER BY ID"); while (rs.next()): id = rs.getString("ID"); # Column 1 letter = rs.getString("letter"); # Column 2 name = rs.getString("name"); # Column 3 cat = rs.getString("categoryID"); # Column 4 print "ID:", id, "Code:", letter, "Name:", name, "\tCategory:", cat except SQLException, e: print e.message print "cannot open table" def close(self): self.db.close(); if __name__ == '__main__': app = SQLiteDB() app.open() app.view() app.close() http://www.nabble.com/file/p13322270/alpha.db alpha.db Cheers! Alfonso Reyes -- View this message in context: http://www.nabble.com/SQLite-%2B-JDBC-%2B-Jython.-Example-tf4663619.html#a13322270 Sent from the jython-users mailing list archive at Nabble.com. |
From: Charlie G. <cha...@gm...> - 2007-10-20 22:19:08
|
Hi Alfonso, It appears whatever Nabble is doing to format these when you're posting them is lost when they're sent on to the mailing list. The code is a single block for me instead of multiple correctly indented lines, and I imagine most people are seeing the same thing. It'd probably be better to add things like these to the examples section on http://wiki.python.org/jython/DocumentationAndEducation anyway since they can be kept up to date or improved there. Charlie On 10/20/07, Alfonso Reyes <ms...@re...> wrote: > The following is another basic example that illustrates the use of a SQLite > driver for Java. Python already enjoys of a package for SQLite called > pysqlite but unfortunately is not callable from Jython. I am attaching the > SQLite database alpha.db that is part of the example. > > References: > sqliteJDBC: http://www.zentus.com/sqlitejdbc/ > Tutorial: > http://www.pysquared.com/files/Java/JavaSQLiteExample/ > > Add to classpath or /jre/lib/ext: > sqlitejdbc-v037-nested.jar > > Sample Code: from java.sql import DriverManager from java.sql import > SQLException from java.lang import Class import sys class SQLiteDB: def > __init__(self): self.database = "alpha.db" driver = "org.sqlite.JDBC" > self.url = "jdbc:sqlite:" + self.database Class.forName(driver); def > open(self): try: self.db = DriverManager.getConnection(self.url); stat1 = > self.db.createStatement() print self.db except SQLException, e: print > e.message print "cannot create connection with current driver" print "revise > url and try again. Will exit application ..." sys.exit() def view(self): > try: stmt = self.db.createStatement(); rs = stmt.executeQuery("SELECT * FROM > letters ORDER BY ID"); while (rs.next()): id = rs.getString("ID"); # Column > 1 letter = rs.getString("letter"); # Column 2 name = rs.getString("name"); # > Column 3 cat = rs.getString("categoryID"); # Column 4 print "ID:", id, > "Code:", letter, "Name:", name, "\tCategory:", cat except SQLException, e: > print e.message print "cannot open table" def close(self): self.db.close(); > if __name__ == '__main__': app = SQLiteDB() app.open() app.view() > app.close() alpha.db > > Cheers! > Alfonso Reyes > ________________________________ > View this message in context: SQLite + JDBC + Jython. Example > Sent from the jython-users mailing list archive at Nabble.com. > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users > > |
From: Brent P. <bpe...@gm...> - 2007-10-20 22:29:28
|
hi, i have the same prob with formatting through gmail, but with "view original", it is possible to see the format intended (== indented). even if they appear on the wiki, i for one would like to see them on the mailing list as well. they've been very helpful for me. -brent On 10/20/07, Charlie Groves <cha...@gm...> wrote: > Hi Alfonso, > > It appears whatever Nabble is doing to format these when you're > posting them is lost when they're sent on to the mailing list. The > code is a single block for me instead of multiple correctly indented > lines, and I imagine most people are seeing the same thing. It'd > probably be better to add things like these to the examples section on > http://wiki.python.org/jython/DocumentationAndEducation anyway since > they can be kept up to date or improved there. > > Charlie > > On 10/20/07, Alfonso Reyes <ms...@re...> wrote: > > The following is another basic example that illustrates the use of a SQLite > > driver for Java. Python already enjoys of a package for SQLite called > > pysqlite but unfortunately is not callable from Jython. I am attaching the > > SQLite database alpha.db that is part of the example. > > > > References: > > sqliteJDBC: http://www.zentus.com/sqlitejdbc/ > > Tutorial: > > http://www.pysquared.com/files/Java/JavaSQLiteExample/ > > > > Add to classpath or /jre/lib/ext: > > sqlitejdbc-v037-nested.jar > > > > Sample Code: from java.sql import DriverManager from java.sql import > > SQLException from java.lang import Class import sys class SQLiteDB: def > > __init__(self): self.database = "alpha.db" driver = "org.sqlite.JDBC" > > self.url = "jdbc:sqlite:" + self.database Class.forName(driver); def > > open(self): try: self.db = DriverManager.getConnection(self.url); stat1 = > > self.db.createStatement() print self.db except SQLException, e: print > > e.message print "cannot create connection with current driver" print "revise > > url and try again. Will exit application ..." sys.exit() def view(self): > > try: stmt = self.db.createStatement(); rs = stmt.executeQuery("SELECT * FROM > > letters ORDER BY ID"); while (rs.next()): id = rs.getString("ID"); # Column > > 1 letter = rs.getString("letter"); # Column 2 name = rs.getString("name"); # > > Column 3 cat = rs.getString("categoryID"); # Column 4 print "ID:", id, > > "Code:", letter, "Name:", name, "\tCategory:", cat except SQLException, e: > > print e.message print "cannot open table" def close(self): self.db.close(); > > if __name__ == '__main__': app = SQLiteDB() app.open() app.view() > > app.close() alpha.db > > > > Cheers! > > Alfonso Reyes > > ________________________________ > > View this message in context: SQLite + JDBC + Jython. Example > > Sent from the jython-users mailing list archive at Nabble.com. > > > > ------------------------------------------------------------------------- > > This SF.net email is sponsored by: Splunk Inc. > > Still grepping through log files to find problems? Stop. > > Now Search log events and configuration files using AJAX and a browser. > > Download your FREE copy of Splunk now >> http://get.splunk.com/ > > _______________________________________________ > > Jython-users mailing list > > Jyt...@li... > > https://lists.sourceforge.net/lists/listinfo/jython-users > > > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users > |
From: Michael C. <chi...@mi...> - 2007-10-22 16:36:28
|
Fyi, the emails are coming through fine for me; I am using Thunderbird 2.0.0.6. I believe Thunderbird is showing the HTML version. The code block appears to be surrounded by <xmp> tags, which are deprecated, so that's the likely problem. Whatever's composing the HTML is using outdated tags. Andy Charlie Groves wrote: > Hi Alfonso, > > It appears whatever Nabble is doing to format these when you're > posting them is lost when they're sent on to the mailing list. The > code is a single block for me instead of multiple correctly indented > lines, and I imagine most people are seeing the same thing. It'd > probably be better to add things like these to the examples section on > http://wiki.python.org/jython/DocumentationAndEducation anyway since > they can be kept up to date or improved there. > > Charlie > > On 10/20/07, Alfonso Reyes <ms...@re...> wrote: > >> The following is another basic example that illustrates the use of a SQLite >> driver for Java. Python already enjoys of a package for SQLite called >> pysqlite but unfortunately is not callable from Jython. I am attaching the >> SQLite database alpha.db that is part of the example. >> >> References: >> sqliteJDBC: http://www.zentus.com/sqlitejdbc/ >> Tutorial: >> http://www.pysquared.com/files/Java/JavaSQLiteExample/ >> >> Add to classpath or /jre/lib/ext: >> sqlitejdbc-v037-nested.jar >> >> Sample Code: from java.sql import DriverManager from java.sql import >> SQLException from java.lang import Class import sys class SQLiteDB: def >> __init__(self): self.database = "alpha.db" driver = "org.sqlite.JDBC" >> self.url = "jdbc:sqlite:" + self.database Class.forName(driver); def >> open(self): try: self.db = DriverManager.getConnection(self.url); stat1 = >> self.db.createStatement() print self.db except SQLException, e: print >> e.message print "cannot create connection with current driver" print "revise >> url and try again. Will exit application ..." sys.exit() def view(self): >> try: stmt = self.db.createStatement(); rs = stmt.executeQuery("SELECT * FROM >> letters ORDER BY ID"); while (rs.next()): id = rs.getString("ID"); # Column >> 1 letter = rs.getString("letter"); # Column 2 name = rs.getString("name"); # >> Column 3 cat = rs.getString("categoryID"); # Column 4 print "ID:", id, >> "Code:", letter, "Name:", name, "\tCategory:", cat except SQLException, e: >> print e.message print "cannot open table" def close(self): self.db.close(); >> if __name__ == '__main__': app = SQLiteDB() app.open() app.view() >> app.close() alpha.db >> >> Cheers! >> Alfonso Reyes >> ________________________________ >> View this message in context: SQLite + JDBC + Jython. Example >> Sent from the jython-users mailing list archive at Nabble.com. >> >> ------------------------------------------------------------------------- >> This SF.net email is sponsored by: Splunk Inc. >> Still grepping through log files to find problems? Stop. >> Now Search log events and configuration files using AJAX and a browser. >> Download your FREE copy of Splunk now >> http://get.splunk.com/ >> _______________________________________________ >> Jython-users mailing list >> Jyt...@li... >> https://lists.sourceforge.net/lists/listinfo/jython-users >> >> >> > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users > > |
From: Moore, G. <Gre...@ad...> - 2007-10-24 18:15:18
|
Just a quick note. Alfonso, I've already moved some of your examples to the http://wiki.python.org/jython/DocumentationAndEducation section of the wiki. I've mentioned that you were the one that posted them to the ML. As Charlie suggested if you could post your examples to the wiki and maybe an announcement here that would be great. I think your examples are helpful and hope you continue. Regards, Greg. -----Original Message----- From: jyt...@li... [mailto:jyt...@li...] On Behalf Of Charlie Groves Sent: Saturday, October 20, 2007 3:19 PM To: Alfonso Reyes Cc: jyt...@li... Subject: Re: [Jython-users] SQLite + JDBC + Jython. Example Hi Alfonso, It appears whatever Nabble is doing to format these when you're posting them is lost when they're sent on to the mailing list. The code is a single block for me instead of multiple correctly indented lines, and I imagine most people are seeing the same thing. It'd probably be better to add things like these to the examples section on http://wiki.python.org/jython/DocumentationAndEducation anyway since they can be kept up to date or improved there. Charlie On 10/20/07, Alfonso Reyes <ms...@re...> wrote: > The following is another basic example that illustrates the use of a SQLite > driver for Java. Python already enjoys of a package for SQLite called > pysqlite but unfortunately is not callable from Jython. I am attaching the > SQLite database alpha.db that is part of the example. > > References: > sqliteJDBC: http://www.zentus.com/sqlitejdbc/ > Tutorial: > http://www.pysquared.com/files/Java/JavaSQLiteExample/ > > Add to classpath or /jre/lib/ext: > sqlitejdbc-v037-nested.jar > > Sample Code: from java.sql import DriverManager from java.sql import > SQLException from java.lang import Class import sys class SQLiteDB: def > __init__(self): self.database =3D "alpha.db" driver =3D "org.sqlite.JDB= C" > self.url =3D "jdbc:sqlite:" + self.database Class.forName(driver); def > open(self): try: self.db =3D DriverManager.getConnection(self.url); stat1 =3D > self.db.createStatement() print self.db except SQLException, e: print > e.message print "cannot create connection with current driver" print "revise > url and try again. Will exit application ..." sys.exit() def view(self): > try: stmt =3D self.db.createStatement(); rs =3D stmt.executeQuery("SELE= CT * FROM > letters ORDER BY ID"); while (rs.next()): id =3D rs.getString("ID"); # Column > 1 letter =3D rs.getString("letter"); # Column 2 name =3D rs.getString("name"); # > Column 3 cat =3D rs.getString("categoryID"); # Column 4 print "ID:", id= , > "Code:", letter, "Name:", name, "\tCategory:", cat except SQLException, e: > print e.message print "cannot open table" def close(self): self.db.close(); > if __name__ =3D=3D '__main__': app =3D SQLiteDB() app.open() app.view() > app.close() alpha.db > > Cheers! > Alfonso Reyes > ________________________________ > View this message in context: SQLite + JDBC + Jython. Example > Sent from the jython-users mailing list archive at Nabble.com. > > ------------------------------------------------------------------------ - > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users > > ------------------------------------------------------------------------ - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Jython-users mailing list Jyt...@li... https://lists.sourceforge.net/lists/listinfo/jython-users This message and any attachments are intended only for the use of the add= ressee and may contain information that is privileged and confidential. I= f the reader of the message is not the intended recipient or an authorize= d representative of the intended recipient, you are hereby notified that = any dissemination of this communication is strictly prohibited. If you ha= ve received this communication in error, please notify us immediately by = e-mail and delete the message and any attachments from your system. |
From: Alfonso R. <ms...@re...> - 2007-10-21 01:01:59
|
Thanks for the heads-up. I will try to format the code in a different way. By the way, is there a recommended practice to insert code at this forum?. Thanks. Alfonso Reyes wrote: > > The following is another basic example that illustrates the use of a > SQLite driver for Java. Python already enjoys of a package for SQLite > called pysqlite but unfortunately is not callable from Jython. I am > attaching the SQLite database alpha.db that is part of the > example.<br><br> > > References:<br> > sqliteJDBC: http://www.zentus.com/sqlitejdbc/ > http://www.zentus.com/sqlitejdbc/ <br> > Tutorial: http://www.pysquared.com/files/Java/JavaSQLiteExample/ > http://www.pysquared.com/files/Java/JavaSQLiteExample/ > <br><br> > Add to classpath or /jre/lib/ext:<br> > sqlitejdbc-v037-nested.jar > <br><br> > > Sample Code: > <xmp> > from java.sql import DriverManager > from java.sql import SQLException > from java.lang import Class > import sys > > class SQLiteDB: > def __init__(self): > self.database = "alpha.db" > driver = "org.sqlite.JDBC" > self.url = "jdbc:sqlite:" + self.database > Class.forName(driver); > > def open(self): > try: > self.db = DriverManager.getConnection(self.url); > stat1 = self.db.createStatement() > print self.db > except SQLException, e: > print e.message > print "cannot create connection with current driver" > print "revise url and try again. Will exit application ..." > sys.exit() > > def view(self): > try: > stmt = self.db.createStatement(); > rs = stmt.executeQuery("SELECT * FROM letters ORDER BY ID"); > > while (rs.next()): > id = rs.getString("ID"); # Column 1 > letter = rs.getString("letter"); # Column 2 > name = rs.getString("name"); # Column 3 > cat = rs.getString("categoryID"); # Column 4 > print "ID:", id, "Code:", letter, "Name:", name, > "\tCategory:", cat > except SQLException, e: > print e.message > print "cannot open table" > > def close(self): > self.db.close(); > > if __name__ == '__main__': > app = SQLiteDB() > app.open() > app.view() > app.close() > </xmp> http://www.nabble.com/file/p13322270/alpha.db alpha.db > <br><br> > Cheers! > <br> > Alfonso Reyes > -- View this message in context: http://www.nabble.com/SQLite-%2B-JDBC-%2B-Jython.-Example-tf4663619.html#a13324954 Sent from the jython-users mailing list archive at Nabble.com. |
From: Byron <bv...@ba...> - 2007-10-21 15:24:09
|
Alfonso Reyes wrote: > Thanks for the heads-up. I will try to format the code in a > different way. By the way, is there a recommended practice to > insert code at this forum?. Thanks. Your post is going out as both text and html (message contains a copy in each format), The people who can't read your post are using readers that are showing your post in html, which without <pre> blocks is going to look like a mess. Try and send it in text only. |
From: Ivan H. <pil...@gm...> - 2007-10-22 06:32:46
|
Dear Alfonso, i have some strange results when i tried to use msde with Jython. i posted some mail to the list, but there were no any answer. the subject of the mail: another jdbc related question it is about to get the databases from msde using zxJdbc, and orig. jdbc. i received different result. do you have any experience using other databases with Jython? thanks Ivan On 10/20/07, Alfonso Reyes <ms...@re...> wrote: > The following is another basic example that illustrates the use of a SQL= ite > driver for Java. Python already enjoys of a package for SQLite called > pysqlite but unfortunately is not callable from Jython. I am attaching th= e > SQLite database alpha.db that is part of the example. > > References: > sqliteJDBC: http://www.zentus.com/sqlitejdbc/ > Tutorial: > http://www.pysquared.com/files/Java/JavaSQLiteExample/ > > Add to classpath or /jre/lib/ext: > sqlitejdbc-v037-nested.jar > > Sample Code: from java.sql import DriverManager from java.sql import > SQLException from java.lang import Class import sys class SQLiteDB: def > __init__(self): self.database =3D "alpha.db" driver =3D "org.sqlite.JDBC" > self.url =3D "jdbc:sqlite:" + self.database Class.forName(driver); def > open(self): try: self.db =3D DriverManager.getConnection(self.url); stat1= =3D > self.db.createStatement() print self.db except SQLException, e: print > e.message print "cannot create connection with current driver" print "rev= ise > url and try again. Will exit application ..." sys.exit() def view(self): > try: stmt =3D self.db.createStatement(); rs =3D stmt.executeQuery("SELECT= * FROM > letters ORDER BY ID"); while (rs.next()): id =3D rs.getString("ID"); # Co= lumn > 1 letter =3D rs.getString("letter"); # Column 2 name =3D rs.getString("na= me"); # > Column 3 cat =3D rs.getString("categoryID"); # Column 4 print "ID:", id, > "Code:", letter, "Name:", name, "\tCategory:", cat except SQLException, e= : > print e.message print "cannot open table" def close(self): self.db.close(= ); > if __name__ =3D=3D '__main__': app =3D SQLiteDB() app.open() app.view() > app.close() alpha.db > > Cheers! > Alfonso Reyes > ________________________________ > View this message in context: SQLite + JDBC + Jython. Example > Sent from the jython-users mailing list archive at Nabble.com. > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users > > --=20 "De sagittis hungarorum libera nos, Domine!" - "A magyarok nyilait=F3l ments meg Uram minket!" http://www.freeweb.hu/pillesoft |
From: Alfonso R. <ms...@re...> - 2007-10-23 00:34:03
|
Hi Ivan I don't have experience with msde but I may be able to help you. What is the driver that you use with msde? Could you send me a sample code and a link to download the driver jdbc.msde? Thanks, Alfonso Ivan Horvath-3 wrote: >=20 > Dear Alfonso, >=20 > i have some strange results when i tried to use msde with Jython. i > posted some mail to the list, but there were no any answer. the > subject of the mail: another jdbc related question >=20 > it is about to get the databases from msde using zxJdbc, and orig. > jdbc. i received different result. >=20 > do you have any experience using other databases with Jython? >=20 > thanks > Ivan >=20 > On 10/20/07, Alfonso Reyes <ms...@re...> wrote: >> The following is another basic example that illustrates the use of a >> SQLite >> driver for Java. Python already enjoys of a package for SQLite called >> pysqlite but unfortunately is not callable from Jython. I am attaching >> the >> SQLite database alpha.db that is part of the example. >> >> References: >> sqliteJDBC: http://www.zentus.com/sqlitejdbc/ >> Tutorial: >> http://www.pysquared.com/files/Java/JavaSQLiteExample/ >> >> Add to classpath or /jre/lib/ext: >> sqlitejdbc-v037-nested.jar >> >> Sample Code: from java.sql import DriverManager from java.sql import >> SQLException from java.lang import Class import sys class SQLiteDB: def >> __init__(self): self.database =3D "alpha.db" driver =3D "org.sqlite.JDBC= " >> self.url =3D "jdbc:sqlite:" + self.database Class.forName(driver); def >> open(self): try: self.db =3D DriverManager.getConnection(self.url); stat= 1 =3D >> self.db.createStatement() print self.db except SQLException, e: print >> e.message print "cannot create connection with current driver" print >> "revise >> url and try again. Will exit application ..." sys.exit() def view(self): >> try: stmt =3D self.db.createStatement(); rs =3D stmt.executeQuery("SELEC= T * >> FROM >> letters ORDER BY ID"); while (rs.next()): id =3D rs.getString("ID"); # >> Column >> 1 letter =3D rs.getString("letter"); # Column 2 name =3D >> rs.getString("name"); # >> Column 3 cat =3D rs.getString("categoryID"); # Column 4 print "ID:", id, >> "Code:", letter, "Name:", name, "\tCategory:", cat except SQLException, >> e: >> print e.message print "cannot open table" def close(self): >> self.db.close(); >> if __name__ =3D=3D '__main__': app =3D SQLiteDB() app.open() app.view() >> app.close() alpha.db >> >> Cheers! >> Alfonso Reyes >> ________________________________ >> View this message in context: SQLite + JDBC + Jython. Example >> Sent from the jython-users mailing list archive at Nabble.com. >> >> ------------------------------------------------------------------------= - >> This SF.net email is sponsored by: Splunk Inc. >> Still grepping through log files to find problems? Stop. >> Now Search log events and configuration files using AJAX and a browser. >> Download your FREE copy of Splunk now >> http://get.splunk.com/ >> _______________________________________________ >> Jython-users mailing list >> Jyt...@li... >> https://lists.sourceforge.net/lists/listinfo/jython-users >> >> >=20 >=20 > --=20 > "De sagittis hungarorum libera nos, Domine!" - "A magyarok nyilait=C3=B3l > ments meg Uram minket!" >=20 > http://www.freeweb.hu/pillesoft >=20 > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users >=20 >=20 --=20 View this message in context: http://www.nabble.com/SQLite-%2B-JDBC-%2B-Jyt= hon.-Example-tf4663619.html#a13355517 Sent from the jython-users mailing list archive at Nabble.com. |
From: Ivan H. <pil...@gm...> - 2007-10-23 07:47:45
|
Dear Alfonso, you can find the sample codes in a mail in this mail list. its subject is: another jdbc related question the driver is com.microsoft.jdbc.sqlserver.SQLServerDriver and here is the link for the setup.exe http://download.microsoft.com/download/4/1/d/41d3e9c0-64d1-451e-947b-7a4cba= 273b2d/setup.exe On 10/23/07, Alfonso Reyes <ms...@re...> wrote: > > Hi Ivan > I don't have experience with msde but I may be able to help you. > What is the driver that you use with msde? Could you send me a sample cod= e > and a link to download the driver jdbc.msde? > > Thanks, > Alfonso > > > > Ivan Horvath-3 wrote: > > > > Dear Alfonso, > > > > i have some strange results when i tried to use msde with Jython. i > > posted some mail to the list, but there were no any answer. the > > subject of the mail: another jdbc related question > > > > it is about to get the databases from msde using zxJdbc, and orig. > > jdbc. i received different result. > > > > do you have any experience using other databases with Jython? > > > > thanks > > Ivan > > > > On 10/20/07, Alfonso Reyes <ms...@re...> wrote: > >> The following is another basic example that illustrates the use of a > >> SQLite > >> driver for Java. Python already enjoys of a package for SQLite called > >> pysqlite but unfortunately is not callable from Jython. I am attaching > >> the > >> SQLite database alpha.db that is part of the example. > >> > >> References: > >> sqliteJDBC: http://www.zentus.com/sqlitejdbc/ > >> Tutorial: > >> http://www.pysquared.com/files/Java/JavaSQLiteExample/ > >> > >> Add to classpath or /jre/lib/ext: > >> sqlitejdbc-v037-nested.jar > >> > >> Sample Code: from java.sql import DriverManager from java.sql import > >> SQLException from java.lang import Class import sys class SQLiteDB: de= f > >> __init__(self): self.database =3D "alpha.db" driver =3D "org.sqlite.JD= BC" > >> self.url =3D "jdbc:sqlite:" + self.database Class.forName(driver); def > >> open(self): try: self.db =3D DriverManager.getConnection(self.url); st= at1 =3D > >> self.db.createStatement() print self.db except SQLException, e: print > >> e.message print "cannot create connection with current driver" print > >> "revise > >> url and try again. Will exit application ..." sys.exit() def view(self= ): > >> try: stmt =3D self.db.createStatement(); rs =3D stmt.executeQuery("SEL= ECT * > >> FROM > >> letters ORDER BY ID"); while (rs.next()): id =3D rs.getString("ID"); # > >> Column > >> 1 letter =3D rs.getString("letter"); # Column 2 name =3D > >> rs.getString("name"); # > >> Column 3 cat =3D rs.getString("categoryID"); # Column 4 print "ID:", i= d, > >> "Code:", letter, "Name:", name, "\tCategory:", cat except SQLException= , > >> e: > >> print e.message print "cannot open table" def close(self): > >> self.db.close(); > >> if __name__ =3D=3D '__main__': app =3D SQLiteDB() app.open() app.view(= ) > >> app.close() alpha.db > >> > >> Cheers! > >> Alfonso Reyes > >> ________________________________ > >> View this message in context: SQLite + JDBC + Jython. Example > >> Sent from the jython-users mailing list archive at Nabble.com. > >> > >> ----------------------------------------------------------------------= --- > >> This SF.net email is sponsored by: Splunk Inc. > >> Still grepping through log files to find problems? Stop. > >> Now Search log events and configuration files using AJAX and a browser= . > >> Download your FREE copy of Splunk now >> http://get.splunk.com/ > >> _______________________________________________ > >> Jython-users mailing list > >> Jyt...@li... > >> https://lists.sourceforge.net/lists/listinfo/jython-users > >> > >> > > > > > > -- > > "De sagittis hungarorum libera nos, Domine!" - "A magyarok nyilait=F3l > > ments meg Uram minket!" > > > > http://www.freeweb.hu/pillesoft > > > > -----------------------------------------------------------------------= -- > > This SF.net email is sponsored by: Splunk Inc. > > Still grepping through log files to find problems? Stop. > > Now Search log events and configuration files using AJAX and a browser. > > Download your FREE copy of Splunk now >> http://get.splunk.com/ > > _______________________________________________ > > Jython-users mailing list > > Jyt...@li... > > https://lists.sourceforge.net/lists/listinfo/jython-users > > > > > > -- > View this message in context: http://www.nabble.com/SQLite-%2B-JDBC-%2B-J= ython.-Example-tf4663619.html#a13355517 > Sent from the jython-users mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users > --=20 "De sagittis hungarorum libera nos, Domine!" - "A magyarok nyilait=F3l ments meg Uram minket!" http://www.freeweb.hu/pillesoft |
From: Ivan H. <pil...@gm...> - 2007-10-23 07:52:33
|
Dear Alfonso, some more information: Microsoft SQL Server 2000 Driver for JDBC Service Pack 3 Version 2.2.0040 May 2004 this is the driver version thank you for your help Ivan On 10/23/07, Ivan Horvath <pil...@gm...> wrote: > Dear Alfonso, > > you can find the sample codes in a mail in this mail list. its subject > is: another jdbc related question > the driver is com.microsoft.jdbc.sqlserver.SQLServerDriver > and here is the link for the setup.exe > http://download.microsoft.com/download/4/1/d/41d3e9c0-64d1-451e-947b-7a4c= ba273b2d/setup.exe > > > On 10/23/07, Alfonso Reyes <ms...@re...> wrote: > > > > Hi Ivan > > I don't have experience with msde but I may be able to help you. > > What is the driver that you use with msde? Could you send me a sample c= ode > > and a link to download the driver jdbc.msde? > > > > Thanks, > > Alfonso > > > > > > > > Ivan Horvath-3 wrote: > > > > > > Dear Alfonso, > > > > > > i have some strange results when i tried to use msde with Jython. i > > > posted some mail to the list, but there were no any answer. the > > > subject of the mail: another jdbc related question > > > > > > it is about to get the databases from msde using zxJdbc, and orig. > > > jdbc. i received different result. > > > > > > do you have any experience using other databases with Jython? > > > > > > thanks > > > Ivan > > > > > > On 10/20/07, Alfonso Reyes <ms...@re...> wrote: > > >> The following is another basic example that illustrates the use of = a > > >> SQLite > > >> driver for Java. Python already enjoys of a package for SQLite calle= d > > >> pysqlite but unfortunately is not callable from Jython. I am attachi= ng > > >> the > > >> SQLite database alpha.db that is part of the example. > > >> > > >> References: > > >> sqliteJDBC: http://www.zentus.com/sqlitejdbc/ > > >> Tutorial: > > >> http://www.pysquared.com/files/Java/JavaSQLiteExample/ > > >> > > >> Add to classpath or /jre/lib/ext: > > >> sqlitejdbc-v037-nested.jar > > >> > > >> Sample Code: from java.sql import DriverManager from java.sql impor= t > > >> SQLException from java.lang import Class import sys class SQLiteDB: = def > > >> __init__(self): self.database =3D "alpha.db" driver =3D "org.sqlite.= JDBC" > > >> self.url =3D "jdbc:sqlite:" + self.database Class.forName(driver); d= ef > > >> open(self): try: self.db =3D DriverManager.getConnection(self.url); = stat1 =3D > > >> self.db.createStatement() print self.db except SQLException, e: prin= t > > >> e.message print "cannot create connection with current driver" print > > >> "revise > > >> url and try again. Will exit application ..." sys.exit() def view(se= lf): > > >> try: stmt =3D self.db.createStatement(); rs =3D stmt.executeQuery("S= ELECT * > > >> FROM > > >> letters ORDER BY ID"); while (rs.next()): id =3D rs.getString("ID");= # > > >> Column > > >> 1 letter =3D rs.getString("letter"); # Column 2 name =3D > > >> rs.getString("name"); # > > >> Column 3 cat =3D rs.getString("categoryID"); # Column 4 print "ID:",= id, > > >> "Code:", letter, "Name:", name, "\tCategory:", cat except SQLExcepti= on, > > >> e: > > >> print e.message print "cannot open table" def close(self): > > >> self.db.close(); > > >> if __name__ =3D=3D '__main__': app =3D SQLiteDB() app.open() app.vie= w() > > >> app.close() alpha.db > > >> > > >> Cheers! > > >> Alfonso Reyes > > >> ________________________________ > > >> View this message in context: SQLite + JDBC + Jython. Example > > >> Sent from the jython-users mailing list archive at Nabble.com. > > >> > > >> --------------------------------------------------------------------= ----- > > >> This SF.net email is sponsored by: Splunk Inc. > > >> Still grepping through log files to find problems? Stop. > > >> Now Search log events and configuration files using AJAX and a brows= er. > > >> Download your FREE copy of Splunk now >> http://get.splunk.com/ > > >> _______________________________________________ > > >> Jython-users mailing list > > >> Jyt...@li... > > >> https://lists.sourceforge.net/lists/listinfo/jython-users > > >> > > >> > > > > > > > > > -- > > > "De sagittis hungarorum libera nos, Domine!" - "A magyarok nyilait=F3= l > > > ments meg Uram minket!" > > > > > > http://www.freeweb.hu/pillesoft > > > > > > ---------------------------------------------------------------------= ---- > > > This SF.net email is sponsored by: Splunk Inc. > > > Still grepping through log files to find problems? Stop. > > > Now Search log events and configuration files using AJAX and a browse= r. > > > Download your FREE copy of Splunk now >> http://get.splunk.com/ > > > _______________________________________________ > > > Jython-users mailing list > > > Jyt...@li... > > > https://lists.sourceforge.net/lists/listinfo/jython-users > > > > > > > > > > -- > > View this message in context: http://www.nabble.com/SQLite-%2B-JDBC-%2B= -Jython.-Example-tf4663619.html#a13355517 > > Sent from the jython-users mailing list archive at Nabble.com. > > > > > > -----------------------------------------------------------------------= -- > > This SF.net email is sponsored by: Splunk Inc. > > Still grepping through log files to find problems? Stop. > > Now Search log events and configuration files using AJAX and a browser. > > Download your FREE copy of Splunk now >> http://get.splunk.com/ > > _______________________________________________ > > Jython-users mailing list > > Jyt...@li... > > https://lists.sourceforge.net/lists/listinfo/jython-users > > > > > -- > "De sagittis hungarorum libera nos, Domine!" - "A magyarok nyilait=F3l > ments meg Uram minket!" > > http://www.freeweb.hu/pillesoft > --=20 "De sagittis hungarorum libera nos, Domine!" - "A magyarok nyilait=F3l ments meg Uram minket!" http://www.freeweb.hu/pillesoft |