VBScript update Oracle XE

VERY new here. I am working on cenverting a VBScript/MySQL script to oracle. I plan to use the vbscript to place data into an oracle express 10g database.
I used migration workbench to migrate the schema from MySQL to Oracle Express. This went well. I can see all the tables, triggers and sequences. I guess because the the MySQL database ran in a root context, the Oracle schema is called 'ROOT'. I dont care, its fine.
I created a DSN on my XP/SP2 machine:
Data Source Name: Winventory_Ora
Description: Winventory_Ora
TNS Service Name: XE_FC3_ORA
User ID: root
Test of the connection is successfull after providing password.
tnsnames.ora contains service name indicated.
Here is my connection string in the script:
conn = "Driver={Oracle in XE};Dsn=Winventory_Ora;Uid=system;Pwd=xxxxxx;"
database.open conn
Note above that I can't connect with a username of 'ROOT' in the connect string. That produces:
C:\dloads\winvent8\winventory\scripts\audit.vbs(337, 4) Microsoft OLE DB Provide
r for ODBC Drivers: [Oracle][ODBC][Ora]ORA-01017: invalid username/password; log
on denied
Does this seem to be correct so far? I cant write data using the string below:
sql = "INSERT INTO root.network_card (NET_ID, NET_MAC_ADDRESS) VALUES ('35', '00:0B:CD:5A:47:A2')"
database.execute sql
Am I on the right track here? Data never ends up in the oracle database!
Thanks in advance
-mwm

Mike,
Note above that I can't connect with a username of
'ROOT' in the connect string. That produces:
C:\dloads\winvent8\winventory\scripts\audit.vbs(337,
4) Microsoft OLE DB Provide
r for ODBC Drivers: [Oracle][ODBC][Ora]ORA-01017:
invalid username/password; log
on deniedWell, if you can connect successfuly when you test the connection then it must work.
Does the following connect string work (replace the password, please):
conn = "Driver={Oracle in XE};Dsn=Winventory_Ora;Uid=root;Pwd=xxxxxx;"Especially the uid=root is important, since your tables are in the schema root, right?
First make sure that the password for root is correct. Test the connection again and use the schema root for that this time.
Or use sqlplus to verify the root password in xe. Then use that in the connect string above.
Else it looks good so far.
~Dietmar.

