/** | |
* Created by zarac on 10/28/14. | |
*/ | |
import com.microsoft.sqlserver.jdbc.SQLServerDriver; | |
import java.sql.*; | |
public class mainz0r { | |
public static String connectionUrl = "jdbc:sqlserver://vart.nu:8887;databaseName=GRUPP18C;user=alle;password=hemligt;"; | |
public static Connection con; | |
public static void main(String[] argv) { | |
//Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); | |
try { | |
con = DriverManager.getConnection(connectionUrl); | |
mainz0r.getInsomnia(); } | |
catch (SQLException e) { | |
System.out.println("OH NOES!" + e.getMessage()); } | |
System.out.println("heafhae"); } | |
public static void getInsomnia() { | |
try { | |
PreparedStatement statement = con.prepareStatement("SELECT * FROM lider WHERE sname = ?"); | |
statement.setString(1, "insomnia"); | |
ResultSet result = statement.executeQuery(); | |
while (result.next()) { | |
System.out.println("record : " + result.getString(1)); } } | |
catch (SQLException e) { | |
System.out.println("ERROR YO! " + e.getMessage()); | |
e.printStackTrace(); } } } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment