Code Monkey home page Code Monkey logo

odbcexamples's Introduction

Informix ODBC Application Examples

Copyright (c) 2017 OpenInformix. All rights reserved.

Licensed under the Apache License, Version 2.0

ODBCExamples


The source code for Informix ODCB Examples are at src directory. The IfxOdbcSample1 directory has ODBC application build infrastructure; including a Visual Studio 2015 project.

SSL configuration setup

Client side SSL configuration setup needed for drivers to connect Informix server on the cloud.

Scenario: Connecting to a Informix server on AWS

Please see the official page for more up-to-date information and it is Getting started AWS
Let us consider a scenario we would like to run the sample application against an Informix server provisioned from AWS.

  • The database server may not have created a user that can be shared with applications.
  • A client computer on the internet connecting to this server will be using SSL connection.

Server Side Setup

SSH to the terminal system at AWS and do the following setup by using dbaccess

# The 'my-private-key1.pem' is the private key file you have created for your AWS
ssh -i ~/.ssh/my-private-key1.pem [email protected]

# Copy the certificate to the user folder that can be accessed later 
cd  /home/centos
sudo cp /home/informix/client_ssl/client.kdb .
sudo cp /home/informix/client_ssl/client.sth .
sudo chown centos client.kdb client.sth

# from remote (client) computer later you may scp those certificates as centos user
scp -i ~/.ssh/my-private-key1.pem  [email protected]:/home/centos/client.* .

DB Server Setup

sudo -u informix bash
dbaccess 


CREATE   database   db1  with log;

create user dbuser1 with password 'mypwd123' properties USER nobody authorization (DBSA);

GRANT CONNECT TO dbuser1;
GRANT DBA     TO dbuser1;

Copy the following two files to your client computer

/home/informix/client_ssl/client.kdb
/home/informix/client_ssl/client.sth

# it has been copied to /home/centos
scp -i ~/.ssh/my-private-key1.pem  [email protected]:/home/centos/client.* .

# to avoid security risk, once after copied the certificate files to the client computer, you may delete 
rm /home/centos/client.kdb
rm /home/centos/client.sth

Client Side Setup

On your client computer copy client.kdb and client.sth to a secure location
let us say you have decided to put it at c:\informix\etc\ssh on your windows client and $INFORMIXDIR/etc/ssh on your Linux client. Then update the information in $INFORMIXDIR/etc/conssl.cfg of your client computer. The $INFORMIXDIR is the locaiton where you have installed Informix Client SDK.

Windows: c:\informix\etc\conssl.cfg
SSL_KEYSTORE_FILE c:\informix\etc\ssl\client.kdb
SSL_KEYSTORE_STH  c:\informix\etc\ssl\client.sth
Linux: $INFORMIXDIR/etc/conssl.cfg
SSL_KEYSTORE_FILE $INFORMIXDIR/etc/ssh/client.kdb
SSL_KEYSTORE_STH  $INFORMIXDIR/etc/ssh/client.sth

You are ready to run your application ((ODBC, OLE DB, ESQLC, .NET, Noede.js, Python, R)

Here is a sample connection string that you may use it for ODBC application to connect to the database. The same setup is applicable for application using these the folloing Informix drivers
ODBC, .NET, Noede.js, Python, R, ESQLC and OLE DB.

char   *MyLocalConnStr = 

"DRIVER={IBM INFORMIX ODBC DRIVER (64-bit)};HOST=ec2-54-196-209-131.compute-1.amazonaws.com;\
SERVER=ol_aws;SERVICE=9089;PROTOCOL=olsocssl;DATABASE=db1;UID=dbuser1;PWD=mypwd123;\
CLIENT_LOCALE=en_us.8859-1;DB_LOCALE=en_us.utf8";

Reference links


Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.