Giter Site home page Giter Site logo

-ibmi_netstat_py's People

Contributors

alanseiden avatar chrjorgensen avatar jordiwes avatar theprez avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

-ibmi_netstat_py's Issues

Allow omission of user/password on db connection

With the latest version of the ibm_db Python adapter you can now omit the user/password and it will run under the profile that is invoking the script. Below is a sample script. Note the use of None.

Btw, I just got this working on Litmis Spaces if anyone wants to take a swing at it and doesn't yet have the latest PTFs on their machine.

import ibm_db
db_name = '*LOCAL'
schema = '<insert Schema>'
username = None
password = None
try:
  conn = ibm_db.connect(db_name, username, password)
except:
  print("no connection:", ibm_db.conn_errormsg())
if conn:
  result_set = ibm_db.exec_immediate(conn, "SET SCHEMA " + schema)
  result_set = ibm_db.exec_immediate(conn, "CREATE TABLE CUSTOMER ( CUSNUM NUMERIC(6, 0), LSTNAM VARCHAR(50) )")
  result_set = ibm_db.exec_immediate(conn, "INSERT INTO CUSTOMER VALUES(123,'Smith')")
  result_set = ibm_db.exec_immediate(conn, "SELECT * FROM CUSTOMER")
  ibm_db.fetch_row(result_set)
  print(ibm_db.result(result_set, 0))
  print(ibm_db.result(result_set, 1))
  ibm_db.close(conn)
else:
  print ('connection failed')

Supply database name and credentials with variables

Instead of:
conn = ibm_db.connect('dbname', 'username', 'password', {})
set and pass in variables, which will make the example easier to understand and modify:
conn = ibm_db.connect(db_name, username, password, {})

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.