My mistake - I was thinking of ResultSet.getString(String,String) and ResultSet.getString(int,String). PreparedStatement sets parameters based on the order you list the ? In your statement - they don't necessarily map to columns at all. These are all standard JDBC interfaces, not defined by Phoenix at all. FWIW, there are a lot of good online resources to learn about them.
Thanks, James On Wednesday, January 6, 2016, anil gupta <anilgupt...@gmail.com> wrote: > Hi James, > > Maybe, i am missing your point. I dont see following method in > PreparedStatement interface: > > pstmt.setString("STOCK_NAME", stockName); > > Do i need to use some other stuff than Phoenix MR integration to get that > method? > > Thanks, > > Anil Gupta > > > > On Tue, Jan 5, 2016 at 8:48 PM, James Taylor <jamestay...@apache.org > <javascript:_e(%7B%7D,'cvml','jamestay...@apache.org');>> wrote: > >> With JDBC, both will already work. >> >> pstmt.setString("STOCK_NAME", stockName); >> >> pstmt.setString(1, stockName); >> >> >> On Tuesday, January 5, 2016, anil gupta <anilgupt...@gmail.com >> <javascript:_e(%7B%7D,'cvml','anilgupt...@gmail.com');>> wrote: >> >>> Hi, >>> >>> I am using Phoenix4.4. I am trying to integrate my MapReduce job with >>> Phoenix following this doc: https://phoenix.apache.org/phoenix_mr.html >>> >>> >>> My phoenix table has around 1000 columns. I have some hesitation >>> regarding using *COLUMN_INDEX* for setting its value rather than *NAME* as >>> per following example: >>> >>> @Override >>> public void write(PreparedStatement pstmt) throws SQLException { >>> pstmt.setString(1, stockName); >>> pstmt.setDouble(2, maxPrice); >>> } >>> >>> There are couple of problems with above: >>> 1. What if someone deletes a column from table? My guess, It will change >>> index of some of the columns. Right?(Lets say, a table has 5 columns. 3rd >>> column of table is deleted.) >>> 2. Readability of code is also less since column names are denoted by >>> numbers.(in reality it's a name/value pair) >>> >>> Instead, if we have following API then it will be much easier and above >>> problems will be fixed: >>> >>> @Override >>> public void write(PreparedStatement pstmt) throws SQLException { >>> pstmt.setString("STOCK_NAME", stockName); >>> pstmt.setDouble("MAX_RECORDING", maxPrice); >>> } >>> >>> Also, my coding habits are giving me hard time to code on basis of index >>> when in reality its a key/value pair. :) >>> >>> Is there anyway i can achieve the above? Would the community like to have >>> the key/value api? >>> >>> >>> -- >>> Thanks & Regards, >>> Anil Gupta >>> >> > > > -- > Thanks & Regards, > Anil Gupta >