You are on page 1of 1

import java.sql.*; public class dbTest { public dbTest(){ } public static void main(String[] args){ try{ Class.forName("org.apache.derby.jdbc.

EmbeddedDriver"); }catch(ClassNotFoundException e){ System.out.println(e); } try{ Connection con = DriverManager.getConnection("jdbc:derby://localhost:152 7/APP","demo","demo"); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("SELECT * FROM APP.Table1"); while (rs.next()) { String s = rs.getString("Name"); float n = rs.getFloat("Age"); System.out.println(s + " " + n); } }catch(SQLException e){ System.err.println(e); } } }

You might also like