Sun Web Server 6.1 Insert into Oracle Database problem

Hello there,
I'm using Sun Java Studio Creator 2004Q2 Update 7, and trying to deploy to Sun ONE Web Server 6.1 SP3 without much luck.
I am trying to use ojdbc14.jar and have included it in a lib directory added to Native Lib Path Prefix.
DataSource Classname oracle.jdbc.pool.OracleDataSource
URL jdbc:oracle:thin:@myserver:1521:myinstance
JNDI Name jdbc/HBC
In the constructor I have:
        // <editor-fold defaultstate="collapsed" desc="Creator-managed Component Initialization">
        try {
            abcRowSet.setDataSourceName("java:comp/env/jdbc/HBC");
            abcRowSet.setCommand("SELECT ALL ABC.TT.XX, ABC.TT.YY, ABC.TT.ZZ FROM ABC.TT");
            abcRowSet.setConcurrency(java.sql.ResultSet.CONCUR_UPDATABLE);
        } catch (Exception e) {
            log("TestEntry Initialization Failure", e);
            throw e instanceof javax.faces.FacesException ? (FacesException) e: new FacesException(e);
        // </editor-fold>
        // Additional user provided initialization code
         try {
             abcRowSet.execute();
             abcRowSet.next();
         } catch (Exception ex) {
Then in the submit button action I have:
        try {
          abcRowSet.moveToInsertRow();
          abcRowSet.updateString("XX",fieldXX.getValue().toString());
          abcRowSet.updateString("YY",fieldYY.getValue().toString());
          abcRowSet.updateString("ZZ",fieldZZ.getValue().toString());
          abcRowSet.insertRow();
          abcRowSet.moveToCurrentRow();
          abcRowSet.commit();
        } catch (SQLException se) {
            error("ERROR SQLException: " + se);
            log("LOG SQLException: " + se);
            try {
                abcRowSet.rollback();
            } catch (SQLException se2) {
                log("ROLLBACK SQLException: " + se2);
When I run this I get:
        [25/Apr/2005:20:32:41] info ( 2652): for host 127.0.0.1 trying to POST /hbc/faces/TestEntry.jsp,
        service-j2ee reports: WEB2798: [/hbc] ServletContext.log(): LOG SQLException:
        java.sql.SQLException: Invalid operation for read only resultset: moveToInsertRowAlternatively (1) I have tried to have automatically generated rave connection pool / jdbc resources and copying over the driveradapter.jar but as we know that version is locked for embedded applications only (since Creator only includes the AppServer PE's driveradapter which cannot be deployed on WebServers).
Alternatively (2) I have tried manually setting up the connection pool / jdbc resources and copying over the smutil.jar / smoracle.jar / smbase.jar but it complains about java.lang.ClassNotFoundException: com.sun.sql.jdbc.oracle.OracleDriver
Is there a pain-free way to get Creator to play with Web Server 6.1 nicely? I seem to either run into Oracle THIN JDBC problems (main code above) or otherwise running into situations where Creator and Web Server 6.1 doesn't like each other (alternative 1 and 2).
Thanks for your input
Regards
Thomson K

Hi there, sorry for the trouble. I found the following thread:
http://forum.java.sun.com/thread.jspa?forumID=48&threadID=417560
I am using Oracle 8, I had followed the instructions in that thread and still get the error.. but you can ignore this thread for now I will pursue this in the other thread. Sorry for taking your time.

Similar Messages

  • Best Practice to fetch SQL Server data and Insert into Oracle Tables

    Hello,
    I want to read sqlserver data everry half an hour and write into oracle tables ( in two different databases). What is the best practice for doing this?
    We do not have any database dblinks from oracle to sqlserver and vice versa.
    Any help is highly appreciable?
    Thanks

    Well, that's easy:
    use a TimerTask to do the following every half an hour:
    - open a connection to sql server
    - open two connections to the oracle databases
    - for each row you read from the sql server, do the inserts into the oracle databases
    - commit
    - close all connections

  • Insert into Oracle Database using C#

    Hi Everyone,
    I am trying to take data from text box and list box and then insert them to Oracle database:
    Text box data:
    Oracle = EMPLOYEE_NAME
    C# = tbEmployeeName
    List box data:
    Oracle = EMPLOYEE_GENDER
    C# = lbEmployeeGender
    Here is my code in C#, can you guys help me with insert statement:
    string oradb = "Data Source= oraDB;User Id=sm;Password=mypassword;";
    OracleConnection conn = new OracleConnection(oradb);
    conn.Open();
    OracleCommand cmd = new OracleCommand();
    cmd.Connection = conn;
    cmd.CommandText = "Insert into USER.EMPLOYEE VALUES (tbEmployeeName.Text, lbEmployeeGender.Text)";
    int rowsUpdated = cmd.ExecuteNonQuery();
    if (rowsUpdated == 0)
    MessageBox.Show("Record not inserted");
    else
    MessageBox.Show("Success!");
    conn.Dispose();
    Thanks!

    989630 wrote:
    Hi Everyone,
    I am trying to take data from text box and list box and then insert them to Oracle database:
    Text box data:
    Oracle = EMPLOYEE_NAME
    C# = tbEmployeeName
    List box data:
    Oracle = EMPLOYEE_GENDER
    C# = lbEmployeeGender
    Here is my code in C#, can you guys help me with insert statement:
    string oradb = "Data Source= oraDB;User Id=sm;Password=mypassword;";
    OracleConnection conn = new OracleConnection(oradb);
    conn.Open();
    OracleCommand cmd = new OracleCommand();
    cmd.Connection = conn;
    cmd.CommandText = "Insert into USER.EMPLOYEE VALUES (tbEmployeeName.Text, lbEmployeeGender.Text)";
    int rowsUpdated = cmd.ExecuteNonQuery();
    if (rowsUpdated == 0)
    MessageBox.Show("Record not inserted");
    else
    MessageBox.Show("Success!");
    conn.Dispose();
    Thanks!Hi,
    You'll want to read up on using parameters (also known as bind variables) - these are critical for scalability in an OLTP-type system and helping guard against SQL Injection attacks. There's many sources out there, but here's a link to the Parameter Binding section in the ODP.NET Developer's Guide which is probably a good thing to become familiar with:
    http://docs.oracle.com/cd/E11882_01/win.112/e23174/featOraCommand.htm#i1007242
    Here's your sample using bind variables:
    string oradb = "Data Source= oraDB;User Id=sm;Password=mypassword;";
    OracleConnection conn = new OracleConnection(oradb);
    conn.Open();
    OracleCommand cmd = new OracleCommand();
    cmd.Connection = conn;
    // Perform insert using parameters (bind variables)
    cmd.CommandText = "Insert into USER.EMPLOYEE VALUES (:1, :2)";
    // Here's one way to use parameters aka bind variables:
    // Create parameters to hold values from front-end
    cmd.Parameters.Add(new OracleParameter("1",
                                           OracleDbType.Varchar2,
                                           tbEmployeeName.Text,
                                           ParameterDirection.Input));
    cmd.Parameters.Add(new OracleParameter("2",
                                           OracleDbType.Varchar2,
                                           lbEmployeeGender.Text,
                                           ParameterDirection.Input));
    int rowsUpdated = cmd.ExecuteNonQuery();
    if (rowsUpdated == 0)
      MessageBox.Show("Record not inserted");
    else
      MessageBox.Show("Success!");
    conn.Dispose();
    // don't forget to perform any clean-up as necessaryNote that I've just typed this into a text editor and not verified, so please excuse any typos you may find.
    Also, I've allowed the default of OracleCommand.BindByName=false as I prefer that, though others certainly prefer setting it to "true". See the docs for what this means if you are not sure.
    Regards,
    Mark

  • Convert flat file to XML document and store into Oracle database

    First:
    I have a flatfile and created external table to read that file in Oracle
    Now I want to create an XML document for each row and insert into Oracle database, I think that XMLtype.
    Could you please provide me some information/steps.
    Second:
    Is there performance issues, because everyday I need to check that XML document stored in the database against the in coming file.
    Thank You.

    Oracle 11g R2 Sun Solaris
    Flat file is | (pipe delimited), so I did create an EXTERNAL Table
    row1     a|1|2|3|4
    row2     b|2|3|4|5
    row3     c|6|7|8|9
    I want to store each record as XML document. So it will be easy to compare with next day's load and make insert or update.
    The reason is:
         First day the file comes with 5 columns
         after some days, the file may carry on some additional columns more than 5
         In this case I do not want to alter table to capture those values, if I use XML than I can capture any number of columns, CORRECT!. Please make me correct If I am wrong.
         This is the only reason to try to use the XMLType (XML Document)
         On Everyday load we will be matching these XML documents and update it if there is any column's value changes
    daily average load will be 10 millions and initial setup will be 60-80 millions
         Do I have anyother option to capture the new values without altering the table.
    Please advise!.

  • Uploading Data from a Flat file into Oracle Database

    Hi,
    I am a novice to Java . SO, please bear with me. I have a reqiurement where I have a flat file or excel file from which I need to read the data and insert into Oracle Database. The falt file will exist on the client machine. I have been reading and I see this can be done through I/O Streams. Correct me if I am wrong. I am looking for a sample code to get started. Any Java expert has an answer for it, I will appreciate it.
    Thanks

    Try UploadBean. It allows to upload files (from a browser) in Oracle.
    http://www.javazoom.net/jzservlets/uploadbean/uploadbean.html
    You will find JSP and servlet samples.

  • Replace Quotes, Connection Pooling, and Sun Web Server with MySQL, Oracle

    This is code I use to insert data into my MySQL and Oracle databases.
    I takes care of quotes and shows use of context, i.e. when you use Sun Web Server's
    ConnectionPooling. This code works. Feel free to reply if you have questions on how to set up connection pooling using Sun Web Server 6.1SP - it took quite a long time to learn and I couldn't find much information throughout the web, so I hope this helps...
    This is not a question and I am not looking for an answer, but please post comments or suggestions.
    dailysun
    This is in one class where I have a hashtable containing the
    column name / value pairs that I want to enter into my table.
    This class simply creates the SQL string from the values in the
    hashtable. It then passes that hashtable including the database
    name to a class which executes that sql statement (second code
    portion).
    /* Insert data into sf_parts. Create the column strings from
             * the provided hash table. Be sure to parse out hash elements which
             * are used for the createTemplate process
            StringBuffer values = new StringBuffer();
            StringBuffer fields = new StringBuffer();
            Enumeration keys = fieldHash.keys();
            while(keys.hasMoreElements()){
                Object currentKey = keys.nextElement();
                    String fieldValue = (String) fieldHash.get(currentKey);
                    if(values.length() >0){
                        values.append(",");
                    values.append("'"+fieldValue.replaceAll("'","''")+"'"); // Takes care of quotes and various other special characters!
                    if(fields.length() >0){
                        fields.append(",");
                    fields.append(currentKey);
            sql = "INSERT INTO myTable (" + fields.toString() + ") VALUES (" + values.toString() + ");";
            String insertResult = caq.getInsertDelete(sql,"myDatabaseName"); // your database name is defined in web.xml and sun-web.xml when you use Sun Web Server's Connection Pooling.
            returnValue += "<br><br><b>Rows inserted into table(myTable): </b>" + insertResult + "<br>\n";
            And, like I describe above, this method executes the sql statement.
         * Takes care of insert, update and delete requests.
         * Must have set both dbName as well as the sql String.
         * Will return number of rows affected as String.
         * @return String Number of rows affected
         * @exception SQLException
         * @exception Exception
        public String getInsertDelete() {
            checkData(); // this simply checks if the variables dbName and sql are not empty ;-)
            InitialContext initContext = null;
            int rv = 0;
            try{
                // Get connection from configured pool
                initContext = new InitialContext();
                source = (DataSource) initContext.lookup("java:comp/env/jdbc/" + dbName); // I have this set up in web.xml and sun-web.xml (I use Sun Web Server 6.1SP which does connection pooling for me)
                conn = source.getConnection();
                if(conn != null){
                    stmt = conn.createStatement();
                    rv = stmt.executeUpdate(sql);
            }catch (SQLException e){
                // do something
            }catch (Exception e){
                // do something
            }finally{
                try{
                    stmt.close();
                }catch(Exception e){
                    // do something
                try{
                    conn.close();
                }catch(Exception e){
                    // do something
                try{
                    initContext.close();
                }catch(Exception e){
                    // do something
            return rv+"";
        }  

    This is code I use to insert data into my MySQL and
    Oracle databases.
    I takes care of quotes and shows use of context, i.e.
    when you use Sun Web Server's
    ConnectionPooling. This code works. Feel free to
    reply if you have questions on how to set up
    connection pooling using Sun Web Server 6.1SP - it
    took quite a long time to learn and I couldn't find
    much information throughout the web, so I hope this
    helps...
    This is not a question and I am not looking for an
    answer, but please post comments or suggestions.Using prepared statements would mean that you wouldn't have to worry about quotes.
    You should be closing the result set.
    You are handling all fields as strings. That won't work with time fields and might not work for numeric fields.
    Presumably most of your variables are member variables. They should be local variables because that is the scope of the usage.
    You must do something with the exceptions.
    Hashtables although convienent mean that problems with usage can only be resolved at run time rather than compile time.

  • Best way to use Sun Web Server connection pooling with Web Application?

    I have a number of applications that run Oracle and MySQL queries via Sun Web Server 6.1. I use the Web Server's built-in connection pooling, which works fairly well.
    As an interface with the connections I receive from the Web Server, I use a class, which (1) accepts the SQL and database name from a tool, (2) Opens the connection, runs the SQL, closes the connection, (3) puts the content of the result set into a Vector of Hashtables, (4) returns that Vector to the tool.
    Why do I use this Vector? That way, in my applications, I don't have to deal with opening connections (or getting them from the pool) and I don't have to worry about closing connections, because that's done automatically by the interface class.
    Is this a dumb approach to use? I'm a bit paranoid about open DB connections, because we have had a number of problems where connections would not be closed, go stale in oracle, and clog up the database resources.
    Can you suggest a better way to (1) smartly control opening and closing connections, and (2) enabling fast database access?
    Sorry, but given this Java/Sun Web Server double topic, I'm going to post the same message on the Web Server board.
    Any tips?
    dailysun
    P.S. For instance, in my tool, I call the interface class in this manner:
    Vector results_v = Database.getSelect("SELECT * FROM TEST","database1");
    getSelect uses the first string as the SQL and the second string as the jndi name of the Web server's database resource. getSelect does all the context stuff to get a connection from the pool, runs the SQL, puts the resultset into a Vector of Hastables (where each row is one Hashtable), and returns the Vector.

    I have a number of applications that run Oracle and MySQL queries via Sun Web Server 6.1. I use the Web Server's built-in connection pooling, which works fairly well.
    As an interface with the connections I receive from the Web Server, I use a class, which (1) accepts the SQL and database name from a tool, (2) Opens the connection, runs the SQL, closes the connection, (3) puts the content of the result set into a Vector of Hashtables, (4) returns that Vector to the tool.
    Why do I use this Vector? That way, in my applications, I don't have to deal with opening connections (or getting them from the pool) and I don't have to worry about closing connections, because that's done automatically by the interface class.
    Is this a dumb approach to use? I'm a bit paranoid about open DB connections, because we have had a number of problems where connections would not be closed, go stale in oracle, and clog up the database resources.
    Can you suggest a better way to (1) smartly control opening and closing connections, and (2) enabling fast database access?
    Sorry, but given this Java/Sun Web Server double topic, I'm going to post the same message on the Web Server board.
    Any tips?
    dailysun
    P.S. For instance, in my tool, I call the interface class in this manner:
    Vector results_v = Database.getSelect("SELECT * FROM TEST","database1");
    getSelect uses the first string as the SQL and the second string as the jndi name of the Web server's database resource. getSelect does all the context stuff to get a connection from the pool, runs the SQL, puts the resultset into a Vector of Hastables (where each row is one Hashtable), and returns the Vector.

  • How do I use Sun Web Server 7.0u1 reverse proxy to change public URLs?

    Some of our installations use the Sun Web Server 7.0 (update 1, usually)
    for hosting some of the public resource and reverse-proxying other parts
    of the URI namespace from other backend servers (content, application
    and other types of servers).
    So far every type of backend server served a unique part of the namespace
    and there was no collision of names, and the backend resources were
    published in a one-to-one manner. That is, a backend resource like, say,
    http://appserver:8080/content/page.html would be published in the internet
    as http://www.publicsite.com/content/page.html
    I was recently asked to research whether we can rename some parts of
    the public URI namespace, to publish some or all resources as, say,
    http://www.publicsite.com/data/page.html while using the same backend
    resources.
    Another quest, possibly related in solution, was to make a tidy url for the
    first page the user opens of the site. That is, in the current solution when
    a visitor types the url "www.publicsite.com" in his or her browser, our web
    server returns an HTTP-302 redirect to the actual first page URL, so the
    browser sends a second request (and changes the URL in its location bar).
    One customer said that it is not "tidy". They don't want the URL to change
    right upon first rendering the page. They want the root page to be rendered
    instantly i the first HTTP request.
    So far I found that I can't solve these problems. I believe these problems
    share a solution because it relies on ability to control the actual URI strings
    requested by Sun Web Server from backend servers.
    Some details follow, now:
    It seems that the reverse proxy (Service fn="service-passthrough") takes
    only the $uri value which was originally requested by the browser. I didn't
    yet manage to override this value while processing a request, not even if
    I "restart" a request. Turning the error log up to "finest" I see that even
    when making the "service-passthrough" operation, the Sun Web Server
    still remembers that the request was for "/test" (in my test case below);
    it does indeed ask the backend server for an URI "/test" and that fails.
    [04/Mar/2009:21:45:34] finest (25095) www.publicsite.com: for host xx.xx.xx.83
    trying to GET /content/MainPage.html while trying to GET /test, func_exec reports:
    fn="service-passthrough" rewrite-host="true" rewrite-location="true"
    servers="http://10.16.2.127:8080" Directive="Service" DaemonPool="2b1348"
    returned 0 (REQ_PROCEED)My obj.conf file currently has simple clauses like this:
    # this causes /content/* to be taken from another (backend) server
    NameTrans fn="assign-name" from="/content" name="content-test" nostat="/content"
    # this causes requests to site root to be HTTP-redirected to a certain page URI
    <If $uri =~ '^/$'>
        NameTrans fn="redirect"
            url="http://www.publicsite.com/content/MainPage.html"
    </If>
    <Object name="content-test">
    ### This maps http://public/content/* to http://10.16.2.127:8080/content/*
    ### Somehow the desired solution should instead map http://public/data/* to http://10.16.2.127:8080/content/*
        Service fn="service-passthrough" rewrite-host="true" rewrite-location="true" servers="http://10.16.2.127:8080"
        Service fn="set-variable" set-srvhdrs="host=www.publicsite.com:80"
    </Object>
    I have also tried "restart"ing the request like this:
        NameTrans fn="restart" uri="/data"or desperately trying to set the new request uri like this:
        Service fn="set-variable"  uri="/magnoliaPublic/Main.html"Thanks for any ideas (including a statement whether this can be done at all
    in some version of Sun Web Server 7.0 or its opensourced siblings) ;)
    //Jim

    Some of our installations use the Sun Web Server 7.0 (update 1, usually)please plan on installing the latest service pack - 7.0 Update 4. these updates addresses potentially critical bug fixes.
    I was recently asked to research whether we can rename some parts of
    the public URI namespace, to publish some or all resources as, say,
    http://www.publicsite.com/data/page.html while using the same backend
    resources.> now, if all the resources are under say /data, then how will you know which pages need to be sent to which back end resources. i guess, you probably meant to check for /data/page.html should go to <back-end>/content/page.html
    yes, you could do something like
    - edit your corresponding obj.conf (<hostname>-obj.conf or obj.conf depending on your configuration)
    <Object name=¨default¨>
    <If $uri = ¨/page/¨>
    #move this nametrans SAF (for map directive - which is for reverse proxy within <if> clause)
    NameTrans.. fn=map
    </If
    </Object>
    and you could do https-<hostname>/bin/reconfig (dynamic reconfiguration) to check out if this is what you wanted. also, you might want to move config/server.xml <log-level> to finest and do your configuration . this way, you would get enough information on what is going on within your server logs.
    finally,when you are satisfied, you might have to run the following command to make your manual change into admin config repository.
    <install-root>/bin/wadm pull-config user=admin config=<hostname> <hostname>
    <install-root>/bin/wadm deploy-config --user=admin <hostname>
    you might want to check out this for more info on how you could use <if> else condition to handle your requirement.
    http://docs.sun.com/app/docs/doc/820-6599/gdaer?a=view
    finally, you might want to refer to this doc - which explains on ws7 request processing overview. this should provide you with some pointers as to what these different directives mean
    http://docs.sun.com/app/docs/doc/820-6599/gbysz?a=view
    >
    One customer said that it is not "tidy". They don't want the URL to change
    right upon first rendering the page. They want the root page to be rendered
    instantly i the first HTTP request.
    please check out the rewrite / restart SAF. this should help you.
    http://docs.sun.com/app/docs/doc/820-6599/gdada?a=view
    pl. understand that - like with more web servers - ordering of directives is very important within obj.conf. so, you might want to make sure that you verify the obj.conf directive ordering is what you want it to do..
    It seems that the reverse proxy (Service fn="service-passthrough") takes
    only the $uri value which was originally requested by the browser. I didn't
    yet manage to override this value while processing a request, not even if
    I "restart" a request. Turning the error log up to "finest" I see that even
    when making the "service-passthrough" operation, the Sun Web Server
    still remembers that the request was for "/test" (in my test case below);
    it does indeed ask the backend server for an URI "/test" and that fails.
    now, you are in the totally wrong direction. web server 7 includes a highly integrated reverse proxy solution compared to 6.1. unlike 6.1, you don´t have to download a separate plugin . however, you will need to manually migrate your 6.1 based reverse proxy settings into 7.0. please check out this blog link on how to set up a reverse proxy
    http://blogs.sun.com/amit/entry/setting_up_a_reverse_proxy
    feel free to post to us if you need any futher help
    you are probably better off - starting fresh
    - install ws7u4
    - use gui or CLI to create a reverse proxy and map one on one - say content
    http://docs.sun.com/app/docs/doc/820-6601/create-reverse-proxy-1?a=view
    if you don´t plan on using ws7 integrated web container (ability to process jsp/servlet), then you could disable java support as well. this should reduce your server memory footprint
    <install-root>/bin/wadm disable-java user=admin config=<hostname>
    <install-root>/bin/wadm create-reverse-proxy user=admin uri-prefix=/content server=<http://your back end server/ config=<hostname> --vs=<hostname>
    <install-root>/bin/wadm deploy-config --user=admin <hostname>
    now, you can check out the regular express processing and <if> syntax from our docs and try it out within <https-<hostname>/config/<hostname>-obj.conf> file and restart the server. pl. note that once you disable java, ws7 admin server creates <vs>-obj.conf and you need to edit this file and not default obj.conf for your changes to be read by server.
    >
    I have also tried "restart"ing the request like this:
    NameTrans fn="restart" uri="/data"
    ordering is very important here... you need to do this some thing like
    <Object name=default>
    <If not $restarted>
    NameTrans fn=restart uri from=/¨ uri=/foo.
    </If>

  • 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;
       }

  • Annoucing a few complimentary copies of Sun Web Server: Essentials Guide

    Dear Sun Web Server user,
    As you may have heard, found it on amazon.com or stumbled on it in the local book store like Borders or Barnes & Noble, there is a new book on Sun Web Server technology. If you haven't, no worries. Please refer to [t-5406033] or visit the [Essential Guide's web site|http://www.sunwebserver.com/].
    We are now pleased to announce availability of a few complimentary copies of the Essential Guide. We'll be raffling away the copies in the next few months. If you are interested in a free copy of the book, please read further to enter the raffle.
    It's easy to enter the raffle and get started:
    Step 1: If you haven't already done so, download, install and register.
    Step 2: Write a review of Sun Web Server product on Web Server's official page [1], and
    Step 3: Send us an email webserver at sun dot com, confirming your Step 1 along with a link to your review (Step 2).
    What happens next?
    We'll raffle at least a copy once in a month and the winner(s) will be notified. With may share the raffle results on with a permission from the lucky winners. If you are interested, get started today!
    [1] [Sun Web Server's official page|http://www.sun.com/webserver/].
    Disclaimer: Please note that the raffle is organized by the author(s), and that Sun Microsystems or Pearson Media - the publishers of The Essential Guide - are not responsible for the raffle.

    Hi mv,
    I probably mis-spoke. It is not so much the features that are missing in Sun Web Server, as it is the availability of additional user plugins. However, that being said, I chose Sun Web Server over Apache because of security and performance. I realize additional plugins could adversely affect both of those. I have emailed Sun marketing about a specific feature for Web Dav I would like to see. This would make things much easier for people who would like to do mass hosting virtual hosting. Most of the real valuable features that gave Apache an edge, the web server team has added in version 7. I have pasted a portion of the letter I emailed to Sun marketing below about Web Dav, and my logic behind it. This as well as being able to hook the user system into standard open source databases makes for a broader solution appeal. I realize I only have one view of the market, and these are just my two cents. :-) Thanks!
    TonyZ
    **** Letter ******
    I was introduced to Sun Web Server several years ago when we began looking at moving servers away from Microsoft technology and also bringing them into our facility. As a network and sys admin, I evaluated using different web servers out there as we had a few years to work on this project to ensure uptime and reliability. Initially, I found Sun Web Server quite confusing and looked at Apache. However, after the web interface was retooled, I found Sun Web Server quite simple and refreshing to use. Since we have to be CISP compliant for the credit card industry, security was very important to us. Not only from a code standpoint, but also from an accidental misconfiguration standpoint. In my opinion, Sun Web Server out shines Apache and other alternatives by a long shot.
    As far as the WebDav feature, what I have been looking at is how to expand and offer hosting and web services. I currently work for a small company which retails products on the web, and I also contribute to a few open source projects. Currently, I am working with http://www.mynajs.org/. We have been discussing how we could offer hosting for people wanting to try out the project. Hosting companies using Linux typically have deep hooks into the Linux operating system for managing users. For hosting, you have a whole specialized Linux stack with specialized disk quotas, users, ftp server with users based on Linux users, and mail. From my standpoint, while this works, it can become a nightmare as far as updates, system administration, patching, etc. For a business ROI, and technology footprint, this doesn't make sense. There are control panels out there that take care of some of this, but now you have another whole layer of technology to troubleshoot. If I do not want to use the Linux/Apache stack, and if I am using Java, and do not want to add Tomcat as well, what do I use? With Sun Web Server, I get the best of both worlds, one install, one piece of software, operating system separation, blazingly fast speed, out of the box clustering, one interface for management, standard serving as well as Java, and WebDav so that now I can eliminate an ftp server and reduce my footprint for security and maintenance headaches. One neat package. However, now I still have to manage and restrict users. How to do this using Sun Web Server? Right now, I have to either run an ftp server with quotas built in, or go back to the Linux operating system and work with specialized scripts an maintenance. In theory, if Sun Web Server had quotas, I have my user system with the controls I need. At the very least, if there were hooks to the WebDav system to perform custom processing on certain events, it would leave the door open for greater control of the user and system. Now if we want to offer a hosting solution, whether it be online storage, web hosting, or Java hosting, or social site, all we need is one product, Sun Web Server! With all of its features for enhancing performance, security, and much more. I might also add, that for a small companies, Sun Web Server has been a pretty much set it and forget it solution. It has been my experience for our servers to run pretty much without intervention once they are setup. With the watch dog process, if there is a problem, it is rarely noticed except for the admin watching the logs. Technically, I am not sure why anyone would choose something different than Sun Web Server. Apache is the hosting standard, but it is really Apache plus Linux. With a few more user features, I think Sun Web Server could replace the whole Apache/Linux stack, the Apache/Linux/Tomcat stack, outshine those solutions on heavy loads and high end features, and offer better ROI.

  • Bulk insert into oracle using ssis

    Hi ,
    Can someone please suggest me the way to Bulk insert data into oracle database? I'm using oledb which doesnt support bulk insert into oracle.
    Pls note I cant use Oracle ATTUnity as it requires enterprise edition but i have only Standard edition and hence that option is ruled out.
    Is there any other way that I can accompolish BULK insert?
    Please help me out.
    Thanks,
    Prabhu

    Hi Prabhu,
    I am very late to help you solve the query but following is the solution to 'Bulk Insert into Oracle' that worked for me.
    To use below code for SSIS 2008 R2 in a
    Script Task component you would need following API references.
    Prerequisites:
    1. C:\Program Files (x86)\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SQLServer.DTSRuntimeWrap.dll
    2. Install "Oracle Data Provider For .NET 11.2.0.1.0" and add a reference to
    Oracle.DataAccess.dll.
       Microsoft SQL Server Integration Services Script Task
       Write scripts using Microsoft Visual C# 2008.
       The ScriptMain is the entry point class of the script.
     *  Description : SQL to Oracle Bulk Copy/Insert
     *  Created By  : Mitulkumar Brahmbhatt
     *  Created Date: 08/14/2014
     *  Modified Date   Modified By     Description
    using System;
    using System.Data;
    using Microsoft.SqlServer.Dts.Runtime;
    using System.Windows.Forms;
    using Oracle.DataAccess.Client;
    using Microsoft.SqlServer.Dts.Runtime.Wrapper;
    using System.Data.OleDb;
    namespace ST_6e18a76102dd4312868504c4ef95279d.csproj
        [System.AddIn.AddIn("ScriptMain", Version = "1.0", Publisher = "", Description = "")]
        public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
            #region VSTA generated code
            enum ScriptResults
                Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
                Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
            #endregion
            public void Main()
                ConnectionManager cm;
                IDTSConnectionManagerDatabaseParameters100 cmParams;
                OleDbConnection oledbConn;
                DataSet ds = new DataSet();
                string sql;
                try
                    /********** Pull Sql Source Data into a Dataset *************/
                    cm = Dts.Connections["SRC_CONN"];
                    cmParams = cm.InnerObject as IDTSConnectionManagerDatabaseParameters100;
                    oledbConn = (OleDbConnection)cmParams.GetConnectionForSchema() as OleDbConnection;
                    sql = @"Select * from [sourcetblname]'';
                    OleDbCommand sqlComm = new OleDbCommand(sql, oledbConn);
                    OleDbDataAdapter da = new OleDbDataAdapter(sqlComm);
                    da.Fill(ds);
                    cm.ReleaseConnection(oledbConn);
                    /***************** Bulk Insert to Oracle *********************/
                    cm = Dts.Connections["DEST_CONN"];
                    cmParams = cm.InnerObject as IDTSConnectionManagerDatabaseParameters100;
                    string connStr = ((OleDbConnection)cmParams.GetConnectionForSchema() as OleDbConnection).ConnectionString;
                    cm.ReleaseConnection(oledbConn);
                    sql = "destinationtblname";
                    using (OracleBulkCopy bulkCopy = new OracleBulkCopy(connStr.Replace("Provider=OraOLEDB.Oracle.1", "")))
                        bulkCopy.DestinationTableName = sql;
                        bulkCopy.BatchSize = 50000;
                        bulkCopy.BulkCopyTimeout = 20000;
                        bulkCopy.WriteToServer(ds.Tables[0]);
                    /***************** Return Result - Success *********************/
                    Dts.TaskResult = (int)ScriptResults.Success;
                catch (Exception x)
                    Dts.Events.FireError(0, "BulkCopyToOracle", x.Message, String.Empty, 0);
                    Dts.TaskResult = (int)ScriptResults.Failure;
                finally
                    ds.Dispose();
    Mitulkumar Brahmbhatt | Please mark the post(s) that answered your question.

  • Using Sun Web Server 6.1 from the IDE

    Using JSE 8 with Sun Web Server 6.1 set as the target container, I have a SUNWS61deployment.xml file created.
    That didn't exist in JSE 7. Is it WS 6.1 SP4 or SP5 -related ?
    I also have ws61-sun-web.xml with a simple <sun-web-app/> tag (empty deployment descriptor).
    What should this file contain? Is it a replacement for sun-web.xml?
    Do I still need sun-web.xml? Its DTD declaration sounds like Sun
    App Server 7 (http://www.sun.com/software/sunone/appserver/dtds/sun-web-app_2_3-1.dtd)
    So you have plans to make "Sun Resources" (pools, JNDI resources, ...) created in the IDE be registerable directly in the Web Server just like it's possible with the sun app server?
    How safe is it to use JSE 8 with an older Web Server Service Pack (say 6.1SP1)?

    SUNWS61deployment.xml is created bythe IDE to be used internally and not to be used by the developer. This file wouldn't be sent to webserver after deployment.
    The ws61-sun-web.xml is sun-web.xml only and yes it is same as it is in Appserver7 as the webcontainer for both Webserver6.1 and Appserver7 are same. After deployment to webserver, ws61-sun-web.xml is renamed to Webserver as sun-web.xml by the IDE. When opened the developer can edit in the XML editor.
    The reason for having it as ws61-sun-web.xml in IDE is to avoid the clash between sun-web.xml of Appserver8.1 which is J2EE1.4 based whereas Webserver6.1 Web container is J2EE1.3 based.
    It should be okay to use any service pack of Webserver6.1 with JSE8
    Hope this helps

  • How to do auto URL redirect in sun web server ?

    Hi, i need to do auto url redirect in my sun web server. Currently i'm setup some rules for the reverse proxy in obj.conf file and the syntax looks like:
    <Object name="reverse-proxy-/test">
    <If $internal and $uri =~ "index.html">
    NameTrans fn="redirect" from="/" uri="/examples/abc.html"
    </If>
    Route fn="set-origin-server" server="http://localhost:8989"
    </Object>
    The situation is:
    1) When users browse "*http://localhost/examples/abc.html*" it will redirect to abc.html
    2) When users browse "*http://localhost/test*" it will redirect to the localhost admin GUI (http://localhost:8989/admingui/admingui/serverTaskGeneral)
    My desire output should be whenever users browse the "*http://localhost/test*" , it will redirect to abc.html page.
    the syntax might be wrong. So, anyone knows how to fix this? I'm keep trying but nothing worked. Please help me.

    Moderator action: Moved from Servers General Discussion.
    db

  • Need help with URL Redirect in Sun Web Server 7 u5

    All I am trying to do is redirect to a static URL and for the life of me I can not get it to behave the way I would expect. I am new to Sun Web Server so I am just trying to use the Admin Console to set this up.
    Here is what I'm trying to do:
    Redirect from - http://www.oldsite.com/store/store.html?store_id=2154
    To - http://www.newsite.com/Stores/StoreFront.aspx?StoreId=2154
    Here's what I tried in the console.
    Added a new URL Redirect
    Set the Source to be Condition and set it to: '^/store_id=2154$' (quotes included)
    Then set the Target to: http://www.newsite.com/Stores/StoreFront.aspx?StoreId=2154
    Then for the URL Type I checked Fixed URL
    When I tested with: http://www.oldsite.com/store/store.html?store_id=2154 it did redirect as desired
    BUT
    When I tested with: "http://www.oldsite.com/store/store.html?store_id=5555" it too got redirected to the Target and I can't figure out how this second URL can satisfy the condition to get redirected.
    Any help is most appreciated.

    thanks for choosing sun web server 7
    it is simpler if you just edit the configuration files manually
    cd <ws7-install-root>/https-<hostname>/config/
    edit obj.conf or <hostname>-obj.conf (if there is one for you depending on your configuration so that it look something like)
    <Object name="default">
    AuthTrans..
    #add the folllowing line here
    <If defined $query>
    <If $urlhost =~ "/oldsite.com" and
    $uri =~ "/store/store.html" and
    $query =~ "store_id=2154" >
    NameTrans fn="redirect" from="/" http://www.newsite.com/Stores/StoreFront.aspx?StoreId=2154
    </If>
    </If>
    ..rest of the existing obj.conf. continues
    NameTrans...
    now, you can either do <ws7-install-root>/https-<hostname>/bin/reconfig -> to reload your configuration without any server downtime or <ws7-install-root>/https-<hostname>/bin/restart -> to restart the server
    if it did work out for your, you will need to run the following so that admin server is aware of what you just did
    <ws7-install-root>/bin/wadm pull-config user=admin config=<hostname> <hostname.domainname>
    hope this helps

  • How to extract data from xml and insert into Oracle table

    Hi,
    I have a large xml file. which will have hundreds of the following transaction tags having column names and there values.
    There is a table one of the schema with coulums "actualCostRate","billRate"....etc.
    I need to extract the values of these columns and insert into the table
    <Transaction actualCostRate="0" billRate="0" chargeable="1" clientID="NikuUK" chargeCode="LCOCD1" externalID="L-RESCODE_UK1-PROJ_UK_CNT_GBP-37289-8" importStatus="N" projectID="TESTPROJ" resourceID="admin" transactionDate="2002-02-12" transactionType="L" units="11" taskID="5017601" inputTypeCode="SALES" groupId="123" voucherNumber="ABCVDD" transactionClass="ABCD"/>
    <Transaction actualCostRate="0" billRate="0" chargeable="1" clientID="NikuEU" chargeCode="LCOCD1" externalID="L-RESCODE_US1-PROJ_EU_STD2-37291-4" importStatus="N" projectID="TESTPROJ" resourceID="admin" transactionDate="2002-02-04" transactionType="L" units="4" taskID="5017601" inputTypeCode="SALES" groupId="124" voucherNumber="EEE222" transactionClass="DEFG"/>

    Re: Insert from XML to relational table
    http://www.google.ae/search?hl=ar&q=extract+data+from+xml+and+insert+into+Oracle+table+&btnG=%D8%A8%D8%AD%D8%AB+Google&meta=

Maybe you are looking for

  • Help needed in Sorting Columns (date sorts alphabetically)

    Hi All, I have a report query as follows: select to_date(period,'MON-YYYY') start_date ,exp_type ,id ,acct_ref ,dept_ref ,item_date ,amt from test; I need to display the report in the same order as select statement (start_date,exp_type,id etc). I hav

  • Reg: GOING TO SELECTION SCREEN FROM ALV GRID.

    Hi all, Iam using an ALV grid display. I have called the grid display every times when i select a check box in the grid display. Then when i click on the back button the screen navigates to the previous ALV grid. My requirement is to go to the first

  • Can not create source distribution from project

    Visit the Request Support page at ni.com/ask to learn more about resolving this problem. Use the following information as a reference: Error 1 occurred at AB_Destination.lvclass:Copy_File.vi -> AB_Source.lvclass:Copy_SourceItem.vi -> AB_Build.lvclass

  • Save changes automatically in alvgrid

    Hello all, How do i save changes automatically in alvgrid. I display data with fields which can be editable & some which are not. The fields which are editable should be saved automatically. These fields should be saved in global internal table. I ha

  • URGENT HELP! My mini completely died!!!

    I was in the process of transfering some music files to my external hard drive and all of a sudden its power cut off completely! All of the other things plugged through the surge protector did not cut off so its not a power issue on that end. I tried