Similar Messages

  • How to update oracle jdbc driver to 11.1.0.7.0 JDBC Drivers

    HI,
    I got a jdbc exception *" java.lang.ArrayIndexOutOfBoundsException "*.
    I have known that it is a Oracle JDBC bug and Oracle BUG number is BUG-6396242.
    The problem is too many rows per database transaction and it is fixed at version 11.1.0.7 Oracle JDBC Drivers.
    Here is the 11.1.0.7 Oracle JDBC Driver Readme.
    http://www.oracle.com/technetwork/database/enterprise-edition/111070-readme-083278.html
    and the download
    http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-111060-084321.html
    My question is :
    *1.How to update oracle jdbc drivers with those downloads ?*
    (ps. I have replaced ojdbc5_g.jar, ojdbc5.jar, ojdbc6_g.jar, ojdbc6_g.jar in $ORACLE/jdbc, but it did'nt work. )
    *2.My Oracle version is 11.1.0.6.0, will it be OK if only update the JDBC driver?*
    *3.Do I need to update the jdbc driver where my program runs on the client side ?*
    Thanks for answers~ :)

    Upgrade your database version to 11.1.0.7.
    Installation docs are included with all patches and upgrades.

  • Problem with updating oracle DB with java date thru resultset.updateDate()

    URGENT Please
    I am facing problem in updating oracle database with java date through resultset.updateDate() method. Can anybody help me please
    following code is saving wrong date value (dec 4, 2006 instead of java date jul 4, 2007) in database:
    ResultSet rs = stmt.executeQuery("SELECT myDate FROM myTable");
    rs.first();
    SimpleDateFormat sqlFormat = new SimpleDateFormat("yyyy-mm-dd");
    java.util.Date myDate = new Date();
    rs.updateDate("myDate", java.sql.Date.valueOf(sqlFormat.format(myDate)));
    rs.updateRow();

    I believe you should use yyyy-MM-dd instead of yyyy-mm-dd. I think MM stands for month while mm stands for minute as per
    http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html
    (If this works, after spending so much of your time trying to solve it, don't hit yourself in the head too hard. I find running out of the room laughing hysterically feels better).
    Here is a more standard(?) way of updating:
    String sqlStatement=
    "update myTable set myDate=? where personID=?"
    PreparedStatement p1= connection.prepareStatement(sqlStatement);
    p1.setDate(1,new java.sqlDate());
    p1.setInt(2, personID);
    p1.executeUpdate();

  • Update Oracle with timestamp

    How do I go about updating oracle DB table with timestamp from XI using JDBC receiver?

    Hi SSG,
    1) Generate a string in message mapping for the datetimestamp. You could also do this in the SQL statement by using the oracle SYSDATE function.
    2) In the JDBC receiver channel SQL statement you have 2 choices:
    - If the string is in the default datetimestamp format for your oracle DB, then you can insert it directly.
    - Use the to_date function to convert the string to an Oracle date. I'd recommend this approach. Here's some documentation for this function:
    http://www.techonthenet.com/oracle/functions/to_date.php
    Thanks,
    Jesse

  • Updating Oracle 9.2.0.1.0

    I have a metalink account, but can't seem to figure out where to go to update Oracle database 9.2.0.1.0 to 9.2.0.5.0. I want to install the Jan 2006 CPU and I believe I need to update to 9.2.0.5.0 first. Can someone point me in the right direction?
    thanks in advance.

    Go to Metalink, click on Patches and Updates on tab at the top right, then search for the patch/patchset.

  • How to update Oracle DB 9.2.0.1 to 9.2.0.3 ?

    Execute me, how to update oracle database 9.2.0.1 to 9.2.0.3 ?
    My OS is Windows XP , I can't find the db 9.2.0.3 version in download zone .
    Please tell me thank you very much .

    The 9203 patch is not available on OTN. You can download it from metalink(http://metalink.oracle.com) if you have a support contract.
    Regards,
    Anupama

  • Tp return code 12 after update oracle from 9.2.0.4 to 9.2.0.8

    Hi
    tp return code 12 after update oracle from 9.2.0.4 to 9.2.0.8
    Please help me.
    Thank you

    Hi Maurizio,
    What does the transport logs says about the error?
    -Pinkle

  • Slow updations (Oracle 11g 64 bit enterprise edition on Linux RHEL)

    I have created Following table for profiling updates per second in Oracle Database
    Test(RecordId number,Desciption varchar2(2000) //Btree Index on record id only
    Table has 10000 records only.
    I did updation for every record in loop by follwing query(Stored procedure executed on same server where database exists no network is coming in picture)
    update Test set description = description + 'something' where Recordid = i (loop counter)//existing description has 1000 characters
    I am wondering that updation of only 10000 records was taking 100 Seconds.
    I was expecting atlease 1000 records/second but it is 100 record/second
    Can anyone help to correct me and tell how can we improve database updations?
    Processor Dual proc dual core
    Raid with reading speed 2.5Gbps
    OS : Linux RHEL
    Database:Oracle enterprise edition 64 bit.
    sga_max_size = 1.5 GB
    Any help will be highly appreciated.

    You are running a loop but Oracle will give you read consistency.
    Oracle is probably cloning some of the datablocks as it re-reads them because
    it finds that the block has been previously updated.
    That sort of a loop is absolutely the wrong way to test Oracle.

  • Update oracle table using data through ODBC

    Hi,
    I want to update tables inside an Oracle 8i database.
    The updates depend on data in a mySql database that I want to approach using an ODBC connection.
    I cannot figure out what I need to do to select data from an ODBC source from an oracle session.
    What do I have to call this external table ...
    Edward

    The following link may be relevant. Check it out.
    http://download-east.oracle.com/docs/cd/A87860_01/doc/server.817/a76960/hs_admin.htm

  • How to update oracle Oracle by using JDBC

    Mostly we used and still using the following way, as well as it was recommended by oracle official document.
    String empty_string = "need to be updated";
    conn = getConnection();
    pStmt = conn.prepareStatement("SELECT REFERENCE FROM activity WHERE ID = ? FOR UPDATE");
    pStmt.setLong(1, 1);
    rset = pStmt.executeQuery();
    Clob clob = null;
    while (rset.next()) { 
    clob = rset.getClob(1);
    Writer writer = adapter.getCharacterOutputStream(clob);
    writer.write(empty_string);
    writer.flush();
    writer.close();
    pStmt = conn.prepareStatement("update activity set REFERENCE = ? WHERE ID = ?");
    pStmt.setClob(1, clob);
    pStmt.setLong(2, 1);
    pStmt.executeUpdate();
    Now I want use the second way as below, to be honest I never used it before so I wonder can it work properly? as it did not require an explicit lock. will it bring potential risk? according your experience if it work well, which did better performance?
    1. String toBeUpdated = "need to be updated";
    2. StringReader clob = new StringReader(toBeUpdated );
    3. pStmt = conn.prepareStatement("update activity set REFERENCE = ? WHERE ID = ?");
    4. pStmt.setCharacterStream(1, clob, toBeUpdated.length());
    5. pStmt.setLong(2, 1);
    6. pStmt.executeUpdate();

    Welcome to the vast OTN forums!
    If you are asking about jdbc specifically, perhaps the relevant forum is: {forum:id=1050}.
    If what you really are asking is something like (without java code and context):
    "I used to do Select.. for update, followed by update table .... Can I instead use only update table ... ? When and why would you use one or the other?"
    Then this forum might be ok, but the SQL and PL/SQL forum might be even better: {forum:id=75}

  • Updating Oracle BLOBs through Tomcat's DBCP

    Hi, I've been using Tomcat's DBCP and I'm trying to cast my ResultSet to an OracleResultSet so I can use the getBLOB message. I've searched and realized I had to take part of it out of the wrapper, so I got the connection out of the wrapper using:
    con = ds.getConnection().getMetaData().getConnection();which returned an OracleConnection. However, when I work through the rest of the code, it finally gets to:
    BLOB filedata = ((OracleResultSet)oRS).getBLOB("filedata");and it dies with:
    java.lang.ClassCastException: oracle.jdbc.driver.OracleResultSetImplIf I connect using JDBC without the DBCP datasource, this code works fine. I'm not sure why I can't cast it to something I can use. Can anyone provide some insight on this? I've searched and searched for solutions and tried so many things, but nothing has worked so far aside from just connecting using JDBC.
    The ResultSet is not a DelegatingResultSet, which had tripped me up originally. Once I removed the wrapper from the connection, it seemed to give me all the correct types (OracleConnection, OracleStatement, & OracleResultSetImpl), but I can't seem to use the OracleResultSetImpl.
    Here's my method:
    public static int store(InputStream in) throws SQLException,IOException {
            Connection con = null;
                Context initContext = new InitialContext();
                Context envContext  = (Context)initContext.lookup("java:/comp/env");
                DataSource ds = (DataSource)envContext.lookup("jdbc/develop");
                con = ds.getConnection().getMetaData().getConnection();
            int id = 17;
            String sql = "SELECT file_id,filedata FROM super_files WHERE file_id = "+id+" for update";
            //sql = "SELECT file_id FROM super_files";
            Statement stmt2 = con.createStatement();
            System.out.println("stmt2 class: "+stmt2.getClass());
            ResultSet oRS = stmt2.executeQuery(sql);
            int key = 0;
            if (oRS.next()) {       
    /* this next line is where it dies */
                BLOB fileData = ((OracleResultSet)oRS).getBLOB("filedata");
                   int bufferSize = fileData.getBufferSize();
                    byte buffer[] = new byte[bufferSize];
                    OutputStream os = fileData.getBinaryOutputStream();
                    int bytesRead = 0;
                    while ((bytesRead = in.read(buffer)) != -1) {
                        os.write(buffer, 0, bytesRead);
                    in.close();
                    os.close();
            oRS.close();
            stmt2.close();       
            con.commit();
            return key;
        }

    Hi, I am having the same problem. Were you able to resolve it? Please let me know. I have searched thru the entire WWW but coulnd't find the solution.

  • Updating Oracle Application Express VIEWS

    Hi,
    Are the Oracle ApEx Views updateable - if so, what grant is required or which user is allowed to do it as I would like to update the APEX_APPLICATION_PAGES view?
    Thanks.
    Tony.

    Tony,
    The APEX views are all read-only.
    You can use parts of the APEX builder to batch update a number of different APEX page & shared components, but not all of them.
    Thanks,
    - Scott -
    http://spendolini.blogspot.com
    http://www.sumneva.com

  • Best approach for post-update (Oracle Forms equivalent) operations?

    Hi
    Having scanned all the available literature / blogs / forum posts I can find, I'm not sure of the correct way to proceed here, can anybody advise?
    I am planning to build a custom OAF page to update rows in a seeded Apps table.
    After any update via my page, I want to insert a message into a custom audit table, to record the event for reporting purposes. In Forms I would have used a POST-UPDATE trigger to do that, but there doesn't seem to be a direct equivalent in OAF.
    Here are the approaches I have considered
    1. Db trigger, or related approach. I don't want to do this on a seeded table.
    2. Create a pl/sql EO on the seeded table, use the pl/sql code to store the audit rows on update (this seems easiest to me ...).
    3. Use CallableStatement to create the rows in AM and call from CO (or EO?).
    4. Create java EOs for both the seeded table and the audit table, and implement the audit table update by manipulating the audit table EO.
    From all I have read, I believe #4 is the correct approach as pl/sql EOs are not recommended (except to leverage existing APIs), but it's not clear to me how to go about coding it, could somebody help me get started please?

    Gyan Darpan wrote:
    Step 1- create a Custom method in AM.
    Step 2 - Create a Eo & EOVO for the Audit table.
    Step 3- Get all the value from the page ..which u want to save inside the audit table.
    Step 4 - Once u get the value..set the same to the EOVO using setAttribute();
    Step 5 - Call this method before calling commit.
    Thanks Gyan, that's very helpful. I have a table with multiple updates, and I wasn't confident about how to identify the
    updated records to process them one by one, so after some more searching/experimentation I end up with this approach :
    1. Created an EO + EOVO for the Audit table (not sure VO actually required in this approach).
    2. Exposed the doDML method in the Seeded EO by clicking Data Manipulation Methods on the EO's 'Java' page.
    3. In the doDML method, I added code like this, which is called on every update : ( RequestsEO is the EO of the table being updated, MessagesEO is the audit table also being inserted into. )
           // Get New Message ID and instantiate a MessagesEO row.
           Number Id=Rtr.getSequenceValue("XX_MESSAGES_SEQ");
           NameValuePairs nvp = new NameValuePairs(new String[]{"LineId"},new Object[]{Id.toString()});
           MessagesEOImpl Msg = (MessagesEOImpl)getOADBTransaction().createEntityInstance("oracle.apps.xx.testaudit.server.MessagesEO",nvp);
           // Set various required fields in MessagesEO.
           Msg.setLineId(Id);
           Msg.setLineType("A");
           Msg.setSourceName("AUDITSREQ");
           Msg.setSourceId("1");
           // Build Audit message from fields in updated record.
           Number RequestId=getRequestId();
           String sRequestId=RequestId.toString();
           String sAttribute5=getAttribute5();
           Msg.setTextline("Updated Request ID [" +sRequestId + "] to [" +sAttribute5 + "].");
           // Update Request
           super.doDML(operation, e);
             I'm pretty happy with the result, but am I doing anything I "shouldn't" here?
    In particular, should I try to use VO and/or calling a method in the AM rather than coding direct in the EO?
    Thanks again
    RMH

  • Updating Oracle table with info from Sybase query

    I hope this is the correct forum for this question.
    I am fairly new to Java and JDBC. I am trying to figure out what the best method for updating information in Oracle tables with data from a Sybase table. I would prefer to use Oracle’s transparent gateway but this is not an option my company will pay for so I am creating a java stored procedure and using JDBC to connect to the Sybase database.
    The process I think I need to go thru is
    1.     Query an Oracle table to get the records that need to be updated and the “key” information to query the Sybase table with.
    2.     Use that result to query the Sybase database to get the fields that need to be updated in the Oracle table for those records.
    3.     Update the records on the Oracle table with the data from the Sybase query.
    I know I can just do this procedurally, row-by-row, but I was wondering if anyone knows of a way to accomplish this with SQL and no loops. Is there a way to make a result set available as a “SQL table” for another JDBC query?
    Basically what I would like to do is:
    OraQuery = “ select sybinfo from sometable where updated_date = null”;
    Statement orastmt1 = OraConn.createStatement();
    ResultSet Orars1 = orastmt1.executeQuery (OraQuery);
    SybQuery = “select update_date, sybinfo from sybtable where sybinfo = Orars1.sybinfo”;
    Statement sybstmt = SybConn.createStatement();
    ResultSet Sybrs = sybstmt1.executeQuery (SybQuery);
    OraUpdate = “update (select update_date from sometable, Sybrs where sometable.sybinfo = Sybrs.sybinfo) set update_date = Sybrs.update_date”;
    Statement orastmt2 = OraConn.createStatement();
    ResultSet Orars2 = orastmt2.executeQuery (OraUpdate);
    This may not be possible but if anyone has done something similar and wouldn’t mind sharing I would appreciate it. If there is a “better” way of accomplishing this I am open to suggestions.
    Thanks

    you can try using cachedRowSet() for the Oracle side query.
    The rows in this could be populated using the sybase side query's resultset and then all of this could updated into Oracle in one shot.

  • J2ME app.: To update Oracle table by sending data through mobile phone

    Hello all,
    I want to develop a mobile app to update the table of oracle database by sending the data through the SMS (Short Message Service). Means I'll send a sms through my cellphone containing some data and this data will be used to update the remote oracle database. How to do that?. Plz help.
    Thanx in advance.

    hi
    My problem is here I need to update the loginfo table with the file name, count of records, table name and datetime.
    For instance my dat file is XX.dat
    my database table name is Mytable
    Total record count is 10,00,000 records
    datetime as on this date
    the data in the XX.dat file I am using the controlfile (SQL*loader and dumping into the Mytable.Now my 10,00,000 records are dumped into the Mytable.
    This process information I want to store it in the loginfo table. For this I need the trigger
    CREATE OR REPLACE TRIGGER MYTRIGG
    AFTER INSERT ON MYTABLE
    Declare
    V_Count Number;
    Begin
    Select count(*) into V_Count from Mytable;
    Insert into Loginfo(TotalRecords,Date)
    Values(V_Count,Sysdate);
    end;
    This is the trigger I have used.But in my loginfo table instead of one value as 10,00,000 it is getting each record as row by row
    1
    4
    100
    1000
    10,00,000
    So I need only one value to be stored and at the same time my tablename and filename must also be stored.
    Kindly help me
    suroop

Maybe you are looking for