Code Examples
A repository of 155 code examples for BeepBeep
SourceExample.java
1 package jdbc;
2 
3 import ca.uqac.lif.cep.Pullable;
4 import ca.uqac.lif.cep.jdbc.JdbcSource;
5 import ca.uqac.lif.cep.tuples.Tuple;
6 import java.sql.Connection;
7 import java.sql.DriverManager;
8 import java.sql.SQLException;
9 
10 public class SourceExample
11 {
12  public static void main(String[] args) throws SQLException
13  {
14  ///
15  Connection conn = DriverManager.getConnection(
16  "jdbc:mysql//localhost/mydb", "betty", "foo");
17  String query = "SELECT * FROM mytable";
18  JdbcSource src = new JdbcSource(conn, query);
19  Pullable p = src.getPullableOutput();
20  while (p.hasNext())
21  {
22  Tuple t = (Tuple) p.pull();
23  System.out.println(t);
24  }
25  ///
26  }
27 }