db2 1 « db2 « Java Database Q&A





1. DB2 Java user defined function    stackoverflow.com

I'm trying to write a Java function for my DB2 database. When my class is in SQLLIB/Function all is working great. Now i need to change the path of the class to another ...

2. Java JDBC: Reply.fill()    stackoverflow.com

I get the following exception at times:

com.ibm.db2.jcc.b.gm: [jcc][t4][2030][11211][3.50.152] A communication error occurred during operations on the connection's underlying socket, socket input stream, or socket output stream. ...

3. How to make JDBC SQLExceptions for DB2 more descriptive?    stackoverflow.com

How to make SQLExceptions thrown by DB2 JDBC driver more descriptive? Currently I am getting this kind of exceptions. It is cumbersome to work with these cryptic SQLCODE and SQLSTATE numeric values. ...

4. how to know if storedproc executed successfully    stackoverflow.com

I am trying to execute a stored proc in java. I know I have to connect to database and do the stuff.... But the thing is How do I know that if that ...

5. changing from was-ce server to any other server?    stackoverflow.com

I have created a j2ee project using:

1)DB2 (as database server)
2)WAS-CE server to deploy the application
3)eclipse to code.
as was-ce server is running too slow I want to change to any other server. my ...

6. DB2 unique index and autonumbering    stackoverflow.com

Having gotten an answer to a Java problem I had last week (thanks!), I'm now on to a new problem with DB2... The Java app I'm working on takes data ...

7. jdbc data comparision    stackoverflow.com

I want to compare content of 15 columns in two rows. I am using db2 9 with jdbc. Can I use a sql to get a result like "match or not match"


And ...

8. DB2 BIGINT id generator    stackoverflow.com

I have the following class loaded into DB2 9.7.4 Express-C for generating ids for rows

public class Int64UUID {

