db2

Successfully connect to DB2 using PHP NOT using ODBC?

…衆ロ難τιáo~ 提交于 2019-12-11 02:14:09
问题 Need to know if 1) anyone successfully made a connection and 2)queried a remote DB2 server using PHP, and 3) if so how? I installed the PECL extension for db2 [db2] extension=ibm_db2.so but can't figure out how to use it. All the examples I find use ODBC style dsn, I don't want to use ODBC. UPDATE: According to documentation here (http://www.redbooks.ibm.com/abstracts/sg247218.html) it is nominally possible to use the ibm_db2 driver (sans ODBC) but the methodology described therein is either

Output a DB2 SQL XML query to a unique XML file

老子叫甜甜 提交于 2019-12-11 01:55:25
问题 Simplifying, I produce a set of XML elements with a SQL query such as: SELECT XMLELEMENT(NAME "project", project) FROM project; <project>project1</project> <project>project2</project> ... Now I need to wrap this sequence into a main "projects" element, and output this in a nice indented XML file. I've tried as follows: db2 -x "SELECT XMLSERIALIZE(CONTENT XMLELEMENT(NAME "projects", XMLAGG(XMLELEMENT(NAME "project", project))) AS CLOB INCLUDING XMLDECLARATION) FROM project" >output.xml And I

Find related columns among hundreds of tables for future relational identification

旧城冷巷雨未停 提交于 2019-12-11 01:51:48
问题 I am using SQL Server 2016 to pull information out of our ERP system that is stored in a DB2 database. This has thousands of tables with no keys inside of them. When pulling tables from the system, I want to be able to identify matching column names in tables so I can start creating relationships and keys when building dimensions. Is there a way to create a query that will search my database for column names and list every table that uses that column name? I have been using OPENQUERY and

How to connect with a remote DB2 Server from another DB2 instance on AIX?

余生长醉 提交于 2019-12-11 01:37:49
问题 I have two instances on two separate AIX servers. Both DB2 databases are up with their sample databases. I want to connect with one DB2 instance from the other instance. I am new on DB2 and want to know how can I do that. I have executed following commands: This path is client instance: #. /home/db2inst2/sqllib/db2profile db2 catalog tcpip node db2serverinst remote lpar1 server 50005 remote_instance ctginst1 db2 => terminate DB20000I The TERMINATE command completed successfully. # db2 connect

WHERE Column IN from parameter in DB2 over SSIS

流过昼夜 提交于 2019-12-11 00:58:37
问题 I want to do the following command in a SSIS Package to DB2. UPDATE MyTable SET Col1 = ?, Col2 = ? WHERE Col3 IN (?) The Parameters are connected and the package is finished successfully but no row is updated. The Col3 contains values like 123 , 452 and so on and the third parameter is a string with a content like 345,432,456,432,667,123,456 . What have I to change to be able to update the rows? I tried it with the following. In SQL Server it would work but in DB2 not. UPDATE MyTable SET Col1

User and Password when Connecting to DB2 via JDBC

耗尽温柔 提交于 2019-12-11 00:46:59
问题 I am trying to connect to a local DB2 10.5 Express-C server. This is a testing environment so I don't care about security. I am able to connect to the Command Line Processor (running on Windows), and I changed the configuration settings for AUTHENTICATION=CLIENT and TRUST_ALLCLNTS=YES . I expected to be able to connect without authentication at that point (I restarted the DB2 service), but I still get an error. When I try to connect without username/password jdbc:db2://localhost:50000/test I

Calling a stored procedures within the same schema from a SP

谁都会走 提交于 2019-12-11 00:29:04
问题 How can I call a stored procedure in the same schema without specifying the full schema name when coding another stored procedure. These are SQL PL procedures within DB2. First SP: CREATE PROCEDURE MYSCHEMA.SP_TEST LANGUAGE SQL BEGIN END Creating a SP calling this SP directly without a schema name causes a compilation error: CREATE PROCEDURE MYSCHEMA.SP_TEST2 LANGUAGE SQL BEGIN CALL SP_TEST(); END It will throw: No authorized routine named "SP_TEST" of type "PROCEDURE" having compatible

how to pass input parameter as a string separated by comma or list for IN clause in DB2

半腔热情 提交于 2019-12-10 22:56:50
问题 I am new in stored procedure ,i have one doubt,I need to pass input parameter as a string separated by comma or list for IN clause in DB2. please see the below sample procedure CREATE PROCEDURE TEST_SP(IN @listofUsername) SPECIFIC TEST_SP DYNAMIC RESULT SETS 1 P1:BEGIN DECLARE CURSOR1 CURSOR WITH RETURN FOR SELECT F_NAME FROM TEST WHERE USER_NAME IN (@listofusername); } OPEN CURSOR1; END P1 Please guide me, 1 how to write the above stored procedure 2 Is it possible to pass any kind of list as

How does the Like predicate work in SQL?

旧街凉风 提交于 2019-12-10 22:28:17
问题 I have a field called OrderNumber and there's already a record with that field value of "JY8023". I tried querying using this SQL code, but it returned nothing. SELECT .... WHERE OrderNumber LIKE "JY8023" I also tried using wildcards and it worked SELECT .... WHERE OrderNumber Like "%JY8023%" So does that mean OrderNumber Like "JY9023" is not the same as OrderNumber = "JY8023" ? 回答1: the string has characters before or after it, that you can't see. try something like select length(OrderNumber

How to obtain current isolation level on DB2?

ⅰ亾dé卋堺 提交于 2019-12-10 22:22:26
问题 I am trying to learn how transactions work in DB and to do this I wrote the following test SQL: SAVEPOINT STOP_HERE ON ROLLBACK RETAIN CURSORS; INSERT INTO TESTSCHEMA."test" (ID, NAME) VALUES (89898, 'SDFASDFASD'); ROLLBACK TO SAVEPOINT STOP_HERE; SELECT * FROM TESTSCHEMA."test"; After execution of this code the one row is added into the table. But if I add the following line at the beginning: SET TRANSACTION ISOLATION LEVEL READ COMMITTED; all work as I expected, i.e. transaction correctly