Home Database Mysql Tutorial 保护与IBM Informix JDBC、ODBC和ESQL/C驱动程序的连接

保护与IBM Informix JDBC、ODBC和ESQL/C驱动程序的连接

Jun 07, 2016 pm 05:54 PM
ibm jdbc odbc

为数据源使用连接池可能会导致基于角色的安全性破坏。IBM Informix 服务器中对可信连接和可信上下文的支持能够灵活地重用连接,向中间层授予受控的权限,以及在三层应用程序中加强用户责任性而不损害其数据库安全性,所有这些都改善了系统性能。

本文将讨论可信连接和可信上下文,展示如何使用 JDBC、ESQL/C 和 ODBC 驱动程序管理可信上下文。

在传统的三层应用程序模型中,您只有在成功授权之后才能与交互,检查和审计由中间层执行。即使有多个用户登录到中间层,中间层也仅使用单个用户 ID 来访问,而且会在所有资源上授予权限。此模型无法获取尝试访问数据库的实际用户身份,以进行访问控制。另外,如果中间层用户 ID 被盗用,可能导致严重的安全威胁。

为了在中间层服务器与数据库服务器之间实现惟一的交互组,Informix 中引入了可信数据库连接 的概念。可信上下文 是在数据库服务器上创建的一种数据库安全对象,它定义了一个可信数据库连接的属性。在连接属性与 Informix 服务器上定义的惟一可信上下文属性匹配时,就会建立可信连接。中间层服务器建立可信连接后,可重用同一个物理连接,而无需在数据库服务器上对最终用户重新进行身份验证。

从应用程序开发人员的角度讲,可信连接的重要性离不开这样一个事实:单个数据库连接可与其他用户共享,同时维护每一个尝试访问数据库的应用程序或用户的 ID。对用户权限的控制有助于适当地授予或限制用户对敏感资源的访问,进而提高系统安全性和用户责任性。

使用 Informix 客户端驱动程序管理可信上下文

在本节中,您将学习如何创建、修改和丢弃一个可信上下文。要创建和管理可信上下文,您的应用程序必须通过 TCP/IP 连接 Informix 服务器。以下 Informix 客户端驱动程序通过公开后面几节中将探讨的相关 API 来支持可信连接。

  • IBM Informix JDBC 驱动程序
  • IBM Informix ODBC 驱动程序
  • IBM Informix ESQL/C 驱动程序

建立可信连接

使用 JDBC 驱动程序

要在 JDBC 应用程序中请求一个可信连接,可将 TRUSTED_CONTEXT = TRUE; 属性包含在数据库 URL 中,如清单 1 中所示。

清单 1. 使用 JDBC 驱动程序连接

				
  jdbc:informix-sqli://hostname:portnumber/database_name:INFORMIXSERVER = server_name;
  TRUSTED_CONTEXT = TRUE;
Copy after login

使用 ODBC 驱动程序

以下是通过 ODBC 建立可信连接的两种方式,一个示例如清单 2 中所示。

使用 SQLSetConnectAttr() API:
SQLSetConnectAttr(hdbc1,SQL_ATTR_USE_TRUSTED_CONTEXT,SQL_TRUE,SQL_IS_INTEGER));

使用连接字符串参数:
TRUSTEDCONTEXT=1; 或 TCTX=1;

清单 2. ODBC 驱动程序的样例连接字符串

"Server=ol_informix_1170;Host=9.124.123.54;Service=ol_informix_1170;Protocol=onsoctcp; Database=stores7;TRUSTEDCONTEXT=1;"

使用 ESQL/C 驱动程序

在 ESQL/C 中,可信连接使用 TRUSTED 关键字和连接语句,以及用户名和密码来建立,如清单 3 中所示。

清单 3. 使用 ESQL/C 驱动程序连接

				
  EXEC SQL CONNECT TO 'database_name' USER 'informix' USING :infx_passwd TRUSTED;
Copy after login

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1663
14
PHP Tutorial
1263
29
C# Tutorial
1236
24
After Java8 (291), TLS1.1 is disabled and JDBC cannot connect to SqlServer2008 using SSL. How to solve the problem? After Java8 (291), TLS1.1 is disabled and JDBC cannot connect to SqlServer2008 using SSL. How to solve the problem? May 16, 2023 pm 11:55 PM

After Java8-291, TLS1.1 is disabled, so that JDBC cannot connect to SqlServer2008 using SSL. What should I do? The following is the solution to modify the java.security file 1. Find the java.security file of jre. If it is jre, go to {JAVA_HOME}/jre/ In lib/security, for example????C:\ProgramFiles\Java\jre1.8.0_301\lib\security. If it is the Eclipse green installation-free portable version, search for java.security in the installation folder, such as????xxx\plugins \org

