Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Tak mam napisane to ja (fragment klasy, jedna funkcja):
- public static void downloadFromDatabase(String database, String where, String item) { // checking login from database
- try {
- con = DriverManager.getConnection("jdbc:mysql://reykez.pl:3306/reykez_xxxxxx" , "reykez_xxxxxx" , "xxxxxxxx");
- st = con.createStatement();
- rs = st.executeQuery("select * from " + database + " WHERE " + where + " = '" + item + "'"); // select from nickname
- } catch(Exception e) { e.printStackTrace(); }
- }
- ---------------------------------------------------------------------------------------
- Ale ten sam kod można napisać na przykład tak:
- public static void downloadFromDatabase(String database, String where, String item)
- {
- try {
- con = DriverManager.getConnection("jdbc:mysql://reykez.pl:3306/reykez_xxxxxx" , "reykez_xxxxxx" , "xxxxxxxx");
- st = con.createStatement();
- rs = st.executeQuery("select * from " + database + " WHERE " + where + " = '" + item + "'");
- }
- catch(Exception e)
- {
- e.printStackTrace();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement