03 Nov 2008, 22:38
Generic-user-small

Eric Blossom (1 post)

Trying to follow the example on page 163 I get:

  groovy> def sql = groovy.sql.Sql.newInstance("""
  groovy> jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};
  groovy> DBQ=C:/Documents and Settings/me/AssayDB.xls;READONLY=false""", '', '')
  groovy> println "000"
  groovy> sql.eachrow('SELECT * FROM [Substrates$]') {
  groovy>     println "${it.name}\t\t${it.abbreviation}"
  groovy> }
 
  Exception thrown: java.sql.SQLException: No suitable driver

  java.sql.SQLException: No suitable driver
	at Script10.run(Script10:1)

I must need to install a driver of some sort?

thanks, Eric

04 Nov 2008, 22:38
Venkatsubramaniam_pragsmall

Venkat Subramaniam (84 posts)

Eric,

Can you go into Control Panel and Data Sources(ODBC) and see if Microsoft Excel Driver is installed. If you find it, try using the exact name as it appears in that panel (including the items in the parenthesis). Let me know what you find.

03 Feb 2010, 13:45
Generic-user-small

Fred Miller (2 posts)

I have some Excel spreadsheets in a Unix/Linux environment and I’d like to use Groovy to read and convert the contents to XML. Any recommendations? Looking mainly at the cleanest way to read an Excel file in Unix/Linux. I’m ok with the XML conversion just added it for context.

03 Feb 2010, 15:07
Generic-user-small

Fred Miller (2 posts)

Using http://poi.apache.org as a model.

26 Apr 2010, 20:47
Generic-user-small

Angel Villafranca (1 post)

Hi Eric, I got your piece of code to work by adding ‘sun.jdbc.odbc.JdbcOdbcDriver’ as 4th parameter to your call to Sql.newInstance()

def sql = groovy.sql.Sql.newInstance(“"”jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)}; DBQ=C:/MyDataFile.xls;READONLY=false”””, ‘’, ‘’, ‘sun.jdbc.odbc.JdbcOdbcDriver’)

  You must be logged in to comment