Store big5 characters in database using JDBC

The key point is the character set of database.
Try character set 'WE8ISO8859P1'
Good Luck.
null

Thanks for ur help:
another Q:
in my GUI i have a button called Insert. but can't update my database table unless i create textField(e.g Firstname, Surname..ect..), so that when I click Insert button in actionEvent it will bring up popup which have field name in which i am going to insert new records.
so what iam trying to say is, how iam going to tell the actionEvent to trigger this.
the following is my code
public void actionPerformed(ActionEvent event)
ExamResults exam= new ExamResults ();      
String studentId = studentTextField.getText();
if (event.getSource() == insert) //if insert is clicked
Thanks

Similar Messages

  • Inserting Multiple Images into oracle database using JDBC

    I wanted to insert multiple images into database using JDBC by reading it from the file... and i am passing photos.txt(my text file) as an input parameter... I have inserted all the values into the database except for the image part... this is my content of photos.txt file and i have copied all the images into the folder
    *" C:\\photos "*
    *1,in1.jpg,108,19,in-n-out*
    *2,in2.jpg,187,21,in-n-out*
    *3,in3.jpg,308,41,in-n-out*
    *4,in4.jpg,477,52,in-n-out*
    *5,in5.jpg,530,50,in-n-out*
    and i want to store in1.jpg,in2.jpg,in3.jpg,in4.jpg,in5.jpg into the oracle databse using JDBC.... i have tried a lot using BLOB column.... and i have created my table as
    CREATE TABLE PHOTO(
    ID NUMBER NOT NULL PRIMARY KEY ,
    Name BLOB,
    X DOUBLE PRECISION,
    Y DOUBLE PRECISION,
    Tags VARCHAR2(40)
      try {                 // for restaurant System.out.println();System.out.println();System.out.println(); System.out.print("  Creating Statement for Photo...\n");             stmt2 = con.createStatement ();                       stmt2.executeUpdate("delete from PHOTO"); stmt2.executeUpdate("commit"); PreparedStatement stmt3 = con.prepareStatement ("INSERT INTO PHOTO VALUES (?, ?, ?, ?, ?)");             System.out.print("  Create FileReader Object for file: " + inputFileName1 + "...\n");             FileReader inputFileReader2 = new FileReader(inputFileName1);             System.out.print("  Create BufferedReader Object for FileReader Object...\n");             BufferedReader inputStream2  = new BufferedReader(inputFileReader2);             String inLine2 = null;                         String[] tokens; //            String[] imageFilenames = {"c:\\photos\\in1.jpg","c:\\photos\\in2.jpg","c:\\photos\\in3.jpg","c:\\photos\\in4.jpg","c:\\photos\\in5.jpg", //  "c:\\photos\\in6.jpg","c:\\photos\\in7.jpg","c:\\photos\\in8.jpg","c:\\photos\\in9.jpg","c:\\photos\\in10.jpg","c:\\photos\\arb1.jpg","c:\\photos\\arb2.jpg", //  "c:\\photos\\arb3.jpg","c:\\photos\\arb4.jpg","c:\\photos\\arb5.jpg","c:\\photos\\den1.jpg","c:\\photos\\den2.jpg","c:\\photos\\den3.jpg", //  "c:\\photos\\den4.jpg","c:\\photos\\den5.jpg","c:\\photos\\hop1.jpg","c:\\photos\\hop2.jpg","c:\\photos\\hop3.jpg","c:\\photos\\hop4.jpg","c:\\photos\\hop5.jpg"};               File file = new File("C:\\photos\\in1.jpg");            \\ ( Just for example  )           FileInputStream fs = new FileInputStream(file);                         while ((inLine2 = inputStream2.readLine()) != null) {               tokens= inLine2.split(",");             st2 = new StringTokenizer(inLine2, DELIM);                                                             stmt3.setString(1, tokens[0]);               stmt3.setBinaryStream(2, fs, (int)(file.length()));               stmt3.setString(3, tokens[2]);               stmt3.setString(4, tokens[3]);               stmt3.setString(5, tokens[4]);               stmt3.execute(); //execute the prepared statement               stmt3.clearParameters(); 
    As i am able to enter one image file by above code in1.jpg in to the oracle database.... but i am not able to insert all the image file in to the database.....do tell me what should i do.... and can you give me the example on the basis of the above code of mine...
    do reply as soon as possible..

    jwenting wrote:
    that depends. Putting the images in BLOBs prevents the file locations stored in the database from getting out of synch with the filesystem when sysadmins decide to reorganise directory structures or "archive" "old" files that noone uses anyway.True, but it really comes down to a business decision (cost-benefit analysis). If you have the bucks, the expertise, and the time, go with the Blobs, otherwise go with the flat files.

  • NCHAR issue with oracle database using JDBC adapter

    Hi,
    We have a requirement to develop an XI interface from FTP server(File adapter) to oracle database using JDBC adapter. In the oracle database table few fields are of type NCHAR/NVARCHAR. when we try to insert the character(A,B,c..) values into oracle table fields of type NCHAR/NVARCHAR, we are getting the following error message in the JDBC adapter audit log. IF we pass the numeric value to the same field, then we are able to insert the records successfully.
    Unable to execute statement for table or stored procedure. 'IPCSDD_DOWNLOAD_PROCESS' (Structure 'StatementName1') due to java.sql.SQLException: ORA-00904: "P": invalid identifier
    2010-10-19 22:29:59 Error JDBC message processing failed; reason Error processing request in sax parser: Error when executing statement for table/stored proc. 'IPCSDD_DOWNLOAD_PROCESS' (structure 'StatementName1'): java.sql.SQLException: ORA-00904: "P": invalid identifier
    2010-10-19 22:29:59 Error MP: Exception caught with cause com.sap.aii.af.ra.ms.api.RecoverableException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'IPCSDD_DOWNLOAD_PROCESS' (structure 'StatementName1'): java.sql.SQLException: ORA-00904: "P": invalid identifier
    Please find the system information below.
    Oracle version- 10.2.4
    XI version - 3.0/ service pack 19
    JDBC driver- oracle.jdbc.driver.OracleDriver
    Please suggest.
    Thanks,
    Venkata
    Edited by: Venkata Narayana  Eepuri on Oct 21, 2010 12:10 AM

    Dear Venkata Narayana,
    Concerning the error, kindly go through the following note :
    731 - Collective note: ORA-00904
    follow the recommendations mentioned in that and please check if that helps.
    Best Regards
    Nishwanth

  • How to Connect Microsoft SQL 2000 database using JDBC

    Hi all..
    I want to connect Microsoft SQL 2000 database using JDBC. I want from initial steps also. (about JDBC driver & its installation)
    Thankz

    Just checkout the SQL Server JDBC Driver Documentation at the manfacturer's site: http://msdn2.microsoft.com/en-us/data/aa937724.aspx

  • How to eliminate inserting  Duplicate rows into database using JDBC Adapter

    File->Xi->JDBC
    In above Scenario if the file has two rows their values are identical, then how can we eliminated inserting  Duplicate rows into database using JDBC Adapter

    Database is a consumer of a SERVICE (SOA!!!!!!).
    Database plays a business system role here!!!!
    Mapping is part of an ESB service
    Adaptor is a technology adapted to ESB framework to support specific protocol.
    ESB accomplish ESB duties such as transformation, translation, routing. Routing use a protocol accepted by the consumer. In a JDBC consumer it is JDBC protocol and hence it a JDBC adaptor.
    There is clear separation on responsibilities among business system and ESB. ESB do not participate in business decision or try to get into business system data layer.
    So who ever are asking people to check duplicate check as part of mapping (an ESB service) may not understand integration practice.
    Please use an adaptor module which will execute the duplicate check with business system in a plug and play approach and separate that from ESB service so that people can build integration using AGILE approach.
    Thanks

  • Connecting to DB2 Database using JDBC for select/Insert

    Hi,
    I am trying to connect to an DB2 Database using  JDBC adapter, I have build an UDF for the same.
    The UDF will try to query the database in the form of Select and INSERT.I am using the LOOKUP API provided by SAP.When I try to execute the UDF I have received the following error.can any of you provide the solution for the error and also is it that the JDBC adapter has to be situated on Central Adapter engine to execute the API, can the JDBC adapter used for executing the INSERT statement.
    Exception during processing the payload.Problem when calling an adapter by using communication channel JDBC_PIDB_Receiver_CC (Party: , Service: XIDB_BSRV, Object ID: 59f2d7694acc3e81840f89b0169d9323) XI AF API call failed. Module exception: (No information available). Cause Exception: (No information available).
    com.sap.aii.mapping.lookup.LookupException: Problem when calling an adapter by using communication channel JDBC_PIDB_Receiver_CC (Party: , Service: XIDB_BSRV, Object ID: 59f2d7694acc3e81840f89b0169d9323) XI AF API call failed. Module exception: (No information available). Cause Exception: (No information available).
         at com.sap.aii.ibrun.server.lookup.AdapterProxyLocal.execute(AdapterProxyLocal.java:131)
         at com.sap.aii.ibrun.server.lookup.SystemAccessorInternal.execute(SystemAccessorInternal.java:68)
         at com.sap.aii.ibrun.server.lookup.SystemAccessorHmiServer.process(SystemAccessorHmiServer.java:149)
         at com.sap.aii.ibrun.server.lookup.SystemAccessorHmiServer.process(SystemAccessorHmiServer.java:77)
         at com.sap.aii.utilxi.hmis.server.HmisServiceImpl.invokeMethod(HmisServiceImpl.java:169)
         at com.sap.aii.utilxi.hmis.server.HmisServer.process(HmisServer.java:178)
         at com.sap.aii.utilxi.hmis.web.HmisServletImpl.processRequestByHmiServer(HmisServletImpl.java:296)
         at com.sap.aii.utilxi.hmis.web.HmisServletImpl.processRequestByHmiServer(HmisServletImpl.java:211)
         at com.sap.aii.utilxi.hmis.web.workers.HmisInternalClient.doWork(HmisInternalClient.java:70)
         at com.sap.aii.utilxi.hmis.web.HmisServletImpl.doWork(HmisServletImpl.java:496)
         at com.sap.aii.utilxi.hmis.web.HmisServletImpl.doPost(HmisServletImpl.java:634)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:386)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:364)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:1039)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:265)
         at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)
         at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:175)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
         at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:102)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:172)
    Root Cause:
    com.sap.aii.af.service.api.AFException: XI AF API call failed. Module exception: (No information available). Cause Exception: (No information available).
         at com.sap.aii.af.service.api.AdapterAccess.sendMsg(AdapterAccess.java:214)
         at com.sap.aii.af.service.api.AdapterAccess.execute(AdapterAccess.java:283)
         at com.sap.aii.ibrun.server.lookup.AdapterProxyLocal.execute(AdapterProxyLocal.java:123)
         at com.sap.aii.ibrun.server.lookup.SystemAccessorInternal.execute(SystemAccessorInternal.java:68)
         at com.sap.aii.ibrun.server.lookup.SystemAccessorHmiServer.process(SystemAccessorHmiServer.java:149)
         at com.sap.aii.ibrun.server.lookup.SystemAccessorHmiServer.process(SystemAccessorHmiServer.java:77)
         at com.sap.aii.utilxi.hmis.server.HmisServiceImpl.invokeMethod(HmisServiceImpl.java:169)
         at com.sap.aii.utilxi.hmis.server.HmisServer.process(HmisServer.java:178)
         at com.sap.aii.utilxi.hmis.web.HmisServletImpl.processRequestByHmiServer(HmisServletImpl.java:296)
         at com.sap.aii.utilxi.hmis.web.HmisServletImpl.processRequestByHmiServer(HmisServletImpl.java:211)
         at com.sap.aii.utilxi.hmis.web.workers.HmisInternalClient.doWork(HmisInternalClient.java:70)
         at com.sap.aii.utilxi.hmis.web.HmisServletImpl.doWork(HmisServletImpl.java:496)
         at com.sap.aii.utilxi.hmis.web.HmisServletImpl.doPost(HmisServletImpl.java:634)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:386)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:364)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:1039)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:265)
         at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)
         at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:175)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
         at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:102)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:172)
    Thanks,
    Kiran.

    Hi,
    have you deployed the JDBC driver for your DB2 database in your XI system........if not, then ask your basis guys to find the weblog to deploy the JDBC driver in XI system and then deploy your DB2 database driver in your JDBC driver in XI system............
    then again execute your scenario.
    Regards,
    Rajeev Gupta

  • Inserting a pdf file in mysql database using jdbc

    hi guys,
    i'm developing an application, where i have to upload the documents and store it in the database.
    i'm using mysql db. using the jdbc statements i have stored the contents of the pdf file. But, i'm unable to read the content, it's looks like junk values. and when i retrieved using the stream objects. it looks like the same.
    i'm able to store and retrieve the text based and image files.
    is it possible to store pdf and word documents in the database columns directly??
    any ideas are appreciated.
    thanks in advance,
    -bala

    This may help[
    Table example
    DROP TABLE IF EXISTS `employeephoto`;
    CREATE TABLE `employeephoto` (
    `Employee_ID` varchar(15) NOT NULL default '',
    `Binary_Photo` mediumblob NOT NULL,
    `LastUser` varchar(100) NOT NULL default '',
    `LastMod` datetime NOT NULL default '0000-00-00 00:00:00',
    `Created` datetime NOT NULL default '0000-00-00 00:00:00',
    PRIMARY KEY (`Employee_ID`)
    ) TYPE=MyISAM;
    Save photo as jpeg to database
    public static void saveMySqlPhoto(String empID, ImageIcon icon) {
      try {
        Image image = icon.getImage();
        BufferedImage bImage = new BufferedImage(image.getWidth(null),image.getHeight(null),BufferedImage.TYPE_INT_RGB);
        Graphics bg = bImage.getGraphics();
        bg.drawImage(image,0,0,null);
        bg.dispose();
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        ImageIO.write(bImage,"jpeg",out);
        byte[] buf = out.toByteArray();
        // setup stream for blob
        ByteArrayInputStream inStream = new ByteArrayInputStream(buf);
        // get or create a connection here
        Connection photoConnection = startup.connectionPool.getConnection();
        sqlStatement = "insert into employeephoto (Employee_ID,Binary_Photo,LastUser,LastMod,Created) values ('"+empID+"', ?, '"+startup.User+"', NOW(), NOW())";
        ps = photoConnection.prepareStatement(sqlStatement);
        ps.setBinaryStream(1,inStream,inStream.available());
        ps.executeUpdate();
        // release or close connection here
        startup.connectionPool.releaseConnection(photoConnection);
      catch (Exception exc) {
        // process error
    }Retrieve photo from database
    public static ImageIcon getMySqlPhoto(String employeeID){
      ImageIcon dPhoto = null;
      // get or create a connection here
      Connection photoConnection = connectionPool.getConnection();
      String sqlStatement = "select Binary_Photo from employeephoto where Employee_ID = '"+employeeID+"'";
      try {
        ResultSet rs = photoConnection.createStatement().executeQuery(sqlStatement);
        if (rs.next()){
          Blob image = rs.getBlob("Binary_Photo");
          // setup the streams
          InputStream input = image.getBinaryStream();
          ByteArrayOutputStream output = new ByteArrayOutputStream();
          // set read buffer size
          byte[] rb = new byte[1024];
          int ch = 0;
          // process blob
          while ((ch=input.read(rb)) != -1){
            output.write(rb, 0, ch);
          byte[] b = output.toByteArray();
          input.close();
          output.close();
          // load final buffer
          dPhoto = new ImageIcon(b);
        rs.close();
      catch (Exception exc) {
        // do error processing
      // release or close connection here
      connectionPool.releaseConnection(photoConnection);
      return dPhoto;
    public byte[] toByteArray(int width, int height, BufferedImage imageBuff) throws java.io.IOException{
      BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
      bi.getGraphics().drawImage(imageBuff, 0, 0, null);
      ByteArrayOutputStream out = new ByteArrayOutputStream();
      JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
      JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(bi);
      param.setQuality(1.0f, false);
      encoder.setJPEGEncodeParam(param);
      encoder.encode(bi);
      return out.toByteArray();
    }rykk

  • Insertingand retrieving images in database using jdbc

    i am new to jsp.i have to store and retrieve image files using oracle 8i.Then i have to display it using jsp.
    my code for storing image is
    package sample;
    import oracle.jdbc.driver.*;
    import oracle.sql.*;
    import java.sql.*;
    import java.io.*;
    import java.awt.image.*;
    import java.awt.*;
    public class storephoto{
    public static void main(String[] args){
    String filename = "C:/Documents and Settings/user/Desktop/five.gif";
    Connection conn = null;
    try{
    Class.forName("oracle.jdbc.driver.OracleDriver");
    conn=DriverManager.getConnection("jdbc:oracle:thin:@10.1.4.228:1521:data","system","manager");
    conn.setAutoCommit(false);
    Statement st = conn.createStatement();
    int b= st.executeUpdate("insert into bfiles values('"+filename+"', empty_blob())");
    ResultSet rs= st.executeQuery("select * from bfiles for update");
    rs.next();
    BLOB blob=((oracle.jdbc.driver.OracleResultSet)rs).getBLOB(2);
    FileInputStream instream = new FileInputStream(filename);
    System.out.println("instream="+instream);
    OutputStream outstream = blob.getBinaryOutputStream();
    System.out.println("outstream="+outstream);
    int chunk = blob.getChunkSize();
    System.out.println("chunk="+chunk);
    byte[] buff = new byte[chunk];
    int le;
    while( (le=instream.read(buff)) !=-1)
    System.out.println(le);
    outstream.write(buff,0,le);
    System.out.println(buff);
    instream.close();
    outstream.close();
    conn.commit();
    conn.close();
    conn = null;
    System.out.println("Inserted.....");
    catch(Exception e){
    System.out.println("exception"+e.getMessage());
    e.printStackTrace();
    }//catch
    This code works fine & something gets stored in the buffer.but while rereiving nothing gets retreived.i cannot retrieve the image file
    my code for retreiving is
    package sample;
    import java.sql.*;
    import java.io.*;
    import java.awt.*;
    import oracle.sql.BLOB;
    public class retphoto
    public static void main(String a[])
    String fileName ="C:/Documents and Settings/user/Desktop/five.gif";
    try
    Driver driver = new oracle.jdbc.driver.OracleDriver();
    DriverManager.registerDriver(driver);
    Connection con = DriverManager.getConnection("jdbc:oracle:thin:@10.1.4.228:1521:data", "system", "manager");
    File file = new File("C:/Documents and Settings/user/Desktop/sa1.gif");
    FileOutputStream targetFile= new FileOutputStream(file); // define the output stream
    PreparedStatement pstmt = con.prepareStatement("select filecontent from bfiles where filename= ?");
    pstmt.setString(1, fileName);
    ResultSet rs1 = pstmt.executeQuery();
    rs1.next();
    InputStream is = rs1.getBinaryStream(1);
    System.out.println(is);
    byte[] buff = new byte[1024];
    int i = 0;
    while ((i = is.read(buff)) != -1) {
    System.out.println("hai");
    System.out.println(i);
    targetFile.write(buff, 0, i);
    System.out.println("Completed...");
    rs1.close();
    is.close();
    targetFile.close();
    pstmt.close();
    con.close();
    catch(Exception e)
    System.out.println(e);
    }

    Thanks for ur help:
    another Q:
    in my GUI i have a button called Insert. but can't update my database table unless i create textField(e.g Firstname, Surname..ect..), so that when I click Insert button in actionEvent it will bring up popup which have field name in which i am going to insert new records.
    so what iam trying to say is, how iam going to tell the actionEvent to trigger this.
    the following is my code
    public void actionPerformed(ActionEvent event)
    ExamResults exam= new ExamResults ();      
    String studentId = studentTextField.getText();
    if (event.getSource() == insert) //if insert is clicked
    Thanks

  • Creating a new access database using JDBC

    Hi Forum,
    I have a problem in hand. Let me describe the problem:
    I want to create an "access database" from java at runtime. "Access database" is file based, so for a database named test, it will have a file test.mdb.
    Now, everything's sweet and wonderful, if somebody creates an "empty access database" at the client machine and i then connect to it and create the tables i require.
    But the issue is i want to create the database at runtime (the database name and tables are determined at runtime).
    Using the JDBC:ODBC bridge driver , i am able to connect to an existing database, but any "create database" statements are not supported.
    A last ditch solution would be that i create an empty database using access and copy the file contents in the SQL server database as a a blob object. Then when i want to create a new access database at runtime, i create a file in a particular folder , with an .mdb
    extension, copy the file contents from the SQL server (i also have an SQL server connection) BLOB object, and then try to connect to the
    .mdb file.
    But this approach seems a "quick hack" and can have problems (which i can't see as of now).
    Can you suggest a better alternative for the problem.
    See the Java Sun forum at this address for a discussion of a similar problem, but sadly with no solution.
    http://forum.java.sun.com/thread.jspa?forumID=31&threadID=484731

    I have an applet that was previously connected to Oracle 9i. I am faced with connecting to MS Access temporarily for testing purposes.
    I have been unable to successfully code connection in java. I have set up the DSN and can access in SQL Worksheet in JDev.
    I saw your question regarding creating an access db, and thought you might be so kind as to help me code the connection to access!!!!
    Any help you could provide would be greatly appreciated. I have a huge application to finish with alot of sqlj already completed. Connectivity is not my area of expertise!
    Any help you could provide would be greatly appreciated!!!
    I am not sure if I have to use bridge? Am I progressing in right direction to migrating to SQL Server if need be?

  • Help:- Store Word file in database using blob

    Hai all,
    i want to store word document in database and reterieve from database but i don't have any idea i heared about blob but i don't know how to make it any one have source code or example form pls send me
    email: [email protected]

    Hello,
    First of all, you have got to be granted the privilege to read and write to the file system, this is a must to use BFile read access.
    A global function bfilename returns a bfile taking the file path as an argument is needed to construct a blob object through dbms_lob.loadfromfile.
    A very helpful example I found on orafaq follows:Create a link to the directory where the file to load in the blob is
    (connect as system then grant read privilege to your user):
    create or replace directory blob_dir as 'C:\Documents';
    Custom the following procedure that I copied from a Thread
    create or replace procedure blob_ins(p_id in number, p_filename in
    varchar2) as
    l_bfile bfile;
    l_blob blob;
    begin
    insert into blob_test(p_id, empty_blob())
    returning blob_file into l_blob;
    l_bfile := bfilename('BLOB_DIR', p_filename);
    dbms_lob.fileopen(l_bfile);
    dbms_lob.loadfromfile(l_blob, l_bfile, dbms_lob.getlength(l_bfile));
    dbms_lob.fileclose(l_bfile);
    commit;
    return;
    end blob_ins;
    You can use UTL_FILE package in another way, but this is much more safe;
    Have Fun
    Hossam Al Din

  • How to store files in mysql database using JSP?

    I'm developing an online recruitment system using JSP in server side. For the users who registers in it, I want them to upload their cv's from the web site so that I can store it in the database..I'm using mysql as the db..
    Can I know how to do it.?..or else is there any better way of doing that?
    Need a quick reply..Tx

    The best way to put data in a database in a JSP is to not do it. Instead, use a Servlet that calls a DataAccessObject. The DAO puts the data in the DB and the servlet gives the data to the DAO. The JSP does nothing but display results.
    Take a google for JSP MVC and DAO. BalusC has a great example of DAO and a JSP that uses one on his blog.

  • Empty CLOB field value from Oracle database using JDBC Sender

    Hi All,
    I am selecting a CLOB field from Oracle database table using JDBC Sender adapter and getting error "NullPointerException"
    Seen SAP note 1283089 but its not applicable for my support pack PI 7.0 SP 12 and client dont want to upgrdate SP 17 right now.
    I tried rpad(1,0)Column_Name funciton in JDBC select query but it selcting blank value for every record even those having some value for this CLOB field so not useful
    Could anybody suggest possible way? client dont want to change anything at database side.
    Thanks,
    Dharamveer

    What is the Oracle driver version installed? You might need to install 10.x driver if not already using it.

  • Connection error to 9i database using JDBC thin driver

    When trying to connect to a new 9i database using the JDBC thin driver, I received the following error:
    java.sql.SQLException: ORA-00600: internal error code, arguments: [ttcgcshnd-1], [0], [], [], [], [], [], []
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java)
    at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java)
    at oracle.jdbc.ttc7.Oall7.receive(Oall7.java)
    at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java)
    at oracle.jdbc.ttc7.TTC7Protocol.fetch(TTC7Protocol.java)
    at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java)
    at oracle.jdbc.driver.OracleStatement.doExecute(OracleStatement.java)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java)
    at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java)
    at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java)
    at oracle.jdbc.driver.OracleDatabaseMetaData.getTables(OracleDatabaseMetaData.java)
    I have no problem with my code connecting to an Oracle 8 database, just 9i.
    I'm trying to debug in Visual Cafe (JDK 1.1.7) and have both the classes111.zip and the nls_charset11.zip in my CLASSPATH.
    Any suggestions would be appreciated. Thanks

    If you're using 8i 8.1.7.1 or 8i 8.1.7.0 thin JDBC drivers on NT, then you can get them to connect to 9i by applying the 8i 8.1.7.1 Patch available at:
    http://technet.oracle.com/software/tech/java/sqlj_jdbc/htdocs/solsoft.html
    You might have to register/login first.
    Basically, it's just a case of replacing a class already in your classes111.zip or classes12.zip with the class in the patch.
    Took me a while to find this, but it worked first time after patching. Hope this helps.

  • Cannot connect to database using JDBC

    Hello!
    I am trying to connect to my local database using this script:
    import java.sql.*;
    public class test{
    public static void main (String[] args){
      try
        DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
        Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","scott","tiger");
        Statement StmtPersoane = conn.createStatement();
        ResultSet CrsPersoane =StmtPersoane.executeQuery("select p.* from personal p");
        int jMarca = 0;
        while(CrsPersoane.next()){
        jMarca = CrsPersoane.getInt("marca");
        System.out.println(jMarca);
        CrsPersoane.close();
        StmtPersoane.close();
        conn.close();
      catch(SQLException e)
        e.printStackTrace();
    }When compiling i am getting this error: Error(7,58): cannot access class oracle.jdbc.driver.OracleDriver; file oracle\jdbc\driver\OracleDriver.class not found
    I have set a CLASSPATH enviroment variable with value : D:\oracle10g\product\10.1.0\Db_1\jdbc\lib\ojdbc14.jar
    Please provide some hints. Thanks in advace !

    Problem solved with the connection, but now i'm getting another error when i am trying to parse an error. Here is the code a little bit modified:
    import java.sql.*;
    import java.text.*;
    import java.text.ParseException;
    import java.util.*;
    public class test{
    public static void main (String[] args){
      try
        DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
        Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","scott","tiger");
                Statement StmtPersoane;
                StmtPersoane = conn.createStatement();
                ResultSet CrsPersoane =StmtPersoane.executeQuery("select marca from personal");
                int jMarca;
                jMarca = 0;
    java.util.Date dataJava = new java.text.SimpleDateFormat("dd/mm/yyyy").parse("04/10/2006");
    java.sql.Date dataSql = new java.sql.Date(dataJava.getTime());
    System.out.println("Data: "+dataSql);
        System.out.println("Angajatii sunt:"); 
                while(CrsPersoane.next()){
        jMarca = CrsPersoane.getInt("marca");
        System.out.println(jMarca);
        CrsPersoane.close();
        StmtPersoane.close();
        conn.close();
      catch(SQLException e)
        e.printStackTrace();
    }The error:
    Error(24,81): unreported exception: java.text.ParseException; must be caught or declared to be thrown
    Any ideas ?

  • Reading the contents of a folder and store them in the database using 6i

    Hi all,
    I'm using developer 6i and oracle 8i,now am building personnel database,every employee has many certificates (graduate certificates,post-graduate certificates and work experience certificates),I want to scan all these certificates,put them in a folder ,give the form (employee form ) the path to the folder and the form read the contents of the folder (3 or 4 image files for example) dynamically and store them in the database.
    All examples I came across explain how to load a defined image file name into oracle database,but what if the image file name is not defined (i,e dynamically generated by the scanner).
    Hope I explained the case.
    Thanks in advance

    Sorry mhdamer,
    I read the example and thought it could be modified to retreive a directory listing. There is a way to do what you want, but you will have to check to see if you have the D2kwutil.pll installed with Forms 6i. If you do not have it installed you can download the pll from OTN. This Forms Library will only work on Windows, so if you want this functionality on a non-windows machine, it will not work. Read the D2KWUTIL.html for details on how to use this library. There are also some good posts here in the forums on how to use this library. Just search on D2KWUTIL.PLL.
    Craig...

Maybe you are looking for

  • Rename a database

    I have a windows 10g database I am trying to rename and I am stuck on the creation of the new control file. *Could some please advise me how you execute the sql to create the new control file. Steps done so fare a documented below. Thanks a lot! Kath

  • Photo Books - Crop and Color Issues from Kodak Gallery

    I've been spending a good amount of time creating photo books and ordering them from Kodak using the built-in online ordering feature. I've noticed several items that I was curious if others have any experience perspective on. 1. Cropping. For a flex

  • Can i install Adobe premiere elements and photoshop elements separately in 2 different computers?

    We are planning to purchase a bundle Adobe Photoshop Elements and Priemiere Elements 11 but we need to separate the installation of this 2 softwares in to 2 different computers, Can we do an installation separately using the same lisence? An urgent a

  • Refresh the report table simultaneous

    Hi All, Even though I have hidden the apply button, the report tabs are not refreshed with the parameters in the bi publisher report. We have to refresh the report page manually for each tabs.Is there a way to refresh all the report tabs at once when

  • Adobe X and OLE

    Hi, we have some Problems in our Network. We cant open OLE linked files. For Example: We want to open a PDF File which is included in an Word file. But it dont work. It close without an error. Greetings