Using DBCP and Retrieving LastInsertID From An auto_incremented key

I am using Apache Tomcat 4.1.24 with Connector/J 3.0.7 and Mysql 4.0.12. I am trying to use DBCP but need to be able to get the LastInsertID From An auto_incremented key. I have read many examples that say to use "select LAST_INSERT_ID()" with a javax.sql.PreparedStatement but have concerns about this due to the following comment in com.mysql.jdbc.Statement http://www.mysql.com/downloads/api-jdbc-stable.html
* getLastInsertID returns the value of the auto_incremented key
* after an executeQuery() or excute() call.
* <p>
* This gets around the un-threadsafe behavior of
* "select LAST_INSERT_ID()" which is tied to the Connection
* that created this Statement, and therefore could have had
* many INSERTS performed before one gets a chance to call
* "select LAST_INSERT_ID()".
* @return the last update ID.
public long getLastInsertID() {
if (Driver.TRACE) {
Object[] args = new Object[0];
Debug.methodCall(this, "getLastInsertID", args);
return lastInsertId;
I have posted a detailed description of my problems with using com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource which will provide the com.mysql.jdbc.PreparedStatement.getLastInsertID() method shown above, in the following thread http://forum.java.sun.com/thread.jsp?forum=48&thread=396427&tstart=15&trange=15. The connections not being reused with com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource is my reason for wanting to use DBCP.
Thanks For Your Help
James

I have solved the problem that I had by implementing the Jakarta Commons DBCP and the following code to get last insert ids:
PreparedStatement ps = con.prepareStatement("INSERT INTO table1 (description) VALUES(?)", 1);
//The 1 makes it get auto_keys
ps.setString(1, "2222222");
ps.executeUpdate();
ResultSet rs = ps.getGeneratedKeys();
long insertID = -1;
if(rs.next()){
insertID = rs.getLong(1);
I only have one auto increment column in the table so I have just used this simple con.prepareStatement. If you have more than one auto increment column than you can use one of the other con.prepareStatement methods to create your prepared statement.
Using the Jakarta Commons DBCP to pool the connections, I was able to get more than twice the performance of using com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource. I even pounded my implementation using Jakarta Commons DBCP with thousands of requests(10 simultaneous threads) using Apache JMeter and it scaled very well. The pool grew up to about 10 Database connections that were reused for the duration of over 15,000 requests.
I am very confident due to this performance difference and the experiment that I will insert below that com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource is not reusing database connections.
The following is the result of using com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource to pool connections and refreshing a page a bunch of times. The connection are not reused in the pool.
-------------------------------------------------------------------------------------+
| Id | User | Host | db | Command | Time | State | Info |
-------------------------------------------------------------------------------------+
| 554 | test | localhost:35261 | ebayListings | Sleep | 1475 | | |
| 940 | ebayRW | localhost:35949 | ebayListings | Sleep | 18 | | |
| 941 | ebayRW | localhost:35950 | ebayListings | Sleep | 18 | | |
| 942 | ebayRW | localhost:35951 | ebayListings | Sleep | 18 | | |
| 943 | ebayRW | localhost:35952 | ebayListings | Sleep | 18 | | |
| 956 | ebayRW | localhost:35965 | ebayListings | Sleep | 17 | | |
| 957 | ebayRW | localhost:35966 | ebayListings | Sleep | 17 | | |
| 958 | ebayRW | localhost:35967 | ebayListings | Sleep | 17 | | |
| 959 | ebayRW | localhost:35968 | ebayListings | Sleep | 17 | | |
| 960 | ebayRW | localhost:35969 | ebayListings | Sleep | 17 | | |
| 961 | ebayRW | localhost:35970 | ebayListings | Sleep | 17 | | |
| 962 | ebayRW | localhost:35971 | ebayListings | Sleep | 17 | | |
| 963 | ebayRW | localhost:35972 | ebayListings | Sleep | 17 | | |
| 964 | ebayRW | localhost:35973 | ebayListings | Sleep | 17 | | |
| 965 | ebayRW | localhost:35974 | ebayListings | Sleep | 17 | | |
| 966 | ebayRW | localhost:35975 | ebayListings | Sleep | 16 | | |
| 967 | ebayRW | localhost:35976 | ebayListings | Sleep | 16 | | |
| 968 | ebayRW | localhost:35977 | ebayListings | Sleep | 16 | | |
| 969 | ebayRW | localhost:35978 | ebayListings | Sleep | 16 | | |
| 983 | ebayRW | localhost:35993 | ebayListings | Sleep | 6 | | |
| 984 | ebayRW | localhost:35994 | ebayListings | Sleep | 6 | | |
| 985 | ebayRW | localhost:35995 | ebayListings | Sleep | 6 | | |
| 986 | ebayRW | localhost:35996 | ebayListings | Sleep | 6 | | |
| 987 | ebayRW | localhost:35997 | ebayListings | Sleep | 6 | | |
| 988 | ebayRW | localhost:35998 | ebayListings | Sleep | 6 | | |
| 989 | ebayRW | localhost:35999 | ebayListings | Sleep | 6 | | |
| 990 | ebayRW | localhost:36000 | ebayListings | Sleep | 6 | | |
| 991 | ebayRW | localhost:36001 | ebayListings | Sleep | 6 | | |
| 992 | ebayRW | localhost:36002 | ebayListings | Sleep | 6 | | |
| 993 | ebayRW | localhost:36003 | ebayListings | Sleep | 5 | | |
| 994 | ebayRW | localhost:36004 | ebayListings | Sleep | 5 | | |
| 995 | ebayRW | localhost:36005 | ebayListings | Sleep | 5 | | |
| 996 | ebayRW | localhost:36006 | ebayListings | Sleep | 5 | | |
| 1003 | ebayRW | localhost:36014 | ebayListings | Sleep | 5 | | |
| 1009 | ebayRW | localhost:36020 | ebayListings | Sleep | 4 | | |
| 1010 | ebayRW | localhost:36021 | ebayListings | Sleep | 4 | | |
| 1011 | ebayRW | localhost:36022 | ebayListings | Sleep | 4 | | |
| 1012 | ebayRW | localhost:36023 | ebayListings | Sleep | 4 | | |
| 1013 | ebayRW | localhost:36024 | ebayListings | Sleep | 4 | | |
| 1014 | ebayRW | localhost:36025 | ebayListings | Sleep | 4 | | |
| 1015 | ebayRW | localhost:36026 | ebayListings | Sleep | 4 | | |
| 1016 | ebayRW | localhost:36027 | ebayListings | Sleep | 4 | | |
| 1017 | ebayRW | localhost:36028 | ebayListings | Sleep | 4 | | |
| 1018 | ebayRW | localhost:36029 | ebayListings | Sleep | 4 | | |
| 1019 | root | localhost | | Query | 0 | | show processlist |
-------------------------------------------------------------------------------------+
After a while it will just terminates all connections and start piling them up again. Notice the higher ID numbers.
-------------------------------------------------------------------------------------+
| Id | User | Host | db | Command | Time | State | Info |
-------------------------------------------------------------------------------------+
| 554 | test | localhost:35261 | ebayListings | Sleep | 1523 | | |
| 1042 | ebayRW | localhost:36061 | ebayListings | Sleep | 7 | | |
| 1043 | ebayRW | localhost:36062 | ebayListings | Sleep | 7 | | |
| 1046 | ebayRW | localhost:36067 | ebayListings | Sleep | 6 | | |
| 1047 | ebayRW | localhost:36068 | ebayListings | Sleep | 6 | | |
| 1048 | ebayRW | localhost:36069 | ebayListings | Sleep | 6 | | |
| 1049 | ebayRW | localhost:36070 | ebayListings | Sleep | 6 | | |
| 1050 | ebayRW | localhost:36071 | ebayListings | Sleep | 6 | | |
| 1051 | ebayRW | localhost:36072 | ebayListings | Sleep | 6 | | |
| 1052 | ebayRW | localhost:36073 | ebayListings | Sleep | 6 | | |
| 1053 | ebayRW | localhost:36074 | ebayListings | Sleep | 6 | | |
| 1054 | root | localhost | | Query | 0 | | show processlist |
-------------------------------------------------------------------------------------+
I have switched all of my existing Web Applications over to Jakarta Commons DBCP which only involved changing 3 lines of code per file and will allow me the totally change the underlying database without modifying my individual JSPs and Servlets. Jakarta Commons DBCP is a great solution to the Connection Pool Problem and has worked for my needs.
James Fredley

Similar Messages

  • WPF- How to save and retrieve details from database

    I want to develop an desktop app to save and retrieve details from database, but am having a little hitch
    am getting errors in my code, kindly advice below are the required code
    xaml
    <Grid>
            <TextBox HorizontalAlignment="Left" Height="23" Margin="144,28,0,0" TextWrapping="Wrap" x:Name="TbxId" VerticalAlignment="Top" Width="193"/>
            <TextBox HorizontalAlignment="Left" Height="23" Margin="144,134,0,0" TextWrapping="Wrap" x:Name="TbxFn" VerticalAlignment="Top" Width="193"/>
            <TextBox HorizontalAlignment="Left" Height="23" Margin="144,77,0,0" TextWrapping="Wrap" x:Name="TbxLn" VerticalAlignment="Top" Width="193"/>
            <Label Content="Student ID" HorizontalAlignment="Left" Margin="10,28,0,0" VerticalAlignment="Top" Width="101"/>
            <Label Content="Last Name" HorizontalAlignment="Left" Margin="10,134,0,0" VerticalAlignment="Top" Width="101"/>
            <Label Content="First Name" HorizontalAlignment="Left" Margin="10,77,0,0" VerticalAlignment="Top" Width="101"/>
            <Button x:Name="BtnSave" Content="Save" HorizontalAlignment="Left" Margin="23,206,0,0" VerticalAlignment="Top" Width="75" />
            <Button x:Name="BtnBrowse" Content="Browse" HorizontalAlignment="Left" Margin="149,206,0,0" VerticalAlignment="Top" Width="75" Click="Save"/>
            <Button x:Name="BtnShow" Content="Show" HorizontalAlignment="Left" Margin="294,206,0,0" VerticalAlignment="Top" Width="75"/>
            <WindowsFormsHost Grid.Column="0" Margin="448,28,75,243">
                <wf:PictureBox x:Name="pictureBox1" Height="150" Width="150" SizeMode="StretchImage"/>
            </WindowsFormsHost>
        </Grid>
    cs
    private void Browse(object sender, RoutedEventArgs e)
                SqlConnection cn = SqlConnection(global::DatabaseApp.Properties.Settings.Default.Database1ConnectionString);
                try
                    OpenFileDialog dlg = new OpenFileDialog();
                    dlg.Filter = "JPG Files (*.jpg)|*.jpg|GIF Files (*.gif)|*.gif|All Files(*.*)|*.*";
                    dlg.Title = "Select Student Picture";
                    if (dlg.ShowDialog() == DialogResult.OK)
                        imgLoc = dlg.FileName.ToString();
                        picStu.ImageLocation = imgLoc;
                catch(Exception ex)
                    System.Windows.MessageBox.Show(ex.Message);
    Thank you
    Jayjay john

    Hi Joakins,
    I think Lloyd has a point here in that all I see there which is really database related is a connection string.
    Maybe your question is more general though and you're just asking how to work with a database as a general principle.
    Personally, I like entity framework and would recommend that.
    You can read a shed load of stuff about it.
    https://msdn.microsoft.com/en-gb/data/ef.aspx?f=255&MSPPError=-2147217396
    With WPF almost every dev uses MVVM and I'm no exception.
    You may find this interesting:
    http://social.technet.microsoft.com/wiki/contents/articles/28209.wpf-entity-framework-mvvm-walk-through-1.aspx
    The article for the second in the series is only partly written, but the sample is complete:
    https://gallery.technet.microsoft.com/WPF-Entity-Framework-MVVM-78cdc204
    Hope that helps.
    Recent Technet articles: Property List Editing;
    Dynamic XAML

  • I want to store and retrieve images from a oracle datrabase's BLOB type

    Hi all
    I am using WebLogic and Oracle 10g.I have to store images and retrieve them from a BLOB type.
    Please help .

    Please have a look to the Database Application Developer's Guide - Large Objects
    http://download-uk.oracle.com/docs/cd/B19306_01/appdev.102/b14249/toc.htm

  • I have a windows 7 desktop with an external hard drive setup on my home network, will i be able to access this on my home network to save and retrieve files from my mac air?

    i have a windows 7 desktop with an external hard drive setup on my home network, will i be able to access this on my home network to save and retrieve files from my mac air?

    Troubleshooting Home Sharing - http://support.apple.com/kb/TS2972

  • I lost all the information in the ical. I am using icloud and info desapear from ical and several times from my agenda too. But I desperately need the info from my ical. I tried using the time machine but i received a messagem saying that they can not mod

    I am using icloud and info desapear from ical and several times from my agenda too.
    But I desperately need the info from my ical.
    I tried using the time machine but i received a messagem saying that they can not modify ical.
    Can somebody help me?

    First of all, we are not Adobe.  This is a user to user forum.  We are consumers just like you. And I have arthritis, too, although not severe.
    Now let's see if we can help you resolve your problem.
    Where was it purchased from?
    Was it downloaded or was a disc purchased?
    What is your operating system?
    Is it version Photoshop Elements 13?
    Did you use a redemption code to get a serial number?
    Did you sign in/activate?
    Did you create an Adobe account?

  • How to save, update and retrieve data from two diffrent table

    Hi,
    I can save and retrieve data into an user defined SBO form from one database table only. How can I save retrieve and update records from two or more different tables in a single screen?
    Regards,
    Sudeshna.

    Sudeshna,
    Are these tables external to SAP Business One and do not have a Business Object?  If there is a Business Object available such as if you were to enter an order, that order would use the Documents object which abstracts you, the programmer, from the underlying tables that need to be updated.  If you are handling multiple business objects you would need to wrap the transaction with the StartTransaction - EndTransaction methods.  This information is detailed in the SAP Business One SDK Help Center that comes with the SDK.
    HTH,
    Eddy

  • Connect to Oracle DB using DBCP and tnsnames.ora

    I have a Spring-based web app that is running on Tomcat and uses DBCP to connect to Oracle.
    The problem:
    Need to pull database connection information from tnsnames.ora file. There is Oracle Client installed on a server, so tnsnames file is available.
    According to JDBC documentation, the following url should do the trick: jdbc:datadirect:oracle:TNSNamesFile=c:\\oracle\\product\\10.2.0\\NETWORK\\ADMIN\\tnsnames.ora;TNSServerName=FITZGERALD.SALES
    This leads to the following declaration in dataAccessContext-local.xml file:
    +<bean id="dataSource" class="org.apache.tomcat.dbcp.dbcp.BasicDataSource" destroy-method="close">+
    +<property name="driverClassName" value="oracle.jdbc.OracleDriver"/>+
    +<property name="url" value="jdbc:datadirect:oracle:TNSNamesFile=C:\\oracle\\product\\10.2.0\\db_1\\network\\admin\\tnsnames.ora;TNSServerName=TESTDB"/>+
    +<property name="username" value="${jdbc.username}"/>+
    +<property name="password" value="${jdbc.password}"/>+
    +</bean>+
    This doesn&rsquo;t work for me saying that database url is invalid.
    Can anyone provide instructions on how to set up DBCP with tnsnames.ora?
    Any help greatly appreciated.

    You are right, the I got that url may not be correct. I got it from datadirect documentation.
    I couldn�t find any good information or examples on this, but I think using TNS keyword-value pairs and tnsnames.ora is supported by type4 Oracle 10g JDBC.
    Some info I found in section �Connecting to the Database through the Applet� in JDBC Reference http://download.oracle.com/docs/cd/B19306_01/java.102/b14355/jdbcthin.htm#CACCHECD
    I guess there is something off in that documentation though. I couldn't get it working.

  • Get username from session and retrieve records from database wit tat userna

    hello..
    i got a ChangePassword.jsp which i retrieve the username from session using bean to display on e page..
    <jsp:getProperty name="UsernamePassword" property = "username"/>
    but in my servlet, i wan to retrieve records from database with tat username..
    i tot of coding
    String username = (String)request.getSession().getAttribute("UsernamePassword");
    and then use tat username to retrieve records.. but is that e right way? The page did not display and i got a CastingException..
    Please help.

    If you are using the session inside a jsp, you can say "session" without having to declare it.String usernamePassword = (String) session.getAttribute("usernamePassword");However, right after you get this value, check if it is null:
    if(usernamePassword==null)
    // do sth like forward to error page
    else
    // continue processing
    If it is null, then you are probably not setting it right in the first place. Make sure that in your servlet A you create a session, and before you return or forward to a jsp, that you actually set this value in the session like saying
    session.setAttribute("usernamePassword", usernamePassword);
    and it is case sensitive for the key.

  • Use emails and adress book from a different user

    I bought a new Imac and start using it.
    Then when I tryed to restore the back up that I have on my other macbook, that I did on Time Machine, it went to a different user.
    Now I have 2 users.
    There are 2 apps that I can not use with me new user (Things and Email-direct) and can not acess mail and adress book from the other.
    I have already install everything on my new account. What should I do to use the email and adress from my different user account?

    No problem except for a minor nuisance when it's time to update the apps.  Depending on how you do it, you might need to log out and back in again but, in any case, you must have both passwords.
    The iTunes library can hold purchases made with multiple Apple IDs as can the iPod.

  • Uploading PDF in to BLOB and Retrieve PDF from BLOB

    hi
    I have recently started working in apex and run into a bump while trying to handle PDF file Attachments and BLOBs.
    I am trying to upload a PDF file into BLOB database Column using APEX, and later view this file from DB.
    I require assistance on how to upload PDF file into BLOB, and how i can later view this inside the browser window, using APEX
    thanks

    Maybe this blog post can help you.
    Regards,
    Sergio

  • Using Java to Retrieve Images from Oracle

    OracleResultSet.getCustomDatum method is deprecated. I was using this method to retrieve an ORDImage from an Oracle 9i database. What are developers using instead of getCustomDatum to retrieve images from the database. Thanks for all help in this matter.

    Hi use getBinaryStream(java.lang.String) or getBinaryStream(int) of java.sql.ResultSet for retrieving images from database
    Hope it will be useful
    regards
    chandru

  • How to store and retrieve images from database...

    Hi All
    Anubody tell me plz how to store images in database using jsp.
    and how to retrieve tme.
    Plz reply...
    Anurag

    Exactly
    try the links below may be those might help u in store and retrieval any kind of file.
    http://www.mysqltalk.org/insert-blob-example-vt112861.html
    https://java.sun.com/j2se/1.5.0/docs/guide/jdbc/blob.html
    http://javaalmanac.com/egs/java.sql/GetBlob.html
    http://publib.boulder.ibm.com/infocenter/idshelp/v10/index.jsp?topic=/com.ibm.jdbc.doc/jdbc142.htm
    and a dearly advice friend please query google b4 you post any query out here.

  • Always Access Denied when choosing Automatically Enrol and Retrieve Certificates from MMC

    I am using 2008 R2 Certificate Services to issue certs across multiple forests (although don't let that muddy the waters).
    I have a need to issue certificates for use with s/ldap, so I have duplicated the Kerberos cert and removed all Intended Purposes other than Server Authentication and configured appropriate security to allow Domain Controllers/Domain Admins to enrol. 
    The certificate also requires CA Manager Approval.
    Everything looks good - I am able to enrol for the cert via the MMC, the request goes into pending, and I am then able to issue the cert.  However, when I go back into the MMC on the Server that requested the cert and choose All Tasks | Automatically
    Enrol and Retrieve Certificates, I choose the pending cert and then get Access Denied.
    On the issuing Server, I get an Event 21 in the App Log:
    Active Directory Certificate Services could not process request 8466 due to an error: Access is denied. 0x80070005 (WIN32: 5).  The request was for CN=server.domain.com.
    On the Server that requested the cert, I get an Event 9:
    Certificate enrollment for Local system was denied by servername\Issuing CA when retrieving the pending request for a SecureLDAPCertificate certificate with request ID 8466.
    The strange thing is, if I follow this procedure but using the certsrv website, it works fine and I can install the certificate.
    What am I missing?  Or is this one of those random quirks of AD CS?
    Any help is appreciated.

    Hi,
    Thanks for posting in Microsoft TechNet forums.
    According to the error messages you provided, this can be a permission issue.
    The method of Autoenrollment for a certificate depends on an Active Directory. Considering using Certsrv website was successful, the problem can be that the requester does not have enough permission to access the certificate template in Active Directory
    To autoenroll a certificate template, a user or computer must belong to a security group that is assigned the read,enroll,and autoenroll permissions.
    Only groups that are assigned these permissions are enabled for autoenrollment.
    Could you please answer the following questions for us so that we can troubleshoot the issue more effectively?
    Are the issuing CA server and the requesting CA in the same forest/domain?
    regards
    Ted

  • Help with writing and retrieving data from a table field with type "LCHR"

    Hi Experts,
    I need help with writing and reading data from a database table field which has a type of "LCHR". I have given an example of the original code but don't know what to change it to in order to fix it and still read in the original data that's stored in the LCHR field.
    Basically we have two Function modules, one that saves list data to a database table and one that reads in this data. Both Function modules have an identicle table which has an array of fields from type INT4, CHAR, and type P. The INT4 field is the first one.
    Incidentally this worked in the 4.7 non-unicode system but is now dumping in the new ECC6 Unicode system.
    Thanks in advance,
    C
    SAVING THE LIST DATA TO DB
    DATA: L_WA(800).
    LOOP AT T_TAB into L_WA.
    ZDBTAB-DATALEN = STRLEN( L_WA ).
    MOVE: L_WA to ZDBTAB-RAWDATA.
    ZDBTAB-LINENUM = SY-TABIX.
    INSERT ZDBTAB.
    READING THE DATA FROM DB
    DATA: BEGIN OF T_DATA,
                 SEQNR type ZDBTAB-LINENUM,
                 DATA type ZDBTAB-RAWDATA,
               END OF T_TAB.
    Select the data.
    SELECT linenum rawdata from ZDBTAB into table T_DATA
         WHERE repid = w_repname
         AND rundate = w_rundate
         ORDER BY linenum.
    Populate calling Internal Table.
    LOOP AT T-DATA.
    APPEND T_DATA to T_TAB.
    ENDLOOP.

    Hi Anuj,
    The unicode flag is active.
    When I run our report and then to try and save the list data a dump is happening at the following point
    LOOP AT T_TAB into L_WA.
    As I say, T_TAB consists of different fields and field types whereas L_WA is CHAR 800. The dump mentions UC_OBJECTS_NOT_CONVERTIBLE
    When I try to load a saved list the dump is happening at the following point
    APPEND T_DATA-RAWDATA to T_TAB.
    T_DATA-RAWDATA is type LCHR and T_TAB consists of different fields and field types.
    In both examples the dumps mention UC_OBJECTS_NOT_CONVERTIBLE
    Regards
    C

  • Inserting and retrieving data from a al32UTF8 database USING SQL Developer

    hi guys,
    Before i post my questions , i think its better for me to provide you guys with my understandings first so that it easier to understand where/if i have gone wrong..
    I am using Window XP and Oracle 10g
    Non-unicode client - a client program that need to use the OS code page for mapping of the retrieved unicode data from the database as well as the support of displaying/inserting the characters from that code page to the database.
    E.G sqlplusw.exe
    Therefore, when using a non-unicode client
    1) we have to set the OS code page (Control panel - regional and language setting - advance - language for non unicode program ) to the code page that contain the characters we are going to display/insert.
    2) we will also have to set the NLS_LANG characterset to the character set of the code page we are going to insert so that when we do a insert (for e.g in thai ) , oracle will know, and auto conversion to UNICODE can take place. This is also true when we retrieve unicode data from the database so that conversion to the correct character set can take place.
    INSERTING
    THAI ---> conversion ----> UNICODE
    RETRIEVING
    THAI <---- conversion <---- UNICODE
    I hope my basic understanding is correct up till this point.
    Unicode client - a client program that supports the displaying/inserting of unicode characters without the need of setting the OS code page (Control panel - regional and language setting - advance - language for non unicode program )
    E.G isqlplus http or SQL developer
    However,
    1) There is still a need to set the NLS_LANG so that correct conversion can take place between the client and the database.
    For e.g, when retrieving if we set the NLS_LANG character set to ZHS16GBK (chinese) and the data store in unicode in database is E.G (THAI) , then the conversion would be wrong .
    Since it is a unicode supported client, then the NLS_LANG character set should be set to UNICODE as well.
    Here come my questions
    *Important - please help if you are busy and have no other time to answer the rest of the questions
    *Q1) If i were to use a unicode client, what should i set my NLS_LANG character set to ?
    AMERICAN_AMERICA.UTF8 ?
    *Q2) Where do i set the NLS_LANG character set information in SQL Developer, i know there is a metalink for setting NLS_LANG using isqlplus but i cant seems to google any result for SQL developer.
    Q3) Is my basic understanding right until this point ? If not, please explain in a more generalised term as i am really not familiar with character sets, code page, unicode , glyphs and fonts..
    Q4) If a unicode client does not need to refer to the OS code page (set in regional and language) , is there a UNICODE code page for the client to refer to , or is there any Window API available ?
    Q5)
    There is still a need to set the NLS_LANG so that correct conversion can take place between the client and the >>database.
    For e.g, when retrieving if we set the NLS_LANG character set to ZHS16GBK (chinese) and the data store in >>unicode in database is E.G (THAI) , then the conversion would be wrong .am i right on this point for UNICODE supported client ?
    Thanks for spending time to read my questions and i hope to hear advices from you guys soon.
    Million thanks again for sharing.
    Best Regards,
    Noob but willing to learn

    The requirement to always set NLS_LANG is not true for JDBC, which ignores NLS_LANG altogether. Java programs fetch text data into String variables, which use Unicode UTF-16 by design. JDBC sets character set conversion so that data is converted between UTF-16 and the database or national character set.
    The requirement to set NLS_LANG is not generally true for OCI, either. The first call in an OCI problem can be OCIEnvNlsCreate(). This call has two parameters that allow the caller to define the character set to use for VARCHAR2/CHAR/LONG/CLOB/statement text and the character set to use for NVARCHAR2/NCHAR/NCLOB. Only if these character sets are specified as 0, NLS_LANG character set is used. Also, OCI programs can specify different character sets for each bind or define variable (i.e. input/output buffer). Note: OCI programs always use NLS_LANG to initialize the language and territory settings for the client program and the database session. Only the character set can be specified is OCIEnvNlsCreate().
    OCIEnvNlsCreate() can specify the client character set as UTF-16 (in platform endianess). This is not possible with NLS_LANG.
    Various interfaces building on OCI, such as Oracle ODBC and ODP .NET, explicitly initialize OCI with Unicode character set, and thus ignore the NLS_LANG character set as well.
    Thnx,
    Sergiusz

