public DB2Core() { Console.WriteLine("Creating IBM.Data.Core.DB2Connection Connection Object"); try { var db2core = new IBM.Data.DB2.Core.DB2Connection(); Console.WriteLine("SUCCESS!"); } catch (Exception ex) { Console.WriteLine("FAILED"); Console.WriteLine(ex.Message); } }
public static int Test_Tokens() { StringBuilder sb = new StringBuilder(); StringBuilder sb2 = new StringBuilder(); int cnt = 0; TokenFactory tf = new TokenFactory(); tf.ParseExpression("(2x^2 + 4x + 7)^2"); foreach (Symbol sym in tf.symbolList) { Console.WriteLine("{0}", sym.HashTokenString); Console.WriteLine("{0}", sym.NakedTokenString); } using (IBM.Data.DB2.Core.DB2Connection con = new IBM.Data.DB2.Core.DB2Connection("Server=localhost:50000;Database=books;UID=db2admin;PWD=redeye1")) { try { con.Open(); IBM.Data.DB2.Core.DB2Command comm = con.CreateCommand(); comm.CommandText = "select title from books fetch first 10 rows only"; IBM.Data.DB2.Core.DB2DataReader reader = comm.ExecuteReader(); while (reader.Read()) { Console.WriteLine(reader.GetString(0)); } reader.Close(); comm.Dispose(); } catch (Exception ex) { throw ex; } con.Close(); } return(0); }