Db2 Sql Error Sqlcode=-302 Sqlstate=22001 Sqlerrmc
Contents |
the source and target tables SQL0302N; -302; enlarge column length; increase column length Technote (troubleshooting) Problem(Abstract) Federation server Oracle wrapper reports sqlstate 22001 (error 8152) -302 error after increasing the cloumn length of the source and target db2 sql error sqlcode 313 sqlstate 07001 tables when running IBM InfoSphere Replication Server. Symptom You increased the column length of source table, you what is sqlerrmc increased the column length of the nickname by command "ALTER NICKNAME
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to http://www.dbforums.com/showthread.php?1652962-Getting-the-error-DB2-SQL-Error-SQLCODE-302-SQLSTATE-22001-SQLERRMC-null register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. Results 1 to 4 of 4 Thread: Getting the error DB2 SQL Error: SQLCODE=-302, SQLSTATE=22001, SQLERRMC=null Tweet Thread Tools Show Printable Version Subscribe to this Thread… Search sqlstate 22001 Thread Advanced Search Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode 01-24-10,11:36 #1 chetan1989 View Profile View Forum Posts Registered User Join Date Jan 2010 Posts 4 Unanswered: Getting the error DB2 SQL Error: SQLCODE=-302, SQLSTATE=22001, SQLERRMC=null Code: import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; db2 sql error import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; public class BlobUse { Connection connection; Statement statement; ResultSet resultSet; public void generateReport() { try { Class.forName("com.ibm.db2.jcc.DB2Driver").newInstance(); String url = "jdbc:db2://localhost:50000/smartcit"; Connection connection = DriverManager.getConnection(url, "db2admin", "password"); PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO ADMINISTRATOR.BOOKCOVERS VALUES(?,?)"); File imageFile = new File("c:\\redbookcover.jpg"); InputStream inputStream = new FileInputStream(imageFile); preparedStatement.setString(1," 0738425826"); preparedStatement.setBinaryStream(2,inputStream,(int)(imageFile.length())); preparedStatement.executeUpdate(); connection.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException e) { System.out.println("SQL Exception"); System.out.println("============="); System.out.println(e.getMessage()); // (1) System.out.println(""); }catch (IllegalAccessException ex) {System.err.println(ex.getMessage());} catch (InstantiationException ex) {System.err.println(ex.getMessage());} } public static void main(String[] args) { new BlobUse().generateReport(); } } I created the table using query: create table bookcovers (bookisbn varchar(10) not null, bookcover blob (1G) not null, primary key(bookisbn)) This is the example program from IBM site to store an image on database from IBM site but I am unable to run it sucessfully. Please help Reply With Quote 01-24-10,11:53 #2 shammat View Profile View Forum Posts Registered User Join Date Nov 2003 Posts 2,916 Pro