[MonetDB-users] Problem using MonetDB
hi this is the code i'm using:
private Connection getMonetDBConnection(){ Connection c=null; try { Class.forName("nl.cwi.monetdb.jdbc.MonetDriver"); } catch (ClassNotFoundException e) { System.out.println("Impossibile caricare i driver MonetDB"); e.printStackTrace(); }
try { c=DriverManager.getConnection("jdbc:monetdb://localhost/demo", "monetdb", "monetdb"); c.setAutoCommit(true); System.out.println("Restituita connessione: "+c); } catch (SQLException e) { System.out.println("Impossibile stabilire una connessione con MonetDB"); e.printStackTrace(); }
return c;
}
I must insert in my table result of a select on other db:
.....
String insert="INSERT INTO MYTABLE VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,? ,?,?)";
ps=connMonetDB.prepareStatement(insert);
while (rs.next() ){
ps.setString(1,rs.getString(1));
ps.setInt(2,rs.getInt(2));
ps.setInt(3,rs.getInt(3));
ps.setString(4,rs.getString(4));
ps.setString(5,rs.getString(5));
ps.setString(6,rs.getString(6));
ps.setInt(7,rs.getInt(7));
ps.setString(8,rs.getString(8));
ps.setString(9,rs.getString(9));
ps.setString(10,rs.getString(10));
ps.setString(11,rs.getString(11));
ps.setString(12,rs.getString(12));
ps.setString(13,rs.getString(13));
ps.setString(14,rs.getString(14));
ps.setString(15,rs.getString(15));
ps.setString(16,rs.getString(16));
ps.setLong(17,rs.getLong(17));
ps.setLong(18,rs.getLong(18));
ps.setLong(19,rs.getLong(19));
ps.setLong(20,rs.getLong(20));
ps.setLong(21,rs.getLong(21));
ps.setLong(22,rs.getLong(22));
ps.setLong(23,rs.getLong(23));
ps.setLong(24,rs.getLong(24));
ps.setLong(25,rs.getLong(25));
ps.setLong(26,rs.getLong(26));
ps.setLong(27,rs.getLong(27));
ps.setLong(28,rs.getLong(28));
ps.setLong(29,rs.getLong(29));
ps.setLong(30,rs.getLong(30));
ps.setLong(31,rs.getLong(31));
ps.setLong(32,rs.getLong(32));
ps.setLong(33,rs.getLong(33));
ps.setLong(34,rs.getLong(34));
ps.setLong(35,rs.getLong(35));
ps.setLong(36,rs.getLong(36));
ps.setLong(37,rs.getLong(37));
ps.setLong(38,rs.getLong(38));
ps.execute();
System.out.println("Elaborata posizione nr "+i);
i++;
}
ps.close();
connMonetDB.close();
Where is the wrong?
tnx
Raffaele
Hi Raffaele,
On 02-02-2007 12:11:30 +0100, Verre Raffaele wrote:
String insert="INSERT INTO MYTABLE VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?, ?,?,?)";
ps=connMonetDB.prepareStatement(insert);
while (rs.next() ){
...
ps.setLong(38,rs.getLong(38));
ps.execute();
Your program looks correct to me. We identified the real problem, which is in the server. It doesn't like the number of arguments of the PreparedStatement. We're looking into a fix for the moment. Sorry for the inconvenience!
Tnx for your attention I'll wait for the fix.
Br Raffaele
-----Messaggio originale----- Da: Fabian Groffen [mailto:Fabian.Groffen@cwi.nl] Inviato: venerdì 2 febbraio 2007 15.30 A: Verre Raffaele Cc: monetdb-users@lists.sourceforge.net Oggetto: Re: [MonetDB-users] Problem using MonetDB
Hi Raffaele,
On 02-02-2007 12:11:30 +0100, Verre Raffaele wrote:
String insert="INSERT INTO MYTABLE VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,? , ?,?,?)";
ps=connMonetDB.prepareStatement(insert);
while (rs.next() ){
...
ps.setLong(38,rs.getLong(38));
ps.execute();
Your program looks correct to me. We identified the real problem, which is in the server. It doesn't like the number of arguments of the PreparedStatement. We're looking into a fix for the moment. Sorry for the inconvenience!
participants (2)
-
Fabian Groffen
-
Verre Raffaele