Convhow to erting MySQL database into oracle Database

Hi,
how to import/convert MySQL database/tables into oracle database/table.
i need SQL code or any import wizard technique.
Thnxz

Please refer:
http://www.oracle.com/technology/tech/migration//workbench/index_sqldev_omwb.html

Similar Messages

  • Migrating mysql procedures into oracle

    Hi friends!
    I have a task to migrate one mysql db into oracle enviroment. So i plan to use a handy sql developer migration tool. I have not yet seen the source mysql db. So for now i just trying to figure out some issues wich may appear in the course of the work. I know there should be some complex procedures in the source db and wonder how good sql developer in wrapping mysql procedure logic into plsql code.
    Does anyone has experience with it?
    Thanks in advance. Alex.

    Alex,
    It's very difficult to say what problems you may have, if any, as it really does depend on the complexity of the MySQL procedures and what MySQL specific code they use.
    You can test using the 'Translation Scratch Editor' from the main menu -
    - Tools
    - Migration
    - Translation Scratch Editor
    Regards,
    Mike

  • Importing MYSQL dump into Oracle database

    Hi,
    I want to import MYSQL database dump into Oracle 9i database.
    Can any body suggest as how to proceed for this.
    thanks in advance

    if you're referring to dump generated by mysqldump then you have a lot of work to do since Oracle does not support sql syntax in the dump file.
    alternatively, you can export each table into .csv file using phpMyAdmin and then load that .csv using SQL Loader or external table.

  • SELECT from MySQL, INSERT into Oracle

    Hallo,
    I am new to Java.
    My task is to collect data from about 30 tables inside MySQL database and then insert it to similar tables in Oracle.
    Script should copy data one a day, during the night.
    Number of rows in each table is about 30,000.
    MySQL version 5.1
    Oracle version 11.1.7
    Both of them are installed on really fast servers.
    The way i would do it is:
    1. connect to MySQL
    2. connect to Oracle
    3. select data from MySQL table and insert it to Oracle table.
    repeat this step for each table
    More precise about SELECT and INSERT:
    handle_one = "SELECT a, b, c FROM mysql_table1";
    while(handle_one is true)
    INSERT a, b, c INTO oracle_table1;
    4. close MySQL connection
    5. close Oracle connection
    Is it best way?
    Best Regards
    slk

    slkLinuxUser wrote:
    Script should copy data one a day, during the night.
    Number of rows in each table is about 30,000.There are variations on the above depending on what the above two statements mean.

  • How to insert data into Oracle db from MySQL db through PHP?

    Hi,
    I want to insert my MySQL data into Oracle database through PHP.
    I can access Mysql database using mysql_conect() & Oracle database using oci_connect() through PHP.
    Now How can I insert my data which is in MySQL into Oracle table. Both table structure are exactly same.
    So I can use
    insert into Oracle_Table(Oracle_columns....) values(Select * from MySQL_Table);
    But again problem is I can't open both connections at the same time.
    So has anyone done this before or anyone having any other idea..
    Plz guide me...

    You can do it if you setup a ODBC Gateway between MYSQL and Oracle DB. Then you can directly read from MySQL table using DB links and insert into Oracle table in one single SQL Statement.
    Otherwise you need to fetch the data from MySQL Into variables in your PHP Program and then insert into Oracle after binding the variables to the insert statement for Oracle. Hope that is clear enough.
    Regards
    Prakash

  • What should i do with an Oracle 11g Database, MySQL database and a dump file.

    I just joining to a new work field, almost about a database and i know "NOTHING" about this field.
    My company has a system that running by Oracle Database, the problem is that Oracle Database will cost a lot of money when my company expands.
    So the quest is converting Oracle Database to MySQL database.
    Of course i cant try to convert it in the main Database, so i create one Oracle 11g Database on my LocalHost, and it already actived in " Localhost:1158 " etc.
    I have another Sever test that already set up MySQL database, and a dump file from the system.
    So I want to ask these 2 questions :
    1. How to create an new Oracle Database from that dump file ?
    2. Is it alright if i use tool to convert Oracle Database into MySql, or i should do it manually ?
    Thanks alot.

    I just joining to a new work field, almost about a database and i know "NOTHING" about this field.
    My company has a system that running by Oracle Database, the problem is that Oracle Database will cost a lot of money when my company expands.
    So the quest is converting Oracle Database to MySQL database.
    I predict that converting to MySQL will cost your company more as it expands. As you expand managing contention becomes more important - Oracle does this for you. I do not think MySQL does, so you'll have to write more code to deal with this, costing the company money. A big part of making application scalable and reliable is to use stored procedures, how good are MySQL's compared to PL/SQL's. What other features are there that MySQL has that will benefit your company that Oracle doesn't. What do you need to think about as your company expands that need to be taken care of in the database. I would have thought a migration from MySQL to Oracle would be more common to deal with expansion.
    As you know "NOTHING" you need to think about what each database can give you for the next 10 years to cope with you businesses potential requirements, and extimate how much it will cost to implement these requirements, then make the decision

  • Accessing mysql database from oracle using dg4odbc

    I've been trying to create a database link from a MySQL database to Oracle using the Oracle dg4odbc gateway. I downloaded and installed DataDirect's ODBC package which includes mysql ODBC library (ddmysql24.so) and a generic ODBC libary (libodbc.so). After creating the DSN in odbc.ini, I tested it and it can connect to the mysql database. Then I created the init{SID}.ora file in hs/admin directory, added dg4odbc lines in the listener.ora, and added lines in tnsnames.ora. Then I tnspinged the new SID with success. Finally, I created the database link. However, when I tried to access the database link using the commands "select * from mdl_user@moodle;", I got the ORA-28500 error like the following:
    ERROR at line 1:
    ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
    [DataDirect][ODBC 20101 driver][20101]You have an error in your SQL syntax;
    check the manual that corresponds to your MySQL server version for the right
    syntax to use near '"mdl_user"' at line 1
    ORA-02063: preceding 2 lines from MOODLE
    My mysql database is utf8 by default. Do I have to use latin1?
    It seems to me that the dg4odbc translates the sql commands incorrectly (having double quotes around the selected table).
    Any help is greatly appreciated.
    Jeffrey

    The syntax error occures for example when MySQL isn't running in ANSI mode and thus does not allow double quotes around the objects. DG4ODBC 11.1.0.6 by default always adds double quotes to table/column/view names.
    A quick test to check if you hit the double quote issue would be to set the MySQL DB into ANSI mode:
    - Open SQL*Plus
    - execute:
    DECLARE
    ret integer;
    c integer;
    BEGIN
    c := DBMS_HS_PASSTHROUGH.OPEN_CURSOR@moodle;
    DBMS_HS_PASSTHROUGH.PARSE@moodle(c, 'SET SESSION SQL_MODE=''ANSI_QUOTES'';');
    ret := DBMS_HS_PASSTHROUGH.EXECUTE_NON_QUERY@moodle(c);
    dbms_output.put_line(ret ||' passthrough output');
    DBMS_HS_PASSTHROUGH.CLOSE_CURSOR@moodle(c);
    END;
    - Now run your select statement
    => if it now works, you can permanently change the MySQL config to be ANSI compliant or you can apply the 11.1.0.7 patchset to DG4ODBC.

  • MIgration from MYSQL database to Oracle database

    HI,
    Can you pls let me know how can we do this using Oracle SQL Developer.
    In Mysql database we are having one table which is not normalized and corresponding to it we have created normalized tables in oracle database.
    so scenario is like this
    EMP table in MYSQL database ----------- need to migrate to----> Employee table
    Dept table.
    These tables are having some extra columns also which are not there in EMP table in MYSQL database.
    SO we want to fill some default values for the new columns while doing the migration.
    Can you pls let me know if this is achievable through SQL Developer and how?

    Sorry, you'd have to do this in 2 steps:
    1. Migrate the tables as they are.
    2. Insert the rows from the migrated tables into the new ones.
    Have fun,
    K.

  • Question:How to use MySQL database as a service in Oracle Cloud

    Hello All,
    I want to use MySQL as backend for my application.How can i select MySQL database.Its showing me only to choose Oracle database.
    Thanks in advance.

    The Oracle Database Cloud Service uses the Oracle Database.  You do not have access to the underlying operating system to make the choice you are seeking.
    When the Oracle Compute Service comes out later this year, you could use one of those "infrastructure only" environments and load MySQL into it.  You would be responsible for all maintenance of MySQL and the environment.
    Hope this helps.
    - Rick Greenwald

  • Parsing XML data into MySQL database

    I need to parse data from an xml document rsiding on amother
    server into a mysql database residing on my server, so that I can
    pull data into a php site.
    Any help? Mybe there's a commercial script or something?
    I would also need to update the data daily
    Thanks!!

    Check this out.
    http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96612/d_xmlsav.htm#1008593

  • Help needed to loadjava apache poi jars into oracle database.

    Help needed to loadjava apache poi jars into oracle database. Many classes left unresolved. (Poi 3.7, database 11.1.0.7). Please share your experience!

    Hi,
    The first 3 steps are just perfect.
    But with
    loadjava.bat -user=user/pw@connstr -force -resolve geronimo-stax-api_1.0_spec-1.0.jar
    the results are rather unexpected. Here is a part of the log file:
    arguments: '-user' 'ccc/***@bisera7-db.dev.srv' '-fileout' 'c:\temp\load4.log' '-force' '-resolve' '-jarsasdbobjects' '-v' 'geronimo-stax-api_1.0_spec-1.0.jar'
    The following operations failed
    resource META-INF/MANIFEST.MF: creation (createFailed)
    class javax/xml/stream/EventFilter: resolution
    class javax/xml/stream/events/Attribute: resolution
    class javax/xml/stream/events/Characters: resolution
    class javax/xml/stream/events/Comment: resolution
    class javax/xml/stream/events/DTD: resolution
    class javax/xml/stream/events/EndDocument: resolution
    class javax/xml/stream/events/EndElement: resolution
    class javax/xml/stream/events/EntityDeclaration: resolution
    class javax/xml/stream/events/EntityReference: resolution
    class javax/xml/stream/events/Namespace: resolution
    class javax/xml/stream/events/NotationDeclaration: resolution
    class javax/xml/stream/events/ProcessingInstruction: resolution
    class javax/xml/stream/events/StartDocument: resolution
    class javax/xml/stream/events/StartElement: resolution
    class javax/xml/stream/events/XMLEvent: resolution
    class javax/xml/stream/StreamFilter: resolution
    class javax/xml/stream/util/EventReaderDelegate: resolution
    class javax/xml/stream/util/StreamReaderDelegate: resolution
    class javax/xml/stream/util/XMLEventAllocator: resolution
    class javax/xml/stream/util/XMLEventConsumer: resolution
    class javax/xml/stream/XMLEventFactory: resolution
    class javax/xml/stream/XMLEventReader: resolution
    class javax/xml/stream/XMLEventWriter: resolution
    class javax/xml/stream/XMLInputFactory: resolution
    class javax/xml/stream/XMLOutputFactory: resolution
    class javax/xml/stream/XMLStreamReader: resolution
    resource META-INF/LICENSE.txt: creation (createFailed)
    resource META-INF/NOTICE.txt: creation (createFailed)
    It seems to me that the root of the problem is the error:
    ORA-29521: referenced name javax/xml/namespace/QName could not be found
    This class exists in the SYS schema though and is valid. If SYS should be included as a resolver? How to solve this problem?

  • Problem with inserting data into mySQL database with jsp

    I have a jsp page that collects infromation about a users vehicle and puts the data into a mySQL database. Iv'e been messing around with it for ages & i can't seem to get it to work even though i cannot see anything wrong with the code, which can be seen below.
    <%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
    <%@ include file="Connections/connection.jsp" %>
    <%
    // *** Restrict Access To Page: Grant or deny access to this page
    String MM_authorizedUsers="";
    String MM_authFailedURL="login_form.jsp";
    boolean MM_grantAccess=false;
    if (session.getValue("MM_Username") != null && !session.getValue("MM_Username").equals("")) {
      if (true || (session.getValue("MM_UserAuthorization")=="") ||
              (MM_authorizedUsers.indexOf((String)session.getValue("MM_UserAuthorization")) >=0)) {
        MM_grantAccess = true;
    if (!MM_grantAccess) {
      String MM_qsChar = "?";
      if (MM_authFailedURL.indexOf("?") >= 0) MM_qsChar = "&";
      String MM_referrer = request.getRequestURI();
      if (request.getQueryString() != null) MM_referrer = MM_referrer + "?" + request.getQueryString();
      MM_authFailedURL = MM_authFailedURL + MM_qsChar + "accessdenied=" + java.net.URLEncoder.encode(MM_referrer);
      response.sendRedirect(response.encodeRedirectURL(MM_authFailedURL));
      return;
    String vehicle_details__registration = null;
    if(request.getParameter("txt_registration") != null){ vehicle_details__registration = (String)request.getParameter("txt_registration");}
    String vehicle_details__make = null;
    if(request.getParameter("txt_make") != null){ vehicle_details__make = (String)request.getParameter("txt_make");}
    String vehicle_details__model = null;
    if(request.getParameter("txt_model") != null){ vehicle_details__model = (String)request.getParameter("txt_model");}
    String vehicle_details__colour = null;
    if(request.getParameter("txt_colour") != null){ vehicle_details__colour = (String)request.getParameter("txt_colour");}
    String vehicle_details__tax_class = null;
    if(request.getParameter("select_tax_class") != null){ vehicle_details__tax_class = (String)request.getParameter("select_tax_class");}
    String vehicle_details__chasis_num = null;
    if(request.getParameter("chasis_num") != null){ vehicle_details__chasis_num = (String)request.getParameter("chasis_num");}
    String vehicle_details__status = null;
    if(request.getParameter("radio_status") != null){ vehicle_details__status = (String)request.getParameter("radio_status");}
    String owner_details__MMColParam = "1";
    if (session.getValue("MM_Username") !=null) {owner_details__MMColParam = (String)session.getValue("MM_Username");}
    Driver Drivervehicle_details = (Driver)Class.forName(MM_connection_DRIVER).newInstance();
    Connection Connvehicle_details = DriverManager.getConnection(MM_connection_STRING,MM_connection_USERNAME,MM_connection_PASSWORD);
    PreparedStatement vehicle_details = Connvehicle_details.prepareStatement("INSERT INTO vehicle_man_db.vehicle_details (registartion, make, model, colour, tax_class, chasis_num) VALUES ('"+ String vehicle_details__registration + "', '"+ String vehicle_details__make + "', '"+ String vehicle_details__model + "', '"+ String vehicle_details__colour + "', '"+ String vehicle_details__tax_class + "', '"+ String vehicle_details__chasis_num + "', '"+ String vehicle_details__status + "')");
    vehicle_details.executeUpdate();
    %>
    <form name="add_vehicle_form" id="add_vehicle_form">
      <p>Registration mark:
        <input name="txt_registration" type="text" id="txt_registration">
    </p>
      <p>Make:
        <input name="txt_make" type="text" id="txt_make">
    </p>
      <p>Model:
        <input name="txt_model" type="text" id="txt_model">
    </p>
      <p>Colour:
        <input name="txt_colour" type="text" id="txt_colour">
      </p>
      <p>Tax Class:
        <select name="select_tax_class" id="select_tax_class">
          <option value="AAA">Band AAA (up to 100g/km)</option>
          <option value="AA">Band AA (101 - 120g/km)</option>
          <option value="A">Band A (121 - 150g/km)</option>
          <option value="B">Band B (151 - 165g/km)</option>
          <option value="C">Band C (166 - 185g/km)</option>
          <option value="D">Band D (Over 185g/km)</option>
        </select>
      </p>
      <p>Chasis Number:
        <input name="txt_chassis_num" type="text" id="txt_chassis_num">
    </p>
      <p>Status: active:
        <input name="radio_status" type="radio" value="1" checked>
        off-road
        <input name="radio_status" type="radio" value="0">
      </p>
      <p>
        <input type="submit" name="Submit" value="Submit">
    </p>
    </form>
    <%
    Connvehicle_details.close();
    %>This is the error I am getting from the server
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 3 in the jsp file: /add_vehicle_form.jsp
    Generated servlet error:
    C:\Servers\Tomcat 5.0\work\Catalina\localhost\Assignment\org\apache\jsp\add_005fvehicle_005fform_jsp.java:113: ')' expected
    PreparedStatement vehicle_details = Connvehicle_details.prepareStatement("INSERT INTO vehicle_man_db.vehicle_details (registartion, make, model, colour, tax_class, chasis_num) VALUES ('"+ String vehicle_details__registration + "', '"+ String vehicle_details__make + "', '"+ String vehicle_details__model + "', '"+ String vehicle_details__colour + "', '"+ String vehicle_details__tax_class + "', '"+ String vehicle_details__chasis_num + "', '"+ String vehicle_details__status + "')");
    ^
    1 error
         org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
         org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:332)
         org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:412)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    Any help would be much appreciated.
    Thanks

    use this ...
    PreparedStatement vehicle_details =
    Connvehicle_details.prepareStatement("INSERT INTO
    vehicle_man_db.vehicle_details (registartion, make,
    model, colour, tax_class, chasis_num) VALUES
    vehicle_details .setString(1,String
    vehicle_details__registration );
    vehicle_details setString(2,String
    vehicle_details__make );
    vehicle_details .setString(3,String
    vehicle_details__model );
    vehicle_details .setString(4,vehicle_details__colour
    vehicle_details .setString(5,String
    vehicle_details__tax_class);
    vehicle_details .setString(6,String
    vehicle_details__chasis_num );
    vehicle_details .executeQuery();Even you need a screwing up... what's the point putting that String inside. That's the bloody error.

  • How to get data into the mySQL database?

    First some background.
    I have a website that has outgrown its designed dimensions and is a huge burden to maintain. See PPBM5 Benchmark
    There is a lot of maintenance work involved, so I'm investigating a PHP/MySQL approach to easen the burden and to add functionality to the site. With the current Excel based structure and over 420 entries, it is cumbersome for me to maintain, but also for users to find what they need.
    A MySQL based dynamic structure is a lot easier and offers vastly more selection capabilities, like selecting only records that meet specific criteria.
    Data submission is done with a form, that contains most of the relevant data, but the drawack is that people submitting their data are often not technically inclined, give wrong answers due to a lack of understanding or making typo's. The test results are attached in one or two separate .txt files, but often they have not read the instructions correctly or did something wrong, so these attached .txt files can not be trusted automatically, they have to be checked before inclusion.
    These were my initial thoughts:
    1. Data collection:
    To avoid spending all our energy and time  on correcting typo's, getting missing data, correcting errors, I am  investigating the use of CPU-Z in Ghost mode to create a .txt or .html  file that contains all relevant hardware info we need and even more. It gives all the info we currently have, but adds  data like number of memory sticks, DDR timings, stock clock speed and  BCLK setting, video card info and VRAM size, etc.
    To see what I mean, run CPU-Z, go to the About tab and press the Save Report button and look at the results.
    This can all be done without user intervention in an automatic way, but  maybe I need to add an Auto-It file to the test to make it all run as  desired.
    If this works and I'm able to extract the relevant data from the created  file and can insert it into the database, we may be in business for the  next version of PPBM5.5 or PPBM6. It does require a modification to the instructions, making them a lot  easier, because there is less data to fill out.
    2. Data submission:
    The submission form can be simplified if  the CPU-Z data can be used. We have to create an automatic way to attach  the created .html file from CPU-Z to the submission form and we have to  streamline the Output.txt and Output-MPE.txt files to be more easily included in the 'form.lib.php' file. It  currently is manual labor and very time consuming.
    3. Adding to Database:
    I have to find a way to create database  records from the Gmail forms I receive. All incoming mail messages need  to be checked on relevancy and if relevant, need to be added  automatically to the database and then offered for approval before final inclusion in the database. Data included in the database  will then include submission date and time, Email address,  IP address  used, plus links to the files submitted and available on the website.
    4. Publication of the database:
    After approval of new records from step  3, all updates will be automatically applied to the database and  accessible for users. I do not yet intend to introduce a user account ,  requesting login before all functionality is accessible. Too much trouble and administration.
    Queries should be possible on things like CPU (check box), so include  17-920, i7-930, i7-950 but exclude i7-980X and i7-990X, Size of memory  (check box), Overclocked (boolean, yes, no), SSD as OS disk, and similar  options.
    The biggest problem is to keep the color grading and statistical  indicators (Top, D9, Q3, Med, Q1 and D1) intact on dynamically generated  queries. Say you make a query which results in 20 observations, this  should show the related colors and legends. Next query results in 48 observations and of course the color grading and legends  do need to reflect that. Question in my mind, does the RPI remain  constant, independent of the query or does that need to be recalculated  on the basis of the query?
    Next thing is to allow a user to select a specific observation and by  simply clicking on it be shown, in a separate window (detail page) or  accordion, all the CPU-Z related information about the hardware.
    The graphs, Top-20 and MPE Gains, need to be dynamically adjusted, based on the query used.
    5. Ideally, external links:
    In an ideal situation, one could link the  CPU-Z data to external price databases, looking up current prices for  CPU, memory, video card, disks, raid controller, etc. to get instant  BFTB charts, based on the query made. But that is the next step.
    Situation now:
    I have a MySQL database that is easily updated with the new submissions. Simply create a .CSV flie from the submitted forms and import that into the database. The bulk of the initial work is done.Lots remain to be done as you can see above, but that is for a later time.
    Question:
    I have this table, that needs to be filled with data in the submitted and attached files. Mr. X submitted his data and can be uniquely identified by his "Ref_ID". He attached one or two files in .TXT format with the relevant test data. These files are stored on the server with a concatenated name:
    "Ref_ID","-","filename"
    Say his Ref-ID is: 20110204-6cf5 and his submitted file is called: Output(99).txt then the file can be found on the server as
    20110204-6cf5-Output(99).txt
    I need to be able to open that comma delimited file, the contents may look like this: "439","1036","819","531" and insert these contents into the relevant record and fields.
    Graphically,
    is what I want to achieve.
    This being my first exposure to PHP/MySQL, you can imagine I'm not clear on how to go from here.
    Added complication is that I actually have 5 numbers to insert per record and two calculated fields, Total Score and RPI should be calculated fields. Haven't yet figured out how to handle calculated fields, maybe only in the PHP/HTML code and not in the database.
    I hope someone can help me.

    You do have a very complex looking site and may need several tables in mysql to handle all that data. If you knew to phpmysql I would suggest taking a look at this tutorial it will help get you started in understanding how to $_GET info from a database and also how to $_POST data to a database. I am no expert just learning myself and I found this very helpful. This is the link http://www.adobe.com/devnet/dreamweaver/articles/first_dynamic_site_pt1.html
    There are also many tutorials on Youtube to help build a CMS Content Management Site I would suggest the following: -
    http://www.youtube.com/user/phpacademy
    http://www.youtube.com/user/betterphp
    http://www.youtube.com/user/flashbuilding
    And many more on my channel here
    http://www.youtube.com/user/Whisperingonthewind
    CMS's are easier to maintain, add edit and delete content.
    I have also recently bought a Book by David Powers Training from the Source very helpful.
    Anyway hope you get it sorted.

  • How to insert a image file into oracle database

    hi all
    can anyone guide me how to insert a image file into oracle database now
    i have created table using
    create table imagestore(image blob);
    but when inserting i totally lost don't know what to do how to write query to insert image file

    Hi I don't have time to explain really, I did have to do this a while ago though so I will post a code snippet. This is using the commons file upload framework.
    Firstly you need a multi part form data (if you are using a web page). If you are not using a web page ignore this bit.
    out.println("<form name=\"imgFrm\" method=\"post\" enctype=\"multipart/form-data\" action=\"FileUploadServlet?thisPageAction=reloaded\" onSubmit=\"return submitForm();\"><input type=\"FILE\" name=\"imgSource\" size='60' class='smalltext' onKeyPress='return stopUserInput();' onKeyUp='stopUserInput();' onKeyDown='stopUserInput();' onMouseDown='noMouseDown(event);'>");
    out.println("   <input type='submit' name='submit' value='Submit' class='smalltext'>");
    out.println("</form>"); Import this once you have the jar file:
    import org.apache.commons.fileupload.*;Now a method I wrote to upload the file. I am not saying that this is correct, or its the best way to do this. I am just saying it works for me.
    private boolean uploadFile(HttpServletRequest request, HttpSession session) throws Exception {
            boolean result = true;
            String fileName = null;
            byte fileData[] = null;
            String fileUploadError = null;
            String imageType = "";
            String error = "";
            DiskFileUpload fb = new DiskFileUpload();
            List fileItems = fb.parseRequest(request);
            Iterator it = fileItems.iterator();
            while(it.hasNext()){
                FileItem fileItem = (FileItem)it.next();
                if (!fileItem.isFormField()) {
                    fileName = fileItem.getName();
                    fileData = fileItem.get();
                    // Get the imageType from the filename extension
                    if (fileName != null) {
                        int dotPos = fileName.indexOf('.');
                        if (dotPos >= 0 && dotPos != fileName.length()-1) {
                            imageType = fileName.substring(dotPos+1).toLowerCase();
                            if (imageType.equals("jpg")) {
                                imageType = "jpeg";
            String filePath = request.getParameter("FILE_PATH");
            session.setAttribute("filePath", filePath);
            session.setAttribute("fileData", fileData);
            session.setAttribute("fileName", fileName);
            session.setAttribute("imageType", imageType);
            return result;  
         } And now finally the method to actually write the file to the database:
    private int writeImageFile(byte[] fileData, String fileName, String imageType, String mode, Integer signatureIDIn, HttpServletRequest request) throws Exception {
            //If the previous code found a file that can be uploaded then
            //save it into the database via a pstmt
            String sql = "";
            UtilDBquery udbq = getUser(request).connectToDatabase();
            Connection con = null;
            int signatureID = 0;
            PreparedStatement pstmt = null;
            try {
                udbq.setUsePreparedStatements(true);
                con = udbq.getPooledConnection();
                con.setAutoCommit(false);
                if((!mode.equals("U")) || (mode.equals("U") && signatureIDIn == 0)) {
                    sql = "SELECT SEQ_SIGNATURE_ID.nextval FROM DUAL";
                    pstmt = con.prepareStatement(sql);
                    ResultSet rs = pstmt.executeQuery();
                    while(rs.next()) {
                       signatureID = rs.getInt(1);
                    if (fileName != null && imageType != null) {
                        sql = "INSERT INTO T_SIGNATURE (SIGNATURE_ID, SIGNATURE) values (?,?)";
                        InputStream is2 = new ByteArrayInputStream(fileData);
                        pstmt = con.prepareStatement(sql);
                        pstmt.setInt(1, signatureID);
                        pstmt.setBinaryStream(2, is2, (int)(fileData.length));
                        pstmt.executeUpdate();
                        pstmt.close();
                        con.commit();
                        con = null;
                if(mode.equals("U") && signatureIDIn != 0) {
                    signatureID = signatureIDIn.intValue();
                    if (fileName != null && imageType != null) {
                        sql = "UPDATE T_SIGNATURE SET SIGNATURE = ? WHERE SIGNATURE_ID = ?";
                        InputStream is2 = new ByteArrayInputStream(fileData);
                        pstmt = con.prepareStatement(sql);
                        pstmt.setBinaryStream(1, is2, (int)(fileData.length));
                        pstmt.setInt(2, signatureID);
                        pstmt.executeUpdate();
                        pstmt.close();
                        con.commit();
                        con = null;
            } catch (Exception e) {
                con = null;
                throw new Exception(e.toString());
            return signatureID;
       }

  • How to load excel-csv file into oracle database

    Hi
    I wanted to load excel file with csv extension(named as trial.csv) into
    oracle database table(named as dept),I have given below my experiment here.
    I am getting the following error,how should I rectify this?
    For ID column I have defined as number(5) datatype, in my control file I have defined as interger external(5),where as in the Error log file why the datatype for ID column is comming as character?
    1)my oracle database table is
    SQL> desc dept;
    Name Null? Type
    ID NUMBER(5)
    DNAME CHAR(20)
    2)my data file is(trial.csv)
    ID     DNAME
    11     production
    22     purchase
    33     inspection
    3)my control file is(trial.ctl)
    LOAD DATA
    INFILE 'trial.csv'
    BADFILE 'trial.bad'
    DISCARDFILE 'trial.dsc'
    APPEND
    INTO TABLE dept
    FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"'
    TRAILING NULLCOLS
    (ID POSITION(1:5) INTEGER EXTERNAL(5)      
    NULLIF ID=BLANKS,
    DNAME POSITION(6:25) CHAR
         NULLIF DNAME=BLANKS
    3)my syntax on cmd prompt is
    c:\>sqlldr scott/tiger@xxx control=trial.ctl direct=true;
    Load completed - logical record count 21.
    4)my log file error message is
    Column Name Position Len Term Encl Datatype
    ID           1:5 5 , O(") CHARACTER
    NULL if ID = BLANKS
    DNAME 6:25 20 , O(") CHARACTER
    NULL if DNAME = BLANKS
    Record 1: Rejected - Error on table DEPT, column ID.
    ORA-01722: invalid number
    Record 21: Rejected - Error on table DEPT, column ID.
    ORA-01722: invalid number
    Table DEPT:
    0 Rows successfully loaded.
    21 Rows not loaded due to data errors.
    0 Rows not loaded because all WHEN clauses were failed.
    0 Rows not loaded because all fields were null.
    Bind array size not used in direct path.
    Column array rows : 5000
    Stream buffer bytes: 256000
    Read buffer bytes: 1048576
    Total logical records skipped: 0
    Total logical records read: 21
    Total logical records rejected: 21
    Total logical records discarded: 0
    Total stream buffers loaded by SQL*Loader main thread: 0
    Total stream buffers loaded by SQL*Loader load thread: 0
    5)Result
    SQL> select * from dept;
    no rows selected
    by
    balamuralikrishnan.s

    Hi everyone!
    The following are the steps to load a excell sheet to oracle table.i tried to be as simple as possible.
    thanks
    Step # 1
    Prapare a data file (excel sheet) that would be uploaded to oracle table.
    "Save As" a excel sheet to ".csv" (comma seperated values) format.
    Then save as to " .dat " file.
    e.g datafile.bat
    1,Category Wise Consumption Summary,Expected Receipts Report
    2,Category Wise Receipts Summary,Forecast Detail Report
    3,Current Stock List Category Wise,Forecast rule listing
    4,Daily Production Report,Freight carrier listing
    5,Daily Transactions Report,Inventory Value Report
    Step # 2
    Prapare a control file that define the data file to be loaded ,columns seperation value,name and type of the table columns to which data is to be loaded.The control file extension should be " .ctl " !
    e.g i want to load the data into tasks table ,from the datafile.dat file and having controlfile.ctl control file.
    SQL> desc tasks;
    Name Null? Type
    TASK_ID NOT NULL NUMBER(14)
    TASK_NAME VARCHAR2(120)
    TASK_CODE VARCHAR2(120)
    : controlfile.ctl
    LOAD DATA
    INFILE 'e:\datafile.dat'
    INTO TABLE tasks
    FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
    (TASK_ID INTEGER EXTERNAL,
    TASK_NAME CHAR,
    TASK_CODE CHAR)
    The above is the structure for a control file.
    Step # 3
    the final step is to give the sqlldr command to execute the process.
    sqlldr userid=scott/tiger@abc control=e:\controlfile.ctl log=e:\logfile.log
    Message was edited by:
    user578762

Maybe you are looking for

  • How do I get caller ID to work with my address book??

    Reviving an old thread: When someone from my address book calls me on my skype numer, their name does not show up, only their number shows up. Does any one know how to have skype search forthat number in the address book and show that persons name wh

  • Facetime verification email not arrivinh

    I am sitting here trying to get Facetime going for my Mother so she can video chat with her grandchildren.  Thusfar all has gone well enough - installed Facetime, got her Apple ID setup, and entered in to Facetime.  However, we appear to be stuck at

  • Calendar data not in "Home" library folder

    Tried looking for home/library/calendar. In order to back up my lost calenda revents with time machine, I would like to know where those events are stored so I don't have to back up my whole computer. As mentioned in the discussion table there is no

  • I can't turn the volume up, change songs or turn off my Muvo N

    I have a Muvo N200 and once I turn it on it won't do anything. The display screen just says creative,? I can't turn up the volume, change a song or even turn it off. I have to take the battery out to turn it off. I have tried deleting the songs on th

  • Downconversion LabVIEW 2009 to LabVIEW 8.5

    I'd like to convert these three files from LabVIEW 9.0 to LabVIEW 8.5. Thank you Attachments: RS232_Hyper Terminal_Communication_Example.vi ‏102 KB Find_Serial_Port.vi ‏28 KB State Machine LLB.llb ‏102 KB