Issue of inserting greek characters into Oracle database using ICAN505

Hi All,
We are currently facing an issue of inserting greek characters into Oracle database using ICAN505.
We receive a file containing greek characters.The values from the file should be inserted into the database.We are reading the file using file OTD with default encoding.
The file can contain english characters too other than greek characters.
The database NLS_CHARACTERSET is AL32UTF8.
When I insert using an insert statement directly ,the values get inserted properly into the DB table.
Inserting the same values using code results in improper characters getting inserted into the table in the database.
Please help....
Thanks in advance !!

Globalization forum?
Globalization Support
It works for SQL Developer, which does not depend on NLS_LANG, so I suspect a problem with your NLS settings.

Similar Messages

  • Issue in Inserting Greek characters in Oracle DB

    We are facing the following issue in our project. Need urgent help.
    We have a multilingual string(message with Greek characters) coming in from KSD gateway. This is to be processed by MHL(message handling layer- which validates and converts the incoming message into SQL statements and vice versa). Once the validation and conversion of incoming message is completed and then SQL statement is prepared, it inserts this data in the Oracle database. We are using OCI interface for database communication. Client program is written in C language. While inserting data in Oracle DB, we are getting exception as explained below.
    EventVwr Output:
    SCREEN 1:
    ODI Oracle error report has been issued
    ODI Error: DbConnId 0 - Oracle error msg:
    ORA-00917: missing comma
    SqlStatement='INSERT INTO M_ENS_REJ_FUN_ERR (MSG_NUM,FUN_ERR_SEQ,ERR_TYPE,ERR_POINT,ERR_REASON,ORIG_ATTR_VAL) VALUES (17549,1,'1','Îάν Î¬Î½Î±Ï Î±ÏοÏÏÎ¿Î»Î¬Î±Ï ÎµÎ¯Î½Î±Î¹ δΕλÏÎ¼Î¬Î½Î¿Ï Î³Î¹Î± Ïλα Ïα είδΕ ÏÏÏε ÏÏάÏει να δΕλÏθεί Ïε εÏίÏεδο βαÏικÏν ÏÏοιÏείÏν ειδάλÏÏ Ïε εÏίÏεδο είδοÏÏ ÏÏÏÎ','1','')'
    SCREEN 2:
    Error executing OCI Statement
    Failed to execute PL/SQL command INSERT INTO M_ENS_REJ_FUN_ERR (MSG_NUM,FUN_ERR_SEQ,ERR_TYPE,ERR_POINT,ERR_REASON,ORIG_ATTR_VAL) VALUES (17549,1,'1','Îάν Î¬Î½Î±Ï Î±ÏοÏÏÎ¿Î»Î¬Î±Ï ÎµÎ¯Î½Î±Î¹ δΕλÏÎ¼Î¬Î½Î¿Ï Î³Î¹Î± Ïλα Ïα είδΕ ÏÏÏε ÏÏάÏει να δΕλÏθεί Ïε εÏίÏεδο βαÏικÏν ÏÏοιÏείÏν ειδάλÏÏ Ïε εÏίÏεδο είδοÏÏ ÏÏÏÎ','1','') on DbConnId 0 file ..\MHL - source\MhlOdi.c line 803
    SCREEN 3
    Inbound thread ODI update to table field failed
    SQL insert failed on DbConnId 0
    INSERT INTO M_ENS_REJ_FUN_ERR (MSG_NUM,FUN_ERR_SEQ,ERR_TYPE,ERR_POINT,ERR_REASON,ORIG_ATTR_VAL) VALUES (17549,1,'1','Îάν Î¬Î½Î±Ï Î±ÏοÏÏÎ¿Î»Î¬Î±Ï ÎµÎ¯Î½Î±Î¹ δΕλÏÎ¼Î¬Î½Î¿Ï Î³Î¹Î± Ïλα Ïα είδΕ ÏÏÏε ÏÏάÏει να δΕλÏθεί Ïε εÏίÏεδο βαÏικÏν ÏÏοιÏείÏν ειδάλÏÏ Ïε εÏίÏεδο είδοÏÏ ÏÏÏÎ','1','')
    in file ..\MHL - source\MhlInBound.c line 2342
    We have looked into the trace file generated by MHL and found that the MHL is unable to process Greek characters and hence is unable to generate a valid SQL statement.
    Trace File Output:
    09/02/2012 10:22:54.437 T2228>> ODIExecNonQuerySqlStatement
    09/02/2012 10:22:54.437 T2228
    09/02/2012 10:22:54.437 T2228 SqlStatement=INSERT INTO M_ENS_REJ_FUN_ERR (MSG_NUM,FUN_ERR_SEQ,ERR_TYPE,ERR_POINT,ERR_REASON,ORIG_ATTR_VAL) VALUES (18175,1,'1','Îάν Î¬Î½Î±Ï Î±ÏοÏÏÎ¿Î»Î¬Î±Ï ÎµÎ¯Î½Î±Î¹ δΕλÏÎ¼Î¬Î½Î¿Ï Î³Î¹Î± Ïλα Ïα είδΕ ÏÏÏε ÏÏάÏει να δΕλÏθεί Ïε εÏίÏεδο βαÏικÏν ÏÏοιÏείÏν ειδάλÏÏ Ïε εÏίÏεδο είδοÏÏ ÏÏÏÎ','1','')
    09/02/2012 10:22:54.437 T2228 In OCIStmtExecute
    09/02/2012 10:22:54.437 T2228 SQL STMTExecute=
    09/02/2012 10:22:54.437 T2228>> ODICheckError
    09/02/2012 10:22:54.437 T2228 Non-Fatal Database Error - msg: ORA-00917: missing comma
    , code: 917
    09/02/2012 10:22:54.437 T2228<< ODICheckError
    09/02/2012 10:22:54.437 T2228>> ODIOracleErrorReport
    09/02/2012 10:22:54.437 T2228<< ODIOracleErrorReport
    09/02/2012 10:22:54.437 T2228 SQL STMTExecute=INSERT INTO M_ENS_REJ_FUN_ERR (MSG_NUM,FUN_ERR_SEQ,ERR_TYPE,ERR_POINT,ERR_REASON,ORIG_ATTR_VAL) VALUES (18175,1,'1','Îάν Î¬Î½Î±Ï Î±ÏοÏÏÎ¿Î»Î¬Î±Ï ÎµÎ¯Î½Î±Î¹ δΕλÏÎ¼Î¬Î½Î¿Ï Î³Î¹Î± Ïλα Ïα είδΕ ÏÏÏε ÏÏάÏει να δΕλÏθεί Ïε εÏίÏεδο βαÏικÏν ÏÏοιÏείÏν ειδάλÏÏ Ïε εÏίÏεδο είδοÏÏ ÏÏÏÎ','1','')
    09/02/2012 10:22:54.437 T2228<< ODIExecNonQuerySqlStatement
    09/02/2012 10:22:54.437 T2228 Error: SQL insert failed on DbConnId 0
    INSERT INTO M_ENS_REJ_FUN_ERR (MSG_NUM,FUN_ERR_SEQ,ERR_TYPE,ERR_POINT,ERR_REASON,ORIG_ATTR_VAL) VALUES (18175,1,'1','Îάν Î¬Î½Î±Ï Î±ÏοÏÏÎ¿Î»Î¬Î±Ï ÎµÎ¯Î½Î±Î¹ δΕλÏÎ¼Î¬Î½Î¿Ï Î³Î¹Î± Ïλα Ïα είδΕ ÏÏÏε ÏÏάÏει να δΕλÏθεί Ïε εÏίÏεδο βαÏικÏν ÏÏοιÏείÏν ειδάλÏÏ Ïε εÏίÏεδο είδοÏÏ ÏÏÏÎ','1','')
    09/02/2012 10:22:54.437 T2228 SQLstatements---------->=INSERT INTO M_ENS_REJ_FUN_ERR (MSG_NUM,FUN_ERR_SEQ,ERR_TYPE,ERR_POINT,ERR_REASON,ORIG_ATTR_VAL) VALUES (18175,1,'1','Îάν Î¬Î½Î±Ï Î±ÏοÏÏÎ¿Î»Î¬Î±Ï ÎµÎ¯Î½Î±Î¹ δΕλÏÎ¼Î¬Î½Î¿Ï Î³Î¹Î± Ïλα Ïα είδΕ ÏÏÏε ÏÏάÏει να δΕλÏθεί Ïε εÏίÏεδο βαÏικÏν ÏÏοιÏείÏν ειδάλÏÏ Ïε εÏίÏεδο είδοÏÏ ÏÏÏÎ','1','')09/02/2012 10:22:54.437 T2228 Inbound thread - attempting rollback of 1 SQL insert statements on DbConnId 0
    09/02/2012 10:22:54.437 T2228>> ODIRollback
    However, when tried to insert the same string through the SQL developer it is successful in doing so.

    Globalization forum?
    Globalization Support
    It works for SQL Developer, which does not depend on NLS_LANG, so I suspect a problem with your NLS settings.

  • Inserting Multiple Images into oracle database using JDBC

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

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

  • Insert Unicode Characters Into Oracle 8.1.5

    Hello,
    First off, here are the specs:
    Oracle 8.1.5
    JDK 1.2.1
    Oracle8i 8.1.6.2.0 JDBC Drivers for use with JDK 1.2.x for Solaris
    I'm running into a problem with insert Unicode characters into Oracle via the JDBC driver. As you can see above, I am using the Oracle 8.1.6.2.0 JDBC driver because it is the first driver with supports the JDK 1.2.x. So I think I should be okay.
    I can retrieve data with special characters from Oracle by calling the getBytes() method from the ResultSet with all special characters being intact. I am using getBytes because calling getString() would throw the following exception: "java.sql.SQLException(): Fail to convert between UTF8 and UCS2: failUTF8Conv". However, with that value that I just retrieved, or any other data with special characters (unicode) in which I try to insert into Oracle does not get converted properly.
    What appears to be happening is that data with special characters (unicode), are not being treated as a single double byte character, but rather two single byte characters. Thus, R|ckschlagventil becomes RC<ckschlagventil once it is inserted. (Hopefully, my example will be rendered properly).
    According to all documentation that I have found, the JDBC driver should not have any problem with converting UCS2 Java Strings to Oracle's UTF8 character set.
    I have set Oracle's NLS_NCHAR_CHARACTERSET to UTF8. I am also setting the environment variable NLS_LANG to AMERICAN_AMERICA.UTF8. Perhaps there is some other environment setting in which I am missing?
    Any help would be appreciated,
    Christian
    null

    Import has a lot of options, so it depends on what you want to do.
    C:\> imp help=y
    will show you all possible options. An example of full import :
    C:\> imp <username>/<password>@<TNS alias> file=<DMP file> full=y log=<LOG file>
    Message was edited by:
    Paul M.
    ...and there is always [url http://download-uk.oracle.com/docs/cd/F49540_01/DOC/index.htm]The documentation

  • Insert date time into oracle database from jsp

    pls tell me ,from jsp how can I insert datetime values into oracle database .I am using oracle 9i .here is codethat i have tried
    html--code
    <select name="date">
    <option selected>dd</option>
    <option>1</option>
    <option>2</option>
    <option>3</option>
    <option>4</option>
    </select>
    <select name="month">
    <option selected>dd</option>
    <option>1</option>
    <option>2</option>
    <option>3</option>
    <option>4</option>
    </select>
    <select name="year">
    <option selected>dd</option>
    <option>2004</option>
    <option>2005</option>
    <option>2006</option>
    <option>2007</option>
    </select>
    here the jsp code
    <% date= request.getParameter("date"); %>
    <% month= request.getParameter("month"); %>
    <% year= request.getParameter("year"); %>
    try
    { Class.forName("oracle.jdbc.driver.OracleDriver"); }
    catch (ClassNotFoundException exception)
    try
         Connection connection = null;
         out.println("connectiong the database");
    connection = DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:orcsid","scott","tiger");
    out.println("connection getted");
         int rows = 0;
         String query_2 = "insert into mrdetails values(?)";
         String dob = date+month+year;
         prepstat = connection.prepareStatement(query_2);
         prepstat.setTimestamp(4,dob);
         rows = prepstat.executeUpdate();
         out.println("data updated");
    catch (Exception exception3)
    out.println("Exception raised"+exception3.toString());
    }

    To insert date values into a database, you should use java.sql.Date. If it also has a time component, then java.sql.TimeStamp.
    Your use of prepared statements is good.
    You just need to convert the parameters into a date.
    One way to do this is using java.text.SimpleDateFormat.
    int rows = 0;
    String query_2 = "insert into mrdetails values(?)";
    String dob = date+"/" + month+ "/" + year;
    SimpleDateFormat sdf = new SImpleDateFormat("dd/MM/yyyy");
    java.util.Date javaDate = sdf.parse(dob);
    java.sql.Date sqlDate = new java.sql.Date(javaDate .getTime);
    prepstat = connection.prepareStatement(query_2);
    prepstat.setTimestamp(4,sqlDate);
    rows = prepstat.executeUpdate();
    out.println("data updated");Cheers,
    evnafets

  • Insert french characters into the database

    Hi,
    My user requirement is to insert french characters into the db. However he has set as per my suggestion of altering session alter session set nls_language='french' he can't insert french characters. Is this using alter session helps to retrieve only the outputs in french language or to insert too?
    Please help.
    Version : oracle 8i
    nls_parameters at database level:
    SQL> select * from nls_database_parameters;
    PARAMETER VALUE
    NLS_LANGUAGE AMERICAN
    NLS_TERRITORY AMERICA
    NLS_CURRENCY $
    NLS_ISO_CURRENCY AMERICA
    NLS_NUMERIC_CHARACTERS .,
    NLS_CHARACTERSET US7ASCII
    NLS_CALENDAR GREGORIAN
    NLS_DATE_FORMAT DD-MON-RR
    NLS_DATE_LANGUAGE AMERICAN
    NLS_SORT BINARY
    NLS_TIME_FORMAT HH.MI.SSXFF AM
    PARAMETER VALUE
    NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AM
    NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZH:TZM
    NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZH:TZM
    NLS_DUAL_CURRENCY $
    NLS_COMP BINARY
    NLS_NCHAR_CHARACTERSET US7ASCII
    NLS_RDBMS_VERSION 8.1.7.0.0

    Your database character set is US7ASCII : you can only insert ASCII characters which is OK for most French characters but not all. This cannot work for:
    àéèùçChanging NLS_LANGUAGE won't help. You need to change database character set to WE8MSWIN1252 for example. This should be easy in your case because US7ASCII is a binary subset of many others characters set. Please read http://docs.oracle.com/cd/A87860_01/doc/server.817/a76966/ch3.htm#47136

  • Insert data into oracle database using a PHP form

    I'm trying to enter data into my oracle database table using a php form. When I click submit no data is added. Could someone help me please. I'm new to php/oracle thing.
    NOTE: I don't have any problem connecting to the database using php.
    Here is the code I'm using:
    <?php
    // just print form asking for name if none was entered
    if( !isset($query)) {   
    echo "<form action=\"$uri\" method=post>\n";
    echo "<p>Enter Name: ";
    echo "<input type=text size=100 maxlength=200 name=data value=\"$data\">\n";
    echo "<br><input type=submit name=submit value=Submit>\n";
    echo "</form>\n";
    exit;
    // insert client's name
    $query = "INSERT INTO client (name) VALUES ($data)";
    // connect to Oracle
    $username = "xxxx";
    $paswd = "yyyyyy";
    $dbstring = "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)".
    "(HOST=patriot.gmu.edu)(PORT=1521))".
    "(CONNECT_DATA=(SID=COSC)))";
    $db_conn = ocilogon($username, $paswd, $dbstring);
    $stmt = OCIParse($db_conn, $query);
    OCIExecute($stmt, OCI_DEFAULT);
    OCIFreeStatement($stmt);
    OCILogoff($db_conn);
    ?>
    Thanks for your help. I will also appreciate a better was to do it.
    Tony

    resumption and jer,
    Sorry I cannot format the code for easy reading!
    The page is submitting to itself. See action = \"$uri\". I used the same logic to enter SELECT querries into the database. It pulls and displays data back on the webpage. The code I used for this is below. Compare it with the one above for inserting data into the table.
    <?php
    // connect to oracle
    $username = "xxxxx";
         $paswd = "yyyyy";
         $dbstring = "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)".
              "(HOST=patriot.gmu.edu)(PORT=1521))".
              "(CONNECT_DATA=(SID=COSC)))";
         $db_conn = ocilogon($username, $paswd, $dbstring);
    // username and password will be unset if they weren't passed,
    // or if they were wrong
    if( !isset($query)) {
    // just print form asking for account details
    echo "<form action=\"$uri\" method=post>\n";
    echo "<p>Enter Query: ";
    echo "<input type=text size=100 maxlength=200 name=query value=\"$query\">\n";
    echo "<br><input type=submit name=submit value=Submit>\n";
    echo "</form>\n";
    exit;
    // remove unwanted slashes from the query
    $query = stripslashes($query);
    // run the query
    $stmt = OCIParse($db_conn, $query);
    OCIExecute($stmt, OCI_DEFAULT);
    // Open the HTML table.
    print '<table border="1" cellspacing="0" cellpadding="3">';
    // Read fetched headers.
    print '<tr>';
    for ($i = 1;$i <= ocinumcols($stmt);$i++)
    print '<td class="e">'.ocicolumnname($stmt,$i).'</td>';
    print '</tr>';
    // Read fetched data.
    while (ocifetch($stmt))
    // Print open and close HTML row tags and columns data.
    print '<tr>';
    for ($i = 1;$i <= ocinumcols($stmt);$i++)
    print '<td class="v">'.ociresult($stmt,$i).'</td>';
    print '</tr>';
    // Close the HTML table.
    print '</table>';
    OCIFreeStatement($stmt);
    OCILogoff($db_conn);
    ?>

  • 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

  • Unable to insert rows into ORACLE database using ABAP code

    Hai,
    I am facing problem while creating a table in Oracle database with 15 attributes in a table. To create a table I am using the classes:
                      cl_sql_connection  -
    > to create the connection           
                      cl_sql_statement  -
    > to execute the query
    This I used by reffering the SAP program ADBC_DEMO. Without any trouble I am able to create a Table with 6 attributes by following the same procedure in ABCD_DEMO program but the same is not working for the table with 15 attributes .
    Please help me.
    Regards,
    Swetha

    Hai,
    here is my code.
    DATA: V_con_name TYPE dbcon-con_name,
          con_ref TYPE REF TO cl_sql_connection,
          sqlerr_ref TYPE REF TO cx_sql_exception,
          c_tabname  TYPE string VALUE `TO_DETAILS`,
          c_coldefs  TYPE string.
    DATA: IT_ORA LIKE ZVOP_X_ORA_UPDATE OCCURS 0 WITH HEADER LINE.
       V_CON_NAME = 'TVL-DSS-01'.
       concatenate '(LGNUM CHAR(3) primary key,'
                     'TANUM VARCHAR2(10),'
                     'FLAG  CHAR(1),'
                     'BDATU timestamp(3),'
                     'TAPOS VARCHAR2(4),'
                     'MATNR CHAR(18))'
                      'VLQNR VARCHAR2(10),'
                      'VLPLA CHAR(10),'
                      'VLBER CHAR(3),'
                      'NLPLA CHAR(10),'
                      'NLBER CHAR(3),'
                      'VDATE DATE(3) ,'
                      'BNAME CHAR(12),'
                      'VTIME DATE(4),'
                      'PROTYPEFLAG CHAR(1),'
                      'PROCOMFLAG  CHAR(1))'
                into c_coldefs separated by space  .
      TRY.
        PERFORM: CONNECT USING V_CON_NAME CON_REF,
                 CREATE_TABLE USING con_ref c_tabname c_coldefs.
          CATCH cx_sql_exception INTO sqlerr_ref.
            TB_ERROR-MESSAGE = SQLERR_REF->SQL_MESSAGE.
            APPEND TB_ERROR. CLEAR TB_ERROR.
    ENDTRY.
    form create
    form CONNECT using   p_con_name TYPE dbcon-con_name
                         p_con_ref  TYPE REF TO cl_sql_connection
                 RAISING cx_sql_exception.
      p_con_ref = cl_sql_connection=>get_connection( p_con_name ).
    endform.                    " CONNECT
    form create
    form   CREATE_TABLE USING   p_con_ref TYPE REF TO cl_sql_connection
                              p_tabname TYPE string
                              p_coldefs TYPE string
                      RAISING cx_sql_exception.
       DATA:
            l_sqlerr_ref TYPE REF TO cx_sql_exception,
            l_stmt       TYPE string,
            l_stmt_ref   TYPE REF TO cl_sql_statement.
    create a statement object
       l_stmt_ref = p_con_ref->create_statement( ).
    create the statement string
       CONCATENATE
         'create table' p_tabname p_coldefs
         INTO l_stmt SEPARATED BY space.
    execute the DDL command; catch the exception in order to handle the
    case if the table already exists
        TRY.
          l_stmt_ref->execute_ddl( l_stmt ).
        CATCH cx_sql_exception INTO l_sqlerr_ref.
          IF l_sqlerr_ref->dbobject_exists = 'X'
             OR l_sqlerr_ref->internal_error = 1024.
          table already exists => drop it and try it again
            PERFORM:
              drop_table   USING p_con_ref p_tabname,
              create_table USING p_con_ref p_tabname p_coldefs.
          ELSE.
            RAISE EXCEPTION l_sqlerr_ref.
          ENDIF.
      ENDTRY.
    endform.                    " CREATE_TABLE
    please do help me
    Regards,
    Swetha

  • Inserting user variables into MYSQL database using servlet

    I have a servlet that recieves user entered parameters from an html form and inserts them into a user table in MYSQL, or at least is supposed to. I can get it to update the table with specific values but not with the user variables. I know the single quote marks are for inserting specific values but without them it doesn't properly work.
    The parameters are parsed correctly into the variables, so I just can't figure out how to ge tthe variables into the database. Any help would be wonderful
    register.html:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
      <TITLE>Register</TITLE>
    </HEAD>
    <BODY BGCOLOR="#FDF5E6">
    <CENTER><IMG SRC="dvdti.jpg" ALIGN=middle >   </CENTER>
    <HR>
    <H1 ALIGN="CENTER">Please enter your registration details:</H1>
    <FORM ACTION="http://localhost:8080/examples/servlet/Assignment1.register">
      <BR>First Name: <input type="text" NAME="Ufirst_name"><BR>
      <BR>Last Name: <input TYPE="TEXT" NAME="Ulast_name"><BR>
      <BR>Address: <INPUT TYPE="text"  name="Uaddress"><BR>
      <BR>E-mail:     <INPUT TYPE="TEXT" NAME="Uemail"><BR
      <BR>Password: <INPUT TYPE="password" NAME="Upassword"><BR>
      <CENTER>
        <INPUT TYPE="SUBMIT" VALUE="Register">
      </CENTER>
    </FORM>
    </BODY>
    </HTML>
    register.java:
    package Assignment1;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    // Connects to a database to retrieve music data
    public class register extends HttpServlet {
      public void doGet(HttpServletRequest request,
                        HttpServletResponse response)
          throws ServletException, IOException {
        response.setContentType("text/html");
        PrintWriter out = response.getWriter();
    // Database connection code starts here
         Connection conn = null;
         // loading jdbc driver for mysql (help in mysql.jar file in classpath)
         try{
             Class.forName("com.mysql.jdbc.Driver").newInstance();
         } catch(Exception e) {
             System.out.println(e);
         // connecting to database
         try{
              // connection string for demos database, username demos, password demo-pass
             conn = DriverManager.getConnection
            ("jdbc:mysql://mudfoot.doc.stu.mmu.ac.uk:3306/roddiea?user=roddiea&password=");
              System.out.println("Connection to database successful.");
           catch(SQLException se) {
             System.out.println(se);
    // Create select statement and execute it
      try        { Statement stmt2 = conn.createStatement();
              // Get the regdetails from the reg form
               String Ufirst_name = request.getParameter("Ufirst_name");
               String Ulast_name = request.getParameter("Ulast_name");
               String Uaddress = request.getParameter("Uaddress");
               String Uemail = request.getParameter("Uemail");
                  String Upassword = request.getParameter("Upassword");
              stmt2.executeUpdate("INSERT INTO customer(first_name, last_name, address, email, password)" + "VALUES('Ufirst_name', 'Ulast_name', 'Uaddress', 'Uemail', 'Upassword')");
              System.out.println (stmt2);
              out.println(stmt2);
              out.println(Ufirst_name + Ulast_name + Uaddress + Uemail + Upassword);
        // close the html
        out.println("</BODY></HTML>");
              stmt2.close();
             conn.close();
         }catch(SQLException se) {
             System.out.println(se);
    }Message was edited by:
    Altered_Carbon
    Message was edited by:
    Altered_Carbon
    I also realise that this is a more MYSQL titled problem, but those forums look rubbish <_<

    Investigate PreparedStatement.
    Currently you're trying to insert a value "Ufirst_name" instead of the value of the variable called Ufirst_name.
    It's possible to do this (you could do something like this: "... '" + UfirstName + "' ...") but DEFINITELLY NOT RECOMMENDED. Instead use a prepared statement.
    D.

  • How to insert & # special characters into oracle table?

    I have a text value which contains special characters such as & and #.
    After I pass from one page to another,
    TEST& becomes "TEST&amp;"
    I put " " on the above test, otherwise amp; will be truncated by OTN).
    TEST# becomes TEST (# is truncated).
    Actually the value is saved in table like this: "TEST&amp;"
    How to solve this problem?
    How to insert & into table without &amp;
    Thank you.
    Edited by: user628655 on Jul 27, 2009 9:47 AM
    Edited by: user628655 on Jul 27, 2009 9:49 AM
    Edited by: user628655 on Jul 27, 2009 10:39 AM

    Avoid doing that through a link. If this is a page item then submit the page and redirect to the target page using a branching. On the target page, create a computation to compute the target item using the original page item as the source. If you are talking about a report, use the id to pass through the link and fetch the text column in an on load computation.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    ------------------------------------------------------------------------------

  • Issue with displaying Greek characters in Oracle 11.1

    Hi,
    We are having issues with display of Non-English language (for ex Greek) text on Pega-PRPC. The text is stored in a reference table in Oracle DB. However there is not need of translation in PRPC as it has the capability of displaying non-english language also.
    I believe that it is a issue with DB settings, although not sure of what is the setting.
    Below is the result after running the query: select * from nls_database_parameters
    NLS_LANGUAGE     AMERICAN
    NLS_TERRITORY     AMERICA
    NLS_CURRENCY     $
    NLS_ISO_CURRENCY     AMERICA
    NLS_NUMERIC_CHARACTERS     .,
    NLS_CHARACTERSET     AL32UTF8
    NLS_CALENDAR     GREGORIAN
    NLS_DATE_FORMAT     DD-MON-RR
    NLS_DATE_LANGUAGE     AMERICAN
    NLS_SORT     BINARY
    NLS_TIME_FORMAT     HH.MI.SSXFF AM
    NLS_TIMESTAMP_FORMAT     DD-MON-RR HH.MI.SSXFF AM
    NLS_TIME_TZ_FORMAT     HH.MI.SSXFF AM TZR
    NLS_TIMESTAMP_TZ_FORMAT     DD-MON-RR HH.MI.SSXFF AM TZR
    NLS_DUAL_CURRENCY     $
    NLS_COMP     BINARY
    NLS_LENGTH_SEMANTICS     BYTE
    NLS_NCHAR_CONV_EXCP     FALSE
    NLS_NCHAR_CHARACTERSET     AL16UTF16
    NLS_RDBMS_VERSION     11.1.0.6.0
    Please help.

    869852 wrote:
    Hi,
    We are having issues with display of Non-English language (for ex Greek) text on Pega-PRPC. The text is stored in a reference table in Oracle DB. However there is not need of translation in PRPC as it has the capability of displaying non-english language also.
    I believe that it is a issue with DB settings, although not sure of what is the setting.
    The first question that needs to be answered is whether the problem is a data storage problem or data presentation problem.
    The query below will answer this question.
    SELECT ASCIISTR(greek_column) from greek_table where key_id = <specific_value>;

  • Re: Insert data into oracle database using a PHP form

    Hai its different for me, i want to display a data based on the input from php form. I see and trying your script but it didn't work.
    <?php
    // just print form asking for name if none was entered
    if( !isset($query)) {
    echo "<form action=\"$uri\" method=post>\n";
    echo "<p>Enter Name: ";
    echo "<input type=text size=100 maxlength=200 name=data value=\"$data\">\n";
    echo "<br><input type=submit name=submit value=Submit>\n";
    echo "</form>\n";
    exit;
    $data=$_POST;
    stripslashes($data);
    // Select statement
    $query = "SELECT * FROM animal WHERE skin=$data";
    // connect to Oracle
    $username = "xxxxxx";
    $paswd = "xxxxxx";
    $dbstring = "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)".
    "(HOST=yyyyyyyy)(PORT=1521))".
    "(CONNECT_DATA=(SID=COSC)))";
    $db_conn = ocilogon($username, $paswd, $dbstring);
    //$stmt = OCIParse($db_conn, $query);
    //OCIExecute($stmt, OCI_DEFAULT);
    //OCIFreeStatement($stmt);
    //OCILogoff($db_conn);
    $stmt = OCIParse ($db_conn, $sql);
    OCIBindByName ($stmt, ":name", &$data, -1);
    OCIExecute ($stmt);
    OCIFreeStatement($stmt);
    OCILogoff ($db_conn);
    ?>
    Could you please advice me ? whats wrong with that script ?

    What is the error you get? What solutions have you tried already?

  • Need help on interface to store images into oracle database using forms 6i

    i am using forms 6i and oracle 8i. i am able to store .jpg and other picture files into data base.now my problem is how show and store the CAD/CAM drawings using forms. can any one help me please. is higher version is providing any new facility for this purpose?
    thank you

    thanks for your help.
    i am using client/server based application and cad/cam software was also installed on it. helper application means, the cad/cam software should provide some controls to view the drawings in other applications? am i correct.

  • Help on interface to store CAD/CAM drawings into oracle database using form

    i am using forms 6i and oracle 8i. i am able to store .jpg and other picture files into data base.now my problem is how show and store the CAD/CAM drawings using forms. can any one help me please. is higher version is providing any new facility for this purpose?
    thank you

    thanks for your help.
    i am using client/server based application and cad/cam software was also installed on it. helper application means, the cad/cam software should provide some controls to view the drawings in other applications? am i correct.

Maybe you are looking for