public static void main(String []args)throws Exception{
Class.forName("br.com.svvs.jdbc.redis.RedisDriver");
Connection conn = DriverManager.getConnection("jdbc:redis://localhost");
Statement statement = conn.createStatement();
statement.execute("set my_first_key myvalue");
statement.execute("get my_first_key");
ResultSet r = statement.getResultSet();
while(r.next()) {
System.out.println(">" + r.getString(0) + "<");
}
spooling Result:> 7 <
expected result :> myvalue <
how to correctly insert the data?
------ Solution ---------------------------------------- ----
with jedis it
------ For reference only ---------------------------- -----------
their first top
------ For reference only --------------------- ------------------
Khan , nobody Yeah, Zaiding !
------ For reference only -------------------------------------- -
read the code has several question marks have to learn from you ....
------ For reference only ------------------ ---------------------
use
StringBuffer s;
s.append (">");
s.append ("<");
------ For reference only ---------------------- -----------------
Can you say a little more , do not quite understand
------ For reference only ------------------------ ---------------
import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; public class RedisSample { public static void main(String[] args) throws SQLException, ClassNotFoundException { Class.forName("br.com.svvs.jdbc.redis.RedisDriver"); Connection conn = DriverManager.getConnection("jdbc:redis://localhost"); Statement statement = conn.createStatement(); statement.execute("set my_first_key my first value"); statement.execute("get my_first_key"); ResultSet r = statement.getResultSet(); while(r.next()) { System.out.println(">" + r.getString(0) + "<"); } } }
http://code.google.com/p/jdbc-redis/wiki/FirstSetGet
execute the above code
print out the result: > 14 <
not expect results > my first value <
solving
------ For reference only --------------------------------- ------
http://code.google.com/p/jdbc-redis/wiki/FirstSetGet
Top this
------ For reference only -------------------------------- -------
top , seeking answers
------ For reference only ------------------------ ---------------
Zaiding , solving
------ For reference only ---------------- -----------------------
roar again , is there any heroes know, sir
------ For reference only - --------------------------------------
I have not got this problem for a long time not resolved , on the same run on linux
没有评论:
发表评论