Re: [GENERAL] Problem with copy

2006-04-26 Thread Eduardo Muñoz
Nevermind.  It was a problem with the encoding
type of the file.

 --- Eduardo Muñoz <[EMAIL PROTECTED]> escribió:

> Hi, I'm trying to copy information from a csv file
> using pgadminIII. I run the following command:
> 
> copy cliente from '/path/file.csv' with csv;
> 
> The command runs and i get no output. I thought the
> process could be taking a lot to complete, but i
> don't
> think so. I'm trying with just a few records and I'm
> still not getting anything.
> 
> I hope you can help me with some clues or other
> options.
> 
> 
> 
> __
> Correo Yahoo!
> Espacio para todos tus mensajes, antivirus y
> antispam ¡gratis! 
> Regístrate ya - http://correo.espanol.yahoo.com/ 
> 
> ---(end of
> broadcast)---
> TIP 6: explain analyze is your friend
> 




__
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis! 
Regístrate ya - http://correo.espanol.yahoo.com/ 

---(end of broadcast)---
TIP 4: Have you searched our list archives?

   http://archives.postgresql.org


[GENERAL] Problem with copy

2006-04-26 Thread Eduardo Muñoz
Hi, I'm trying to copy information from a csv file
using pgadminIII. I run the following command:

copy cliente from '/path/file.csv' with csv;

The command runs and i get no output. I thought the
process could be taking a lot to complete, but i don't
think so. I'm trying with just a few records and I'm
still not getting anything.

I hope you can help me with some clues or other options.



__
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis! 
Regístrate ya - http://correo.espanol.yahoo.com/ 

---(end of broadcast)---
TIP 6: explain analyze is your friend


[GENERAL] Problem with Transaction

2006-03-08 Thread Eduardo Muñoz
Hi, I'm trying to make a PL/pgSQL function to update
or insert if the row is not present. I tested the
function and it works fine, but when I call it through
JDBC, it executes, but the row is not inserted or
updated. This is my JDBC code.

try{
   
connection.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);
connection.setAutoCommit(false);
statement = connection.prepareCall("{? =
call save(?,?,?)}");
statement.registerOutParameter(1,
Types.INTEGER);
statement.setObject(2, null);
statement.setObject(3, null);
statement.setObject(4, "1234");
statement.executeUpdate();
id = (Integer)statement.getObject(1);
connection.commit();
} catch(SQLException e){
try{
connection.rollback();
} catch(SQLException e2){
e2.printStackTrace();
}
e.printStackTrace();
}

I am getting the following exception:
org.postgresql.util.PSQLException: ERROR: function
save("unknown", "unknown", character varying) does not
exist
at
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1512)
at
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1297)
at
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:188)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:430)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:346)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:297)
... 



__
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis! 
Regístrate ya - http://correo.espanol.yahoo.com/ 

---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore your desire to
   choose an index scan if your joining column's datatypes do not
   match


[GENERAL] Problem with function that returns a cursor

2006-03-03 Thread Eduardo Muñoz
I'm new to pgSQL and I'm having some trouble with a
function. I keep getting the following error:

org.postgresql.util.PSQLException: ERROR: cursor
"" does not exist

This is the function:

CREATE OR REPLACE FUNCTION ret_user(pusername
"varchar")
  RETURNS refcursor AS
$BODY$
DECLARE
ccursor refcursor;
BEGIN
open ccursor for
select username, 
password, 
idrole 
from user
where username = quote_literal($1); 

RETURN ccursor;
END;
$BODY$
  LANGUAGE 'plpgsql' VOLATILE;


This is the JDBC code:

CallableStatement statement = null;
ResultSet rs = null;
Connection connection =
ConnectionPool.getConnection(saJNDI);
try{
statement = connection.prepareCall("{? =
call ret_user(?)");
statement.registerOutParameter(1,
Types.OTHER);
statement.setObject(2, "munoze");
statement.execute();
rs = (ResultSet)statement.getObject(1);
while(rs.next()){
System.out.println(rs.getString(1));
System.out.println(rs.getString(2));
System.out.println(rs.getString(3));
}
rs.close();
statement.close();
} catch(SQLException e){

}

I hope you can help me



__
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis! 
Regístrate ya - http://correo.espanol.yahoo.com/ 

---(end of broadcast)---
TIP 6: explain analyze is your friend


[GENERAL] Problem with Function

2006-03-02 Thread Eduardo Muñoz
Hi, I'm new with pgSQL and I'm not sure why, but I
keep getting the same error. I want to call a function
that returns a cursor and I keep getting the following
exception:

org.postgresql.util.PSQLException: ERROR: cursor
"" does not exist

I would appreciate any help with this problem.

This is my JDBC code:

Connection objlConnection =
ConnectionPool.getConnection(saJNDI);
CallableStatement statement = null;
ResultSet rs = null;
try{
statement = objlConnection.prepareCall("{? = call
ret_user(?)}");
statement.registerOutParameter(1, Types.OTHER);
statement.setObject(2, "munoze");  
statement.execute();
rs = (ResultSet)statement.getObject(1);
while(rs.next()){
System.out.println(rs.getString(1));
System.out.println(rs.getString(2));
System.out.println(rs.getString(3));
}
rs.close();
statement.close();
} catch (SQLExcepton e){
...


This is my function code:

CREATE OR REPLACE FUNCTION
traer_usuario(pnombreusuario "varchar")
  RETURNS refcursor AS
$BODY$
DECLARE
ccursor refcursor;
BEGIN
open ccursor for
select nombreusuario, 
contrasena, 
idrol 
from usuario
where nombreusuario = quote_literal($1); 

RETURN ccursor;
END;
$BODY$
  LANGUAGE 'plpgsql' VOLATILE;



__
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis! 
Regístrate ya - http://correo.espanol.yahoo.com/ 

---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster