phoenix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Will Xu <...@hortonworks.com>
Subject Re: Define parameters in queries
Date Thu, 23 Mar 2017 18:30:42 GMT
?Hi Cheyenne,

Phoenix connections are standard JDBC connections. This means you can use prepareStatement
API to do parameter substitution.


>From SO: http://stackoverflow.com/questions/12745186/passing-parameters-to-a-jdbc-preparedstatement


   statement =con.prepareStatement("SELECT * from employee WHERE  userID = :userId");
   statement.setString(userId, userID);
   ResultSet rs = statement.executeQuery();

Or, you can use ? in place of named value - :userId..

   statement =con.prepareStatement("SELECT * from employee WHERE  userID = ?");
   statement.setString(1, userID);?


  ResultSet rs = statement.executeQuery();

Regards,

Will

________________________________
From: Cheyenne Forbes <cheyenne.osanu.forbes@gmail.com>
Sent: Thursday, March 23, 2017 10:50 AM
To: user@phoenix.apache.org
Subject: Re: Define parameters in queries

Anyone?

Mime
View raw message