Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import com.mysql.jdbc.jdbc2.optional.MysqlDataSource;
- import java.sql.Connection;
- import java.sql.ResultSet;
- import java.sql.Statement;
- public class Test {
- static MysqlDataSource mds = new
- MysqlDataSource();
- public static void main(String[] args) {
- try{mds.setURL(
- "jdbc:mysql://localhost/bibliothek");
- mds.setUser ("root");
- Connection con = mds.getConnection();
- Statement stm = con.createStatement();
- stm.execute("select * from buch");
- ResultSet rs = stm.getResultSet();
- if ( rs != null)
- } catch(Exception ex) {
- ex.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement