Re: macaddr data type and prepared statements
От | Dave Cramer |
---|---|
Тема | Re: macaddr data type and prepared statements |
Дата | |
Msg-id | 86B2EC8F-0F8D-40A3-9287-838BF31E591A@fastcrypt.com обсуждение исходный текст |
Ответ на | macaddr data type and prepared statements (Steve Foster <s.p.foster@leeds.ac.uk>) |
Ответы |
Re: macaddr data type and prepared statements
|
Список | pgsql-jdbc |
Steve, What are the column types in the table. If it is macaddr type then this is expected behaviour. Dave On 4-Aug-08, at 9:28 AM, Steve Foster wrote: > Hi All, > > I'm trying to bulk load some MAC addresses using a prepared > statement. But I keep on getting an error about incorrect datatype > (complains that I'm trying to insert "character varying"). Bellow > is an example of the code that I'm using: > > try { > > Class.forName("org.postgresql.Driver"); > conn = DriverManager.getConnection(jdbc_url, jdbc_user, > jdbc_pass); > > PreparedStatement stmt = conn.prepareStatement("insert > into log (date, time, mac, network) values (?,?,?,?)"); > > while (inputLineIterator.hasNext()) { > String[] line = inputLineIterator.next(); > if (line == null) { > continue; > } > stmt.setDate(1, new > java.sql.Date( dfmt.parse(line[0]).getTime()) ); > stmt.setDate(2, new > java.sql.Date( tfmt.parse(line[1]).getTime()) ); > stmt.setString(3, line[2]); > stmt.setString(4, line[3]); > stmt.execute(); > } > > stmt.close(); > } > > Any recommendations? > > Cheers > > Steve > > -- > Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-jdbc
В списке pgsql-jdbc по дате отправления: