how to setup ingres to work with your...

45
How to Setup Ingres to Work with Your Application Cristian Ianculovici

Upload: others

Post on 24-Jun-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: How to Setup Ingres to Work with Your Applicationdownloads.actian.com/online/media/webcasts/vip/2008/05/... · 2017-08-08 · Why Ingres Database? Bells and Whistles Enterprise Developer

How to Setup Ingres to Work with Your Application

Cristian Ianculovici

Page 2: How to Setup Ingres to Work with Your Applicationdownloads.actian.com/online/media/webcasts/vip/2008/05/... · 2017-08-08 · Why Ingres Database? Bells and Whistles Enterprise Developer

Why Ingres Database?

Bells andWhistles

Enterprise

Developer

SmallBusiness

Hobby

Closed Source Entry Level Closed Open Source

Feat

ure

Bre

adth

and

Dep

th

Total Cost of OwnershipExpensive Inexpensive

SybaseProgress

SQL Server

ORCL 10gIBM DB2Teradata

ExpressVersionsof closedsource

PostgresMySQL

INGRES

INGRES in DATAllegro

Slide 2© 2008 Ingres Corporation

Page 3: How to Setup Ingres to Work with Your Applicationdownloads.actian.com/online/media/webcasts/vip/2008/05/... · 2017-08-08 · Why Ingres Database? Bells and Whistles Enterprise Developer

Applications and Database Connectivity

Ingres Database

© 2008 Ingres Corporation Slide 3

Page 4: How to Setup Ingres to Work with Your Applicationdownloads.actian.com/online/media/webcasts/vip/2008/05/... · 2017-08-08 · Why Ingres Database? Bells and Whistles Enterprise Developer

Applications and Database Connectivity

Ingres Database

Ingres Tools and Applications

© 2008 Ingres Corporation Slide 3

Page 5: How to Setup Ingres to Work with Your Applicationdownloads.actian.com/online/media/webcasts/vip/2008/05/... · 2017-08-08 · Why Ingres Database? Bells and Whistles Enterprise Developer

Applications and Database Connectivity

There are various ways of classifying applications as far as the Ingres backend is concerned

Native Tools that are Ingres specific– Terminal Monitor, ABF, Embedded SQL, ICE– Visual SQL– OpenROAD

Standard (generic) Common tools that are used by different database systems– ODBC, JDBC, .NET– PHP, Python, Perl, Hibernate, Torque

© 2008 Ingres Corporation Slide 4

Page 6: How to Setup Ingres to Work with Your Applicationdownloads.actian.com/online/media/webcasts/vip/2008/05/... · 2017-08-08 · Why Ingres Database? Bells and Whistles Enterprise Developer

Applications and Database Connectivity

Other classifications are based on:

Performance Complexity New development / Legacy

© 2008 Ingres Corporation Slide 5

Page 7: How to Setup Ingres to Work with Your Applicationdownloads.actian.com/online/media/webcasts/vip/2008/05/... · 2017-08-08 · Why Ingres Database? Bells and Whistles Enterprise Developer

Choosing the right tools

This presentation is about how to connect existing or newly developed applications to Ingres

© 2008 Ingres Corporation Slide 6

Page 8: How to Setup Ingres to Work with Your Applicationdownloads.actian.com/online/media/webcasts/vip/2008/05/... · 2017-08-08 · Why Ingres Database? Bells and Whistles Enterprise Developer

Agenda

Ingres Remote Connectivity Using ODBC JDBC Connectivity VB.NET The Python DBI Driver Ingres Native Tools – Terminal Monitor Embedded SQL OpenROAD Choosing the right tools

© 2008 Ingres Corporation Slide 7

Page 9: How to Setup Ingres to Work with Your Applicationdownloads.actian.com/online/media/webcasts/vip/2008/05/... · 2017-08-08 · Why Ingres Database? Bells and Whistles Enterprise Developer

Ingres Remote Connectivity

Using V-nodes

© 2008 Ingres Corporation Slide 8

Page 10: How to Setup Ingres to Work with Your Applicationdownloads.actian.com/online/media/webcasts/vip/2008/05/... · 2017-08-08 · Why Ingres Database? Bells and Whistles Enterprise Developer

V-node Connectivity

Connecting using the SQL utility (Terminal Monitor)

© 2008 Ingres Corporation Slide 9

Page 11: How to Setup Ingres to Work with Your Applicationdownloads.actian.com/online/media/webcasts/vip/2008/05/... · 2017-08-08 · Why Ingres Database? Bells and Whistles Enterprise Developer

Using ODBC

