VMware Cloud Community
lurims123
Enthusiast
Enthusiast

How do I set an integer or double precision field in the PostgreSQL using vCO SQL or JDBC plug-in?

I am using the ODBC Plugin for vCO to connect to the PostgreSQL and everything went OK and I am able to upadte the tables using the string method so far.

Some part of the code is here.

var sqlStatement = 'insert into ' + tableName + ' values (?,?,?,?,?,?,?,?,?,?,?)';

var stat = con.prepareStatement( sqlStatement );

............................

............................

stat.setString(8, BackupType );
stat.setString(9, Expiration );
stat.setString(10, OrgName );
stat.setString(11, BytesCounted);
var result = stat.executeUpdate();

until...........

I have to set an element in the Database, I got into issues, whose data type is integer.  I am able to direcly update the table from the PostgreSQL SQL Editor with out any issues.  But from javascript of vCO it is giving problems.  The code I am trying is something like the folowing.

stat.setString(8, BackupType );
stat.setString(9, Expiration );
stat.setString(10, OrgName );

stat.setInt(11,BytesCounted);
vCO threw the following error.
InternalError: Method org.postgresql.jdbc4.Jdbc4PreparedStatement.setInt(String,int) is not yet implemented.
When I checked the API in vCO for this object (thanks to Suresh Thoppay for that), I surprised to see there is no such method (setInt()) exists. 
Folks, any idea how this can solved.  I have enclosed a picture of the problem.

0 Kudos
3 Replies
igorstoyanov
VMware Employee
VMware Employee

Hi,

Please try using setNumber() instead of setInt().

More details in this community thread: http://communities.vmware.com/message/2071447#2071447

Hope, this would resolve the issue.

Thanks,

Igor.

Visit http://blogs.vmware.com/orchestrator for the latest in Cloud Orchestration.
0 Kudos
igorstoyanov
VMware Employee
VMware Employee

Ok, I was too fast here. I don't see setNumber in the API so this is not the same use case. Sorry.

Visit http://blogs.vmware.com/orchestrator for the latest in Cloud Orchestration.
lurims123
Enthusiast
Enthusiast

No problem igorstoyanov.  Thanks for your inputs.  I resolved it by exluding that field in the "PrepareStatement", while exeucting the query.  I have used and extra "createStatement()" instead to update the field.  Thanks to my colleague (Vidya Nayak) for the suggestion.

0 Kudos