    public static final long dx =  30*386*12*30*24*3600*1000; // starting ...

9. How to check installation of Db2 express c using java    stackoverflow.com

I am using command db2licm -l in batch file to check the installation of DB2 express c edition on local system. I have made a regular expression in java that search for ...





10. I cant select in DB2    stackoverflow.com

I have an application consisting of: Spring, WebSphere, accessing DB2 jdbc. Everything is set up ok, the application is usually published, because when I go to select a seat at any table ...

11. How to identify DB2 port number    stackoverflow.com

I have to make DB2 connection in java using port number. Is there any command in DB2 or any way that can get the DB2 port number? I have not used the default ...

12. Serialize an object to db2    coderanch.com

Hi I am trying to serialize an object into the db2. The column name on my table for the object is type blob. I do the followings to write to the db: ByteArrayOutputStream output = new ByteArrayOutputStream(); ObjectOutputStream OutputStream = new //pc is my object ObjectOutputStream(output); OutputStream.writeObject(pc); byte[] pcByte = output.toByteArray(); I then pass pc Byte to my stored procedure where ...

13. Java and DB2    coderanch.com

Thanks Ray I converted their code to db2 drivers and it almost compiles but I get a "Type expected" error on the System.out.println !! I don't think I've seen this error on this statement, any suggestions ? and from others it seems I need to install db2 connect on my server which I'm doing now.

14. DB2 access from browser using JDBC    coderanch.com

My project needs to access DB2 using JDBC. It runs on different machine (Unix, Solaris) from DB2 (AIX). After unix administrator installed DB2 client software and modified the global profile (adding db2profile there), I can run a stand-alone program to access DB2. However, if I integrate the program into a web application and run it from browser, it can't load jdbc ...

15. JDBC 2.0 And DB2    coderanch.com

16. getTableName(int) with DB2 is not working right    coderanch.com

Hi, I just want to retrieve the table name associated to a column ( for sql orders with multiple tables ) with DB2. However, it always returns "". However, the values and column names are retrieved correctly. I tried to prefix everything in my sql orders : ( select table_name.field_name from schema.table_name ). It always returns ""! Is there a problem ...





17. DB2 Sequence    coderanch.com

18. JDBC 2.0 on DB2 server V6.1    coderanch.com

19. DB2 JDBC    coderanch.com

20. DB2 VARCHAR Truncation    coderanch.com

I running an nt client w/ IE 5.x, apache web server, JRUN, and DB2 on an OS/390. I have a data truncation problem when inserting a row into a column defined as a VARCHAR(3000). Only 255 out of 1000 bytes is being inserted. Any ideas... [This message has been edited by Monty Ireland (edited December 14, 2001).]

21. jdbc driverers for IBM DB2    coderanch.com

22. DB2 - restore database ***help***    coderanch.com

I had a problem with my DB2 program so I uninstalled it and reinstalled. Before removing it I backed up my database, but now I can't restore it in the new installation as it is looking for backup history that is no longer there after removing it. How can I create a database from a backup file in a completly dif ...

23. How to Store Java Object to DB2 Database    coderanch.com

Sorry for that, I updated the displayed name. I have stored serialized object to the db as BLOB, I know it is not a good way to do it, but sometimes the business logic is very complicated, if we store it as object, it will bw very easy to do it. Thanks. Adam

24. Java Value Bean Generator for DB2 etc?    coderanch.com

25. DB2 - case sensitive or not    coderanch.com

26. RowSet Problem in DB2    coderanch.com

27. Problem accessing MetaData with DB2    coderanch.com

28. jdbc access to DB2    coderanch.com

29. Import MS Access Database into DB2    coderanch.com

I had a similar case when I needed to export SQL Server database to DB2. I first generated the DDL commands, and executed them on DB2, then I exported each table data into a text file, and then imported that file in DB2. I'm not sure if there is an easier way, but my trial did work.

30. DB2 help    coderanch.com

Hi Maria. For product related information, the best sources I 've got so far are the product manuals themselves. In Windows/UNIX/Linux platform, you can find good info on Application Building Guide, Application Development Guide and Developing Enterprise Java Applications. In the Mainframe you have the Application Programming Guide and Reference for Java, which covers installation, administration and even SQLJ. In Java ...

31. DB2 - Changing TimeZone    coderanch.com

Hi Sushil. I don't think so. What is in the table doesn't get changed unless you specifically command to do so. I believe up to V7, DB2 just stores the timestamp value and no related time zone for conversions. In other words, it know only what timestamp value is in the column, but has no clue of what time zone you ...

32. Reg DB2 sample database    coderanch.com

hi, How to re-create db2 sample database?? In FirstStepts I got this error: The database alias "SAMPLE" already exists in either the local database directory or system database directory. SQL1013N The database alias name or database name "SAMPLE" could not be found. SQLSTATE=42705 but in db2command window i got this error: db2 => connect to sample SQL1013N The database alias name ...

33. JDBC DB2 OS390    coderanch.com

I want to connect to a DB2 OS/390 V6 database through DB2Connect V8. I get a connection, but in the ControlCenter I cannot see the tables. In the CommandCenter I can get the tables via a "Select-Statements". Also I can`t get the Tables in WSAD 5.0. So is there a problem with DB2 OS/390 V6 and DB2 Connect V8? Or do ...

34. JDBC2.0 for DB2    coderanch.com

Hi friends i am using 1>I am using IBM DB2 ODBC Driver 7.01.00.00 DB@CLI.dll the problem is i cannot use the cursor & record set types other then the default one .I thing the driver supports only JDBC1.0.So can any one suggest where I can get driver for DB2 which supports JDBC2.0 2>The other point for which I would like to ...

35. suprised ...db2    coderanch.com

36. Broken Pipe message in DB2    coderanch.com

Periodically, we have been receiving an IOException using the HIT JDBC DB2 driver HIT SW with a DB2 database connection. The message associated with IOException references a "Broken pipe". I know from my socket programming background that a broken pipe message is normally encountered when the server severs the socket connection to the client. However, the database adminstrators (at a remote ...

37. DB2    coderanch.com

38. As/400 Db2 Jdbc    coderanch.com

39. the problem of DB2    coderanch.com

40. DB2 and automated PK genearation..    coderanch.com

Hi.. I'm using DB2 for a project.. I want to be able to genearate an automated PK which can just be a serial number like 1, 2,3..... So I want to know that how can i do that with DB2 Secondly, When i insert I want to know what was the PK that was genearted.. so how can i do that.. ...

41. SP in DB2 using Java    coderanch.com

42. Problem calling stored proc in DB2 (Using Visual Age For Java)    coderanch.com

Hi, I am trying to execute a stored proc in DB2 using jdbc. Am getting an error on this stetement: stmt.execute(); where stmt is an instance of CallableStatement. The Error message is : COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2/SUN] SQL10013N The specified library "" could not be loaded. Where is the name of my stored proc. Note: 1)the connection is established succesfully and ...

43. question on db2 sum function    coderanch.com

hello, guys: I have a question about sum function using DB2. I am using DB2 Universal Database Version 7.2 (persona; edition) on Win 2000. If I have 2 tables: create table person{ person_id char(10) not null, ..... primary key(person_id) }; create table job{ job_id char(20) not null, start_date TIMESTAMP; stop_date TIMESTAMP; person_id char(10), primary key(job_id) }; You can see from the ...

44. decode in db2    coderanch.com

I have a requirement like if payment_type = 's' then compensation is weekly_rate * 4 but if weekly_rate is 0 or null then compensation is 0 if payment_type = 'p' return the value in gross_amount column. Below is the decode function I have used. Would like to know how to do the same using db2 functions. Decode(payment_type, s, (decode(nvl(weekly_rate,0.00),0.00,0.00, weekly_rate*4)) ,p,gross_amount) ...

45. StartsWith function in DB2    coderanch.com

DB2 is a database not a programming language. I'm not aware of any built in search functions. You can define a field to be a substring of another field, but I don't think that's what you are looking for. A SQL example on an i-series machine would look like this: SELECT * FROM library/file WHERE upper(field) like 'G%' Note: you do ...

46. calling DB2 SP from Java    coderanch.com

47. DB2 Compatable Database ?    coderanch.com

Hi, I have an scnairo where we need to develop an application on some freeware database like,MYSQL or Postgres and then migrate it to DB2. Now I need help in knowing which database will be more compatible with DB2,I mean to ask with respect to functions supported. also I have heard abt some limitations in sub queries by MSQL. And lastly ...

48. DB2 : about the CASCADE update/delete    coderanch.com

Hi, I am not sure whether this is the right fourm to post this type question. please excuse me. while runnig this sql on db2control center i am getting sqlcode : -104 sqlstate : 42601 how to set the casecade delete and update on sinle command CREATE TABLE TEST_CD ( ORDER_DATE TIMESTAMP NOT NULL, ORDER_ID VARCHAR(16) NOT NULL , STORE_ID INT ...

49. setArray(...) in DB2    coderanch.com

50. is db2 by default 'servicing' jdbc 1? or 2?    coderanch.com

Jesus, There is no "Default" when it comes to database drivers. It uses whichever driver you have told it to use ( The whole Class.forName or DriverManager.registerDriver() part in your code ). So, if you want to be sure, download the latest jdbc drivers available for your version of DB2, then you'll know that you are not using a legacy/out-dated driver. ...

51. Connectind DB2 from Java    coderanch.com

52. How do I get auto-generated key by DB2    coderanch.com

I am inserting a row into a table in DB2 and DB2 provides an auto-generated key into the primary key column. After the insert I am retreiving that value by "SELECT IDENTITY_VAL_LOCAL() FROM SYSIBM.SYSDUMMY1", but the problem is how do I know that this is the ID that DB2 has generated for the above insert.. How do I ensure that no ...

53. DB2 Question    coderanch.com

I am starting on a project and right now I am at the beginning stages of developing the database. My idea is that I want this to work within other projects. The way I decided to handle this is by creating a few DB2 tables. The driving DB2 table in this project will be the Section table with fields: (Report_Num; Sec_Num; ...

54. java web-jdbc-mvs db2    coderanch.com

55. Problem with DB2 in Web Project    coderanch.com

56. backup & restore of db2 database    coderanch.com

58. How to read/write text file to db2 by using java code    coderanch.com

Hai I created the table to insert a clob data as follows db2 => create table ctest(datas clob(65536)) DB20000I The SQL command completed successfully. db2 => describe table ctest Column Type Type name schema name Length Scale Nulls ------------------------------ --------- ------------------ -------- ----- ----- - DATAS SYSIBM CLOB 65536 0 Yes 1 record(s) selected. //////////////////////////////////////////// I tried the following java code ...

59. Problem in writing file to db2 database    coderanch.com

Hai I created the table to insert a clob data as follows db2 => create table ctest(datas clob(65536)) DB20000I The SQL command completed successfully. db2 => describe table ctest Column Type Type name schema name Length Scale Nulls ------------------------------ --------- ------------------ -------- ----- ----- - DATAS SYSIBM CLOB 65536 0 Yes 1 record(s) selected. //////////////////////////////////////////// I tried the following java code ...

60. Disabling constraints in DB2    coderanch.com

I am making a JDBC-based application that generates sql scripts to migrate data between databases (even between db vendors). I have one for SQL2000, now I need one for DB2. The schema has foreign key (FK) constraints, so the mass import needs to shut this off before calling sql insert statements. In SQL2000, I use this command to disable FK constraints: ...

61. DB2 Concurrency issue    coderanch.com

DB: DB2 V7 I am having a concurrency issue. The web-system that I am building is for administrators. They will have the ability to change associate information. I will have a table that stores this information. The problem I am running into is: If two admins were logged in and they were making changes to the same employee. The first admin ...

62. Simple question about using JDBC to access DB2    coderanch.com

Originally posted by Bear Bibeault: "George George", Your display name must be a first and last name -- not your first name twice. Please adjust your display name to be a first and last name prior to your next post. Be advised that accounts with invalid display names are subject to removal. bear JavaRanch Sheriff

63. Java - DB2 Conncectivity    coderanch.com

64. java DB2 program    coderanch.com

i log in my mainframe environment using my user id and password .. After that i go to QMF and fire my DB2 queries... I want to read the DB2 tables , through my JAVA program..can anybody please guide on how i can od the connection to the DB2 database and what drivers are required..i am using Java 1.4 i know ...

65. db2 rowid jdbc problem    coderanch.com

66. Calling a DB2 UDF within Java    coderanch.com

67. how to determine DB2 OS?    coderanch.com

It's IBM, and the documentation will be there, but not all in one place. The value for each platform will be listed in the platform specific DB2 documentation. And I saw at least one case (a filed APAR, a bug) where a driver was retruning only 'DB2' when connected to zOS. Good luck. Guy

68. pass two bytes of space to DB2    coderanch.com

69. Passing parameter to view in DB2    coderanch.com

Hi scott, Thanks for your time. My requirement is i need to filter out the data based on the user input, and i think this cant be acheived in view, since view didn't support the parameter. what exactly i need to do is write the stored procedure which will use the view and user input to filter out the invalid records. ...

70. Help for Dynamically changing sort by field and order by clause, in db2 procedure    coderanch.com

Hello, i have requirement where i have to do order by on the field that i give as input to the store procedure.Also i have to change the sorting direction, ASC or DESC folowing is the stored proc i tried.Although its error free and getting deployed .the result returned on execution is,not sorted as per the input i gave. CREATE PROCEDURE ...

71. Where can I find JDBC for DB2 9.    coderanch.com

72. JDBC DB2 Type 4    coderanch.com

73. retrive data from db2 as month and year wise    coderanch.com

hi everyone and good morning i have problem , in my jsp page there is option for month and year .in the month drop down list of month it coming and in year drop down list of year it s coming . now i have to get the data from db2 based on selection of month and year .but in db2 ...

74. Problem in accessing data from DB2 v9    coderanch.com

75. Create DB2 database    coderanch.com

import java.sql.*; import java.io.*; public class DBTry { public static void main(String s[]) throws IOException, SQLException { Connection conCopyTo = null; try { //retreive connection for DB2 String url = "jdbc:db2://localhost:50000/default"; String userId = "sajal"; String pwd = "admin"; Class.forName("com.ibm.db2.jcc.DB2Driver"); conCopyTo = DriverManager.getConnection(url, userId, pwd); System.out.println("ConvertAcc2DB2:ConCopyTo:"+conCopyTo); } catch(Exception e) { System.out.println(e); } try { PreparedStatement psc=conCopyTo.prepareStatement("Create database DBtry"); int updatec=psc.executeUpdate(); System.out.println("Database ...

76. DB2 V9.1 for z/OS    coderanch.com

77. Help required - returning 20 records from DB2    coderanch.com

I am creating a servlet that executes a query and accordingly writes out the results to a table in HTML. However, I need to refine it further. I need it to build only for 20 records a page. It needs to have a NEXT and PREVIOUS button to traverse through the records and enable the user to browse accordingly. Does someone ...

78. DB2 StaleConnectionException    coderanch.com

Hi All, I am getting following exception when I am trying to connect to DB2 database. I have created a datasource on WAS 6.0. Its showing me connection successful from WAS admin console. But when I am running the application, its giving following exception : 11/4/08 10:31:06:018 IST] 0000002c StaleConnecti A CONM7007I: Mapping the following SQLException, with ErrorCode -30081 and SQLState ...

79. DB2 stored proc returning a results set    coderanch.com

80. db2 express-c 9.7 failure in loading t2 native library db2jcct2    coderanch.com

This is ma first db2 code using windows xp sp2 import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.sql.*; import java.lang.*; import java.io.*; import COM.ibm.db2.jdbc.app.*; public class Type2ExampleLegacy { public static void main(String[] args) { try { // load the DB2 Driver Class.forName("com.ibm.db2.jcc.DB2Driver"); //Class.forName("COM.ibm.db2.jdbc.app.DB2Driver"); // establish a connection to DB2 Connection db2Conn = DriverManager.getConnection("jdbc:db2://localhost:50000/das","root","root"); // use a statement ...

81. commit - asynchronous or synchronous? (DB2)    coderanch.com

Hello, We are observing behaviour with our applications that would imply that a call to commit is non-blocking and simply schedules a commit at the database rather than executing it and waiting for completion. Scenario: We have two command-line applications, one launched immediately after the other, both connecting to the same DB2 database. App1 modifies data in the database, calls a ...

82. DB2    coderanch.com

83. DB2    coderanch.com

Hi, I want the query for this: I have a table called ABC where I have many columns including ABC_ID, ABC_BGN_DT, ABC_END_DT. Now this ABC_ID is a foreign key in my another table ABC_YER. This table contains values for that ABC_ID beginning from ABC_BGN_DT to ABC_END_DT(one year in each table). Now I want to query this second table(ABC_YER) for any duplicates/not ...

85. DB2 console    coderanch.com

87. Slow DB2 initial con thru Win machine? (16-20 secs!)    dbforums.com

Hey guys, I was wondering if anyone else was suffering from this. I am getting a horribly slow connection from my WinXP dev machine to the DB2 v8.1.4 database on an AIX server. On my WinXP machine I have DB2 v8.1 Client with FP 4 installed using JDBC 2.0. I am using WSAD 5.1 to do my Java dev. I can ...

88. DB2 Administrative API for Java    dbforums.com

HI all I gotta DB2 C Administrative API . it's a very useful but why doesn't IBM support Administrative API for Java ? What can I do for using Administrative API in Java Language ? so, Now I am trying to make a Java Wrapper API using JNI. is that right way??

90. JAVA calls to DB2 comp-3 data concern    dbforums.com

From JAVA how can I read the following element in a IBM mainframe DB2 table using DB2Connect. I need to access the 6th occurance of the data embedded within this DB2 column. The DB2 column name is G_AGCY_CO_STAT_TB It consists of 54 characters. In COBOL the DCLGEN of this 54 bytes is defined as 05 G-AGCY-CO-STAT-TB. 05 G-tab redefines G-AGCY-CO-STAT-TB occurs ...

91. DB2 and Java getTables problem    dbforums.com

Sorry for the DB2/Java cross post, I was not sure who could best answer my question) Hi I am having a problem getting db tables from a DB2 mainframe over ODBC (I have to use ODBC). I connect with the below code and write out the table and column names rather than getting the correct table and column names for this ...

92. JDBC executeBatch and DB2    dbforums.com

DB2 on an OS/390 platform. Merant JDBC driver I am trying to execute several SQL statement in a batch mode to increase perfomance. Unfortunately, each statement can be a different type (Add, Change, Delete) to a different table so I can't use preparedStatments. I am just using the Statement object and using addbatch( ) to add them to the batch ...

93. Java getResultSet ACCESS vs DB2    dbforums.com

I am running the followig code against Access 2000: cr = SqlManager.singleton().executeRetrieveSQL(sql); while (cr.getResultSet().next()) { courtOrder = new CourtOrderBean(); if (cr.getResultSet().getObject("CT_BRCH_NB") != null) { courtOrder.setBranch((String) cr.getResultSet().getObject("CT_BRCH_NB")); } In this case the CT_BRCH_NB is not null so the I continue into the If-statement. When I execute the courtOrder.setBranch.... statement, I get a SQL exception "java.sql.SQLException: No data found". This same code works ...

94. Java SP with DB2 8.1    dbforums.com

95. DB2 CLP commands execution    dbforums.com

96. JDBC for DB2    java-forums.org

97. Displaying an Indeterminate Progress Bar While a DB2 Stored Proceedure Runs    forums.oracle.com

How do I display a dialog with an indeterminate progress bar while a DB2 query runs? Could anyone point me to an example or some strong docs? I learned Java about six months ago, so I'm relatively new to the language. Through searching and documentation, I've been able to find all the examples and answers I've needed so far. Now I've ...

98. how to upload and download files and images using ibm db2?    forums.oracle.com

UsthadThegreat wrote: For my project i need to upload tutorials in pdf files and doc files to db2 and need to display them in jsp page.and also i need to insert images into db2.Please help me if u kno any of these. Thanks in advance. You know one of the most key elements of getting help in programming is to post ...

99. DB2 limit command???    forums.oracle.com

100. java and db2 problem    forums.oracle.com

Hello all , i got some exceptions in my applications,i am using jdk 1.4.2 and db2 8 . My database connection line is getting down for some time what to do . Please reply when anyone find any solution,here is the exception com.ibm.db2.jcc.b.SQLException: at com.ibm.db2.jcc.b.l.a(l.java:1469) at com.ibm.db2.jcc.a.bb.h(bb.java:541) at com.ibm.db2.jcc.a.bb.g(bb.java:443) at com.ibm.db2.jcc.a.bb.d(bb.java:276) at com.ibm.db2.jcc.a.bb.d(bb.java:90) at com.ibm.db2.jcc.a.b.a(b.java:935) at com.ibm.db2.jcc.a.b.a(b.java:450) at com.ibm.db2.jcc.a.b.a(b.java:293) at com.ibm.db2.jcc.a.b.(b.java:207) ...