Maybe you are looking for

  • How to create a link to download a .psd or .eps file

    I'm attempting to create a link to a .psd file for a user to download. Whenever I link to the .psd file, Dreamweaver wants to convert it to a JPEG. Is there a way to link to a .psd file to have the user download that file? I'm trying to have files th

  • EM can connect to DB to export.

    I am new to Oracle, so. I first can connect to the DB in stand alone mode, no prolem. Then through the OEM I log in ok but when I go to access the DB it asks for the user name and password, I use the sameones as in stand along but get ORA-01031 - ins

  • Kinda OT --- but couldn't figure out where else to post

    This is the situation --- I use Pro Tools 7 M Powered. I initally installed it on my Mini and when I upgraded to my iMac, I upgraded to the Intel version of PT 7.1. In order to use PT M Powered you have to "unlock" it using the license which is store

  • How can I delete catalog entries from PSE 8 Organizer when it's photo does not appear in the brower?

    I imported a group of files into Folder A, and Organizer correctly gave me the "new files in watched folders" pop-up and imported them.  Then I used Windows to copy these files into Folder B, also a watched folder.  Again, Organizer correctly gave me

  • Unable to completely watch anything on Apple TV, it just keeps hanging up

    I am having problems watching anything via apple tv - if I download a movie from itunes it plays for 5 mins, sometimes less then it seems to stall and looks as if it is loading but doesnt restart, then it switches back to the main menu, sometimes its