Create an ODBC Data Source (DSN

© 2008 Ingres Corporation Slide 10

Page 12: How to Setup Ingres to Work with Your Applicationdownloads.actian.com/online/media/webcasts/vip/2008/05/... · 2017-08-08 · Why Ingres Database? Bells and Whistles Enterprise Developer

Using ODBC – Ingres DSN

© 2008 Ingres Corporation Slide 11

Page 13: How to Setup Ingres to Work with Your Applicationdownloads.actian.com/online/media/webcasts/vip/2008/05/... · 2017-08-08 · Why Ingres Database? Bells and Whistles Enterprise Developer

ODBC Connection – Excel Example

© 2008 Ingres Corporation Slide 12

Page 14: How to Setup Ingres to Work with Your Applicationdownloads.actian.com/online/media/webcasts/vip/2008/05/... · 2017-08-08 · Why Ingres Database? Bells and Whistles Enterprise Developer

ODBC Connection – Excel Example

© 2008 Ingres Corporation Slide 13

Page 15: How to Setup Ingres to Work with Your Applicationdownloads.actian.com/online/media/webcasts/vip/2008/05/... · 2017-08-08 · Why Ingres Database? Bells and Whistles Enterprise Developer

ODBC Connection – Code Example

MS Visual BasicDim con As ADODB.ConnectionDim rs As ADODB.RecordsetDim ConnStr As StringDim Query As String

Sub Main() Set con = New ADODB.Connection Set rs = New ADODB.Recordset ConnStr = "DSN=testdb" con.Open ConnStr

© 2008 Ingres Corporation Slide 14

Page 16: How to Setup Ingres to Work with Your Applicationdownloads.actian.com/online/media/webcasts/vip/2008/05/... · 2017-08-08 · Why Ingres Database? Bells and Whistles Enterprise Developer

ODBC Connection – Code Example

MS Visual Basic (continued)

Query = "SELECT date('now')" Do While Not rs.EOF currentDBDateAndTime = rs(1) rs.MoveNext Loop rs.Close

© 2008 Ingres Corporation Slide 15

Page 17: How to Setup Ingres to Work with Your Applicationdownloads.actian.com/online/media/webcasts/vip/2008/05/... · 2017-08-08 · Why Ingres Database? Bells and Whistles Enterprise Developer

JDBC / .NET

Ingres Database

© 2008 Ingres Corporation Slide 16

Page 18: How to Setup Ingres to Work with Your Applicationdownloads.actian.com/online/media/webcasts/vip/2008/05/... · 2017-08-08 · Why Ingres Database? Bells and Whistles Enterprise Developer

JDBC / .NET

Ingres Database

Ingres Tools and Applications

JDBC ApplicationJDBC Driver

.NET Data Provider

.NET Application

© 2008 Ingres Corporation Slide 16

Page 19: How to Setup Ingres to Work with Your Applicationdownloads.actian.com/online/media/webcasts/vip/2008/05/... · 2017-08-08 · Why Ingres Database? Bells and Whistles Enterprise Developer

JDBC / .NET

Ingres Database

Ingres Tools and Applications

Data Access Server

JDBC ApplicationJDBC Driver

.NET Data Provider

.NET Application

© 2008 Ingres Corporation Slide 16

Page 20: How to Setup Ingres to Work with Your Applicationdownloads.actian.com/online/media/webcasts/vip/2008/05/... · 2017-08-08 · Why Ingres Database? Bells and Whistles Enterprise Developer

JDBC Connectivity

Code example

Class.forName("com.ingres.jdbc.IngresDriver");Connection con = DriverManager.getConnection( "jdbc:ingres://localhost:II7/testdb", "ingres", "*****");Statement st = con.createStatement();query = "INSERT INTO mydate VALUES(date('now'))";st.execute(query);st.close();

© 2008 Ingres Corporation Slide 17

Page 21: How to Setup Ingres to Work with Your Applicationdownloads.actian.com/online/media/webcasts/vip/2008/05/... · 2017-08-08 · Why Ingres Database? Bells and Whistles Enterprise Developer

Other Standard Tools

The Ingres .NET Data Provider

© 2008 Ingres Corporation Slide 18

Page 22: How to Setup Ingres to Work with Your Applicationdownloads.actian.com/online/media/webcasts/vip/2008/05/... · 2017-08-08 · Why Ingres Database? Bells and Whistles Enterprise Developer

Other Standard Tools (continued)

C#: public sealed class IngresCommand : System.Data.Common.DbCommand, IDbCommand,

IDisposable, ICloneable VB.NET: NotInheritable Public Class IngresCommand Inherits System.Data.Common.DbCommand Implements IDbCommand, IDisposable, ICloneable

© 2008 Ingres Corporation Slide 19

Page 23: How to Setup Ingres to Work with Your Applicationdownloads.actian.com/online/media/webcasts/vip/2008/05/... · 2017-08-08 · Why Ingres Database? Bells and Whistles Enterprise Developer

Other Standard Tools (continued)

IngresCommand Class Example IngresCommand cmd = new IngresCommand( “SELECT id, name FROM employee WHERE id = ?”);

© 2008 Ingres Corporation Slide 20

Page 24: How to Setup Ingres to Work with Your Applicationdownloads.actian.com/online/media/webcasts/vip/2008/05/... · 2017-08-08 · Why Ingres Database? Bells and Whistles Enterprise Developer

Other Standard Tools (continued)

The Python DBI Driverimport ingresdbi

dc=ingresdbi.connect(vnode="prod",database="testdb")c=dc.cursor()c.execute("select date('now')")for row in c.fetchall(): dt = row[0]print dtdc.commit()c.close()dc.close()

© 2008 Ingres Corporation Slide 21

Page 25: How to Setup Ingres to Work with Your Applicationdownloads.actian.com/online/media/webcasts/vip/2008/05/... · 2017-08-08 · Why Ingres Database? Bells and Whistles Enterprise Developer

Ingres Native Tools – Terminal Monitor

Easiest to use– Just type the query, end it with \g <Enter> and see the

results of the query.

© 2008 Ingres Corporation Slide 22

Page 26: How to Setup Ingres to Work with Your Applicationdownloads.actian.com/online/media/webcasts/vip/2008/05/... · 2017-08-08 · Why Ingres Database? Bells and Whistles Enterprise Developer

Ingres Native Tools – Terminal Monitor

Used for running scripts– Example.sql:INSERT INTO test_table (col1, col2) VALUES (‘abc’, 123);\g

To run: sql database_name < Example.sql– copydb generates files that are later executed using

this command.

© 2008 Ingres Corporation Slide 23

Page 27: How to Setup Ingres to Work with Your Applicationdownloads.actian.com/online/media/webcasts/vip/2008/05/... · 2017-08-08 · Why Ingres Database? Bells and Whistles Enterprise Developer

Ingres Native Tools – Embedded SQL

C is the most common but there are packages for Pascal, Fortran, Cobol

It allows you to write SQL inside your program using your preferred programming language

Before going through the typical building steps, the program needs to be precompiled

© 2008 Ingres Corporation Slide 24

Page 28: How to Setup Ingres to Work with Your Applicationdownloads.actian.com/online/media/webcasts/vip/2008/05/... · 2017-08-08 · Why Ingres Database? Bells and Whistles Enterprise Developer

Ingres Native Tools – Embedded SQL (continued)

#include <stdio.h>EXEC SQL INCLUDE SQLCA;EXEC SQL BEGIN DECLARE SECTION; /* database name */ static char dbname[20]; /* query output */ static char output[100]; /* error message */ static char errmsg[100];EXEC SQL END DECLARE SECTION;

© 2008 Ingres Corporation Slide 25

Page 29: How to Setup Ingres to Work with Your Applicationdownloads.actian.com/online/media/webcasts/vip/2008/05/... · 2017-08-08 · Why Ingres Database? Bells and Whistles Enterprise Developer

Ingres Native Tools – Embedded SQL (continued)

main(){ strcpy(dbname,"testdb"); printf("Connecting to <%s> ... ", dbname); EXEC SQL WHENEVER SQLERROR CALL error; EXEC SQL CONNECT :dbname; printf("Done. \n"); EXEC SQL SELECT date('now') INTO :output; printf("Date/Time on the server is: %s\n",output);}

© 2008 Ingres Corporation Slide 26

Page 30: How to Setup Ingres to Work with Your Applicationdownloads.actian.com/online/media/webcasts/vip/2008/05/... · 2017-08-08 · Why Ingres Database? Bells and Whistles Enterprise Developer

Ingres Native Tools – Embedded SQL (continued)

error(){ EXEC SQL WHENEVER SQLERROR CONTINUE; EXEC SQL INQUIRE_SQL(:errmsg = ERRORTEXT); printf("\nAn error has occured: \n%s\n",errmsg); exit(1);}

© 2008 Ingres Corporation Slide 27

Page 31: How to Setup Ingres to Work with Your Applicationdownloads.actian.com/online/media/webcasts/vip/2008/05/... · 2017-08-08 · Why Ingres Database? Bells and Whistles Enterprise Developer

Ingres Native Tools – Embedded SQL (continued)

Precompile: esqlc myTest.sc Compile/link:

– Windowscl myTest.c /link ^ %II_SYSTEM%\ingres\lib\libingres.lib– UNIX (Linux)cc myTest.c -o myTest \$II_SYSTEM/ingres/lib/libingres.a -lm -lc –ldl \-lpthread

© 2008 Ingres Corporation Slide 28

Page 32: How to Setup Ingres to Work with Your Applicationdownloads.actian.com/online/media/webcasts/vip/2008/05/... · 2017-08-08 · Why Ingres Database? Bells and Whistles Enterprise Developer

OpenROAD

Open Rapid Object Application Development Platform independent

How to connectThere are three modes:– No connectivity– Specify a database (named)– Connect to the current database

© 2008 Ingres Corporation Slide 29

Page 33: How to Setup Ingres to Work with Your Applicationdownloads.actian.com/online/media/webcasts/vip/2008/05/... · 2017-08-08 · Why Ingres Database? Bells and Whistles Enterprise Developer

OpenROAD (continued)

© 2008 Ingres Corporation Slide 30

Page 34: How to Setup Ingres to Work with Your Applicationdownloads.actian.com/online/media/webcasts/vip/2008/05/... · 2017-08-08 · Why Ingres Database? Bells and Whistles Enterprise Developer

OpenROAD (continued)

© 2008 Ingres Corporation Slide 31

Page 35: How to Setup Ingres to Work with Your Applicationdownloads.actian.com/online/media/webcasts/vip/2008/05/... · 2017-08-08 · Why Ingres Database? Bells and Whistles Enterprise Developer

OpenROAD (continued)

Running the simple OpenROAD application

© 2008 Ingres Corporation Slide 32

Page 36: How to Setup Ingres to Work with Your Applicationdownloads.actian.com/online/media/webcasts/vip/2008/05/... · 2017-08-08 · Why Ingres Database? Bells and Whistles Enterprise Developer

OpenROAD (continued)

© 2008 Ingres Corporation Slide 33

Page 37: How to Setup Ingres to Work with Your Applicationdownloads.actian.com/online/media/webcasts/vip/2008/05/... · 2017-08-08 · Why Ingres Database? Bells and Whistles Enterprise Developer

OpenROAD (continued)

Other OpenROAD components

– Web deployment - eClient – OpenROAD Server – nTier Distribution– mClient - Mobile

© 2008 Ingres Corporation Slide 34

Page 38: How to Setup Ingres to Work with Your Applicationdownloads.actian.com/online/media/webcasts/vip/2008/05/... · 2017-08-08 · Why Ingres Database? Bells and Whistles Enterprise Developer

© 2008 Ingres Corporation Slide 35

Page 39: How to Setup Ingres to Work with Your Applicationdownloads.actian.com/online/media/webcasts/vip/2008/05/... · 2017-08-08 · Why Ingres Database? Bells and Whistles Enterprise Developer

The following need to be considered when choosing the tools

© 2008 Ingres Corporation Slide 35

Page 40: How to Setup Ingres to Work with Your Applicationdownloads.actian.com/online/media/webcasts/vip/2008/05/... · 2017-08-08 · Why Ingres Database? Bells and Whistles Enterprise Developer

The following need to be considered when choosing the tools

© 2008 Ingres Corporation Slide 35

Page 41: How to Setup Ingres to Work with Your Applicationdownloads.actian.com/online/media/webcasts/vip/2008/05/... · 2017-08-08 · Why Ingres Database? Bells and Whistles Enterprise Developer

The following need to be considered when choosing the tools

Complexity

© 2008 Ingres Corporation Slide 35

Page 42: How to Setup Ingres to Work with Your Applicationdownloads.actian.com/online/media/webcasts/vip/2008/05/... · 2017-08-08 · Why Ingres Database? Bells and Whistles Enterprise Developer

The following need to be considered when choosing the tools

Complexity Performance

© 2008 Ingres Corporation Slide 35

Page 43: How to Setup Ingres to Work with Your Applicationdownloads.actian.com/online/media/webcasts/vip/2008/05/... · 2017-08-08 · Why Ingres Database? Bells and Whistles Enterprise Developer

The following need to be considered when choosing the tools

Complexity Performance User interaction

© 2008 Ingres Corporation Slide 35

Page 44: How to Setup Ingres to Work with Your Applicationdownloads.actian.com/online/media/webcasts/vip/2008/05/... · 2017-08-08 · Why Ingres Database? Bells and Whistles Enterprise Developer

The following need to be considered when choosing the tools

Complexity Performance User interaction Legacy applications

© 2008 Ingres Corporation Slide 35

Page 45: How to Setup Ingres to Work with Your Applicationdownloads.actian.com/online/media/webcasts/vip/2008/05/... · 2017-08-08 · Why Ingres Database? Bells and Whistles Enterprise Developer

Confidential — © 2008 Ingres Corporation Slide 36

ResourcesIngres Connectivity Guide

Embedded SQL Companion Guideingres.com

community.ingres.com