Java Errors: JDBC Errors, How to Solve and Avoid Java Errors: JDBC Errors, How to Solve and Avoid Jun 24, 2023 pm 02:40 PM

With the widespread application of Java, JDBC errors often occur when Java programs connect to databases. JDBC (JavaDatabaseConnectivity) is a programming interface in Java used to connect to a database. Therefore, a JDBC error is an error encountered when a Java program interacts with a database. Here are some of the most common JDBC errors and how to solve and avoid them. ClassNotFoundException This is the most common JDBC

How to implement JDBC batch insert in Java How to implement JDBC batch insert in Java May 18, 2023 am 10:02 AM

1. Explain that in JDBC, the executeBatch method can execute multiple dml statements in batches, and the efficiency is much higher than executing executeUpdate individually. What is the principle? How to implement batch execution in mysql and oracle? This article will introduce to you the principle behind this. 2. Experiment introduction This experiment will be carried out through the following three steps: a. Record the time consuming of jdbc batch execution and single execution in mysql; b. Record the time consuming of jdbc batch execution and single execution in oracle; c. Record the batch execution and single execution of oracleplsql. The execution time-consuming related java and database versions are as follows: Java17, Mysql8, Oracle

How to install ODBC on Linux to connect to SQLServer database How to install ODBC on Linux to connect to SQLServer database May 16, 2023 pm 12:19 PM

Operating system: Centos7.21. Download the ODBC installation package unixODBC-2.3.9.tar.gzfreetds-1.3.9.tar.gz2. Installation steps. Step 1: Upload two installation packages to the server. Step 2: Install unixODBC. Install this first, then install freetds. Note: If the installation order is inconsistent here, the libtdsodbc.so driver file will not be generated (very important) 2.1. The operating system first installs gcc: yuminstallgcc2.2, and installs odbctar-xvfunixODBC-2.3.9.tar .gzcdunixODBC-2.3.9./conf

How to analyze JDBC programming in MySQL How to analyze JDBC programming in MySQL May 30, 2023 pm 10:19 PM

1. Prerequisites for database programming Programming languages, such as Java, C, C++, Python and other databases, such as Oracle, MySQL, SQLServer and other database driver packages: Different databases provide different database driver packages corresponding to different programming languages. For example: MySQL provides the Java driver package mysql-connector-java, which is required to operate MySQL based on Java. Similarly, to operate Oracle database based on Java, Oracle's database driver package ojdbc is required. 2. Java database programming: JDBCJDBC, JavaDatabaseConnectiv

Common problems encountered in Java using JDBC API to connect to MySQL database Common problems encountered in Java using JDBC API to connect to MySQL database Jun 10, 2023 am 09:55 AM

In recent years, the application of Java language has become more and more widespread, and JDBCAPI is a creative method for Java applications to interact with databases. JDBC is based on an open database connection standard called ODBC, which enables Java applications to connect to any database. management system (DBMS). Among them, MySQL is a popular database management system. However, developers will also encounter some common problems when connecting to MySQL databases. This article aims to introduce the JDBCAPI connection M

IBM unveils latest tool suite to move next-generation artificial intelligence development to mainframe platforms IBM unveils latest tool suite to move next-generation artificial intelligence development to mainframe platforms Sep 28, 2023 pm 07:37 PM

IBM recently announced a new set of products that build on the recently launched generative AI coding capabilities for mainframe developers to make it easier to run artificial intelligence on their older data center hardware. IBM said in an update to IBMZ Designed to help customers improve business outcomes by implementing business AI across multiple industries and use cases, it includes a new set of developer toolkits supporting the most widely used AI frameworks and Python programming language, enhancements to Machine Learning forz/OS , and performance improvements in the IBMz/OS mainframe operating system. IBM said these updates will allow clients to improve the accuracy of policy advice, improve the reliability and timeliness of anti-money laundering controls, and reduce

Embrace AI and lay off 8,000 people! Century-old giant IBM's 'Guangzhou Expansion Plan” has begun Embrace AI and lay off 8,000 people! Century-old giant IBM's 'Guangzhou Expansion Plan” has begun Mar 18, 2024 am 09:40 AM

IBM suddenly announced a new round of layoffs! IBM's chief communications officer announced the news at the latest seven-minute staff meeting. This time it will mainly focus on the marketing and communications departments. Although IBM did not issue a formal statement on the scale of layoffs, as recently as January this year, they announced that they would lay off 3,400 people. The company's CEO Arvind Krishna said earlier that the company will replace 8,000 jobs with artificial intelligence in the next five years. This whole sudden operation directly confused the employees...Have these 8,000 people started laying off employees long ago△Source: One Acre and Three Minutes According to statistics from relevant websites, about 204 technology companies have laid off employees so far this year Nearly 50,000 people. Including Google parent company Alphabet, Amazon

See all articles