Importing data from ms access to db2 through java code

hi there,
i want to develop a code in which i can set ODBC settings because i dont want user to manually set these settings using administration tools in control panel.....is there any way of doing this.?
but my main problem is , importing database from .mdb file to db2 using java code only.....
thanks in advance

one point i want to mention here...there is perhaps a 'cursor problem' ( or not a problem at all )...see the following code...
1. while (res.next()) {
2. System.out.println("-> " + res.getString(2));
3. jTextArea1.append("-> " + res.getString(2) + "\n");
4. }
You have a repetition problem.
Cursors are like iterators: you can't reuse them. Once you iterate through them you have to reinitialize them. Some JDBC implementations are picky about the order in which you access variables. This one appears to not allow you to access them twice.
The question is: why do you bother to get this value twice? Just do it once, like this:
while (res.next())
   String str = res.getString(2);
   System.out.println("-> " + str);
    jTextArea1.append("-> " + str + "\n");
}Another question worth asking: Why is UI code mingled in with database code? Poor layering. I hate seeing Swing and JDBC mixed together like this.
%

Similar Messages

  • Trying to Import data from Microsoft Access in POWERPIVOT

    Hello,
    I am trying to import data from Microsoft Access into Powerpivot. In my Access database I have several query's.
    When I go to the Table Import Wizard in powerpivot, I only see one source table. Why can't I see the other query's?
    Thanks in advance for your help.
    Soraya

    Hello Soraya,
    Which Version of MS Excel / Power Pivot are you using? Do you try to Import from a MDB or from the new Format ACCDB? Are these common queries in MS Access or pass-through queries?
    In common it should work, if I Import from a MDB I can see & select both, tables & views (queries):
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • Importing data from MS-Access into Oracle 9i

    I want to import data from access into oracle 9i. I already contain the same data in Oracle but these Access files contain updates and additional data to the existing data . So i need help to import in such a way that origional data remain same just addional data and updates come from MS-Access.

    Hi,
    You can achieve this by using the SQL Loader, which will help you out to load the data.
    For further reference check the below link
    http://lbd.epfl.ch/f/teaching/courses/oracle8i/server.815/a67792/ch05.htm#1261
    As you said that you have existing data in the table and you have Update's too. you have the Options like
    APPEND which you will useful to add the new records.
    - Pavan Kumar N

  • How to import data from MS Access before distribution of a form

    I have created a form with Acrobat Pro 9. On the other hand, I have a MS Access database with a lot of information.
    I would love to import the data from this database to my form, BEFORE distributing the form the the respondents (they only need to check whether the information we already obtained was correct, so that's why the form needs to contain the already obtained information).
    Can anyone help me with this task?

    Dear Morgan,
    Thanks for your reply.
    The data in sql server 2000 which has data in Arabic_CI_AS character set is moved to Oracle 10.2.0.3 database with characterset AL32UTF8. The table data is moved to oracle using the dataloader 3.6 standard edition licensed version.
    We cannot change the character set of Sql Server 2000. We have tried changing the data/characterset in Oracle to set the NLS_LANG at OS level to UTF_8 and tried the whole cycle of customer import, but still the customer name is displayed as square box at application level.
    How do I post this thread to Globalization Forum? Do I have to create new thread for this again?
    (Note: I am new to these OTN Forums).
    Thanks,
    Shanil

  • Import data from MS ACCESS in background mode

    Hello experts,
    i am facing the following problem. I´ve got to import a MS ACCESS database in background mode via job.
    I got a solution which works in dialoge:
    create object conn 'ADODB.Connection'.
    create object rsdb 'ADODB.Recordset'.
    concatenate 'Provider=Microsoft.Jet.OLEDB.4.0;'
    'Data Source=C:UserspfahlbeDesktopaccess.mdb'
    into sql.
    call method of conn 'Open'
      exporting
      #1 = sql.
    Any idea how it can be handled in background?

    The system does not have permission to the useru2019s desktop C:\Users\pfahlbe\Desktop\access.mdb when running in the background. 
    Recommend moving your MSAccess db to a network location where the system has full-time read-permission, and adjusting your sql accordingly.
    Regards,
    zKen

  • Importing Data from MS Access into SQL Serevr 2005 via Linked Server: User-Dependent failure

    I am operating an Express version of SQL Server 2005 on a Windows XP machine.
    I have successfully setup a linked server to a remote Access (.mdb) database. With my user account (Windows authentication) I can retrieve and store data without any problem.
    I have another user (apparently with same settings as my own account) that is always failing to get the data.
    The Error message he gets is:
    OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "TSU_Tmp" returned message "The Microsoft Jet database engine cannot open the file '\\DSITSO-NT0001\Exchange\Database5.mdb'.  It is already opened exclusively by another
    user, or you need permission to view its data.".
    Msg 7303, Level 16, State 1, Line 1
    Cannot initialize the data source object of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "TSU_Tmp".
    Here below the code used to set up the linked server (coming from the Code Snippets of SQL Server 2005).
    EXEC sp_addlinkedserver
    @server = N'TSU_Tmp',
    @provider = N'Microsoft.Jet.OLEDB.4.0',
    @srvproduct = N'OLE DB Provider for Jet',
    @datasrc = N'\\DSITSO-NT0001\Exchange\Database5.mdb'
    EXEC sp_addlinkedsrvlogin
    @rmtsrvname = N'TSU_Tmp',
    @useself = N'TRUE',
    @locallogin = NULL,
    @rmtuser = N'Admin',
    @rmtpassword = NULL
    We both run the script, actually is a Stored Procedure, (see code below) on the same XP machine where SQL Server is running.
    EXEC('INSERT INTO tblFcst
    (StartBUCode, StartBUType, StartBUSeq, StartTrz, StartCty,
    EndBUCode, EndBUType, EndBUSeq, EndTrz, EndCty,
    FcstCreationPeriod, FcstValidForPeriod, Fcst, FcstExternalReference,
    IsProcessed, IsSolved)
    SELECT TSU.BUCodeSend, TSU.BUTypeSend, TSU.BuaNoSend, Null AS StartTrz, Null AS StartCty,
    TSU.BUCodeRcv, TSU.BUTypeRcv, TSU.BuaNoRcv, Null AS EndTrz, Null AS EndCty,
    TSU.[Current week], TSU.[Forecast for week], TSU.[Volume trp m3], TSU.[TSU_ID (Don''t touch me)],
    0 AS IsProcessed, 0 AS IsSolved
    FROM TSU_Tmp...tbl_TSU_trpm3 AS TSU;')
    PS: it is run using an 'EXEC(String)' format as at compile time of Store Procedure the Linked Server is not existing and otherwise compile would fail.
    We tried it with different files, in different locations. It always wors for me, never for him...
    The files were not used by anyone else. The folder(s) where they were stored are open to "Everyone".
    So I concluded it should be something linked to the User... :) But I really do not know what, as said apparently we have exactely the same setup in our Login profiles.
    Any idea or suggestion is welcome.
    Thanks
    Luca

    Hi Luca Lentati,
    According to your description and T-SQL statement, we need to verify if the download and install the Microsoft.Jet.OleDB.4.0 as a provider.
     If the 64bit SQL Server is running on the server,  The error, the Microsoft.Jet.OleDB.4.0 is not support, I reommend you download and install the Microsoft.ACE.OLEDB.12.0 as a provider.
    The error 7303 message indicates that the linked server does not have correct login mapping. You can execute the sp_helplinkedsrvlogin stored procedure to set the login information correctly. Also, verify that you have specified the correct parameters
    for the linked server configuration.
    In addition, if the issue still exists, I recommend you copy the access file to local Server, and create linked server between them , check if it can run well. If yes, it means that
     the account which SQL server uses to run the service does not have read/write access to that file share.
    There is an article about configuring a Linked Microsoft Access Server on SQL 2005 Server , you can review the following article.
    http://www.aspfree.com/c/a/Microsoft-Access/Configuring-a-Linked-Microsoft-Access-Server-on-SQL-2005-Server/
    Regards,
    Sofiya Li
    Sofiya Li
    TechNet Community Support

  • I want to import data from access database to editable Adobe X form - java? txt? fdf? :-(

    I've been trying to work out how to fill text fields with imported data from an access 2010 database.
    So far I've managed to paste all the data in a large text field on a blank page at the end of the document, but nope, that's not it.
    If anyone has the answer....... please I would really like to know
    Cheers
    Kim

    Acrobat used to have its own database connector on Windows (ADBC) but it was removed in version X. You have two options to connect to a live database that publishes itself through the Windows ODBC system:
    Create the form using LiveCycle Designer (shipped with Acrobat X Pro, but now a separate product). XFA forms created this way have inbuilt database connection features and will work in Adobe Reader too.
    Use the SOAP object in Acrobat JavaScript - but this will not work in Adobe Reader unless you apply permissions using LiveCycle Reader Extensions Server.

  • Import data from excel

    Hi, I am using Jdeveloper 11g 11.1.1.5.0 and I want to import data from excel in my table through the jsf page and commit it to database. How can I implement it. Its urgent please help me!!!!!!!!!!!!!!!!!!!!!

    Unless you are importing Excel data to save a dying patient in the operating theatre, it's not, by definition, urgent!!!!!!!!!!!!!!!!!!!!!! (and I must be right, because I used 22 exclamation points, where you only used 21).
    Have you looked at ADF Desktop Integration to see if that would work for you? If not, you could:
    1). Use an af:inputFile to upload the Excel file
    2). Using something like Apache POI to read the file
    3). Create rows, set the attributes, insert them, and commit them (if you're using ADF BC, you'd use a View Object to do this)
    John

  • Import data from csv to SQL database

    How to  Import data from csv to SQL database through BLS-xMII?

    Hi,
    if you using Oracle, you may also use the bulk insert with MII. You can use the String List to XML parser to convert your CSV to XML, and then use a query that calls a stored procedure which does the bulk insert.
    Also have a look at thread [read XML file into stored procedure|http://forums.sdn.sap.com/click.jspa?searchID=63850236&messageID=7455643].
    Michael

  • Want to access RESTful Services through Java Program

    We are trying to access RESTful Services exposed by Oracle database cloud through our Java code, with authentication enabled for a particular user.
    Till now, we have completed below steps:
    1) We have a working account with Oracle database cloud (Username – xxx.xxx)
    2) We log in using the credentials for above account, and navigate to Oracle Apex ? SQL Workshop ? RESTful Services
    3) We create a new “RESTful Service Module” by filling out the details as below:
         Name:                                  SampleTest 
         URI Prefix:                            test
         URI Template:                       /getallemp
         Pagination Size:                    25 (kept to default)
         Required Privilege:                 TestGroupPrivilege
         Resource Handler Details:
                    Method:              GET
                    Source Type:      Query
                    Format:               JSON
                    Source:               select * from emp
    After creating the above module and testing it, it works fine and the data is retrieved in JSON successfully.
    The resulting URL for above RESTful Service Module is: https://<HOST_URL>/apex/test/getallemp
    Note that “TestGroupPrivilege” is a privilege assigned to the user group “RESTful Services” and the user “xxx.xxx” is a member of “RESTful Services” user group.
    4) We are unable to call the RESTful services from Java program. We are passing username and password in request header as basic authentication. But, we are getting: Error 500--Internal Server Error
    5) If we change the “Required Privilege” to default i.e. no privileges present on the module, we can get the response through Java code and everything works perfectly fine.
    Please suggest us in: How to access RESTful Services through Java code by passing user credentials in HTTP header for authentication. Also let us know if we have to do any settings through Apex, in case we are missing any.
    Message was edited by: NeerajGirolkar
    - When we are logging in to Oracle cloud on browser and execute the Oracle cloud RESTful service in another tab of same browser, we are able to get the result. But when executed the same RESTful service from a different browser or java program we get internal server error.
    - After investigation, we found that when user logs in to oracle database cloud, a cookie is set in browser with name s “OAMAuthnCookie_cstest-domo.db.us1.oraclecloudapps.com:443” and value as some random token. This cookie is passed in the subsequent requests to the RESTful Service calls when using same browser and as a result, we are able to get the results
    - In the Java program, we copied the same cookie with random token in the HTTP Request header and we got the proper response from REST APIs.
    - It seems that this cookie is created by an Oracle Middleware tool/server called as OAM – Oracle Accounts Manager, which sends the authentication token after successful authentication and creates the cookie.
    - We found that the cookie that OAM creates on authentication is exactly in the same format i.e. ‘OAMAuthnCookie_cstest-domo.db.us1.oraclecloudapps.com:443’. So, we are guessing that Oracle cloud uses OAM for authentication. Please refer to following link for same : http://docs.oracle.com/cd/E14571_01/doc.1111/e15478/sso.htm
    Can anyone please suggest:
    1.     How to provide authentication to Oracle Cloud REST APIs from java program?
    2.     How to pass the username and password in Java code to OAM (or how to communicate with OAM using Java) so that we can receive the unique token from OAM. We can use the token in the further requests? 3.     Also in Oracle cloud white papers , it is mentioned that they support OAuth2.0. But we didn’t find any URLs for same. Can anyone please confirm?
    Thanks
    ~ Neeraj Girolkar

    Hi Nilesh,
    We tried to connect to Oracle Cloud Database using the way you suggested above, but unfortunately it is not working as well.
    Can you let us know the authentication process with Oracle Cloud Database? We found in documentation that it uses OAM (Oracle Access Manager) for authentication. Can you tell us a bit about that? That will be extremely helpful.
    Thanks,
    - Neeraj

  • Importing/Exporting data from Microsoft Access

    Hello to everybody!
    I have to create a management software (client-server).
    CLIENT SIDE: ClientS insert data into forms and these data are stored into a database Access (client database). Every month clients send to the server some of the data stored (data of the month!).
    SERVER SIDE: "Server man" receive from clients those data by email end need to store them into the main server database.
    Note: Data to be send have not a big dimension and, naturally, clients and server databases are identical (same structure)!
    My questions are:
    1) What is the best way to export data from database access to a file? (I imagine I need to use .XML file). Do I need to use particular package or software??
    2) What is the best way to import data from a file (maybe .XML) into a database access (of server)?? Do I need to use particular package or software??
    This is my first software of this kind.
    Please HELP ME!
    Thanks in advance, Liuk.

    1) What is the best way to export data from database
    access to a file?That depends on many things.
    (I imagine I need to use .XML
    file). NO! That's not what XML is for
    Do I need to use particular package or
    software??Again, that depends on a lot of things.
    2) What is the best way to import data from a file
    (maybe .XML) into a database access (of server)?? Do
    I need to use particular package or software??Look at Java IO packages for reading data from files. Then look at JDBC for writing data to databases. Avoid XML, you don't need it.

  • Importing Data from Access

    I have a table in an Access 2002 database, which has about 60000 records, and I'm trying to send that data into an Oracle 8.1.7 database. I have created a link to my Oracle table in Access and wrote an insert statement to insert the data from the Access table into the table in Oracle.
    When the query finishes executing, I get a Microsoft Access pop-up display that says 'Overflow'. It doesn't say anything else but 'Overflow'. When I check my Oracle table, the data is not in there.
    What does the 'Overflow' message in Access mean and how do I fix it? I've imported the data from other tables in Access to Oracle with the same number of records, keys, constraints, etc. and those were successful.
    I don't know what the problem is or what Access means by 'Overflow'.
    Please help!!!!

    I've created a link to Oracle from Access this way.
    I would have guessed that a tool like DTS would have been better suited to this job.

  • Error in Importing Data from SAP BW ( XMLA )

    HI All,
    I am trying to import a physical schema from sap bw ( sap user has all grants ) through the XMLA access
    IN repository I see objects ( connection pool, hierarchies, dimensions, measures ) and in a while I get them to the presentation layer accessible for users.
    Though when I try to access data build the query I get the following error:
    OPR3ONWY:U9IM8TAC:DI2DL65P
    HY00 Code 10058 [NQODBC][SQL STATE HY0000][NQSError 10058] A general Error has occurred XMLA Error returned from the server.
    Can you please help me in understanding how to solve the problem?
    Thanks a lot.
    Best regards to everybody.
    Filippo

    mithuu wrote:
    HI Filippo,
    Sorry to reply to this post,
    Could u please tell me ...what shud be given in URL which is prompted when trying to Import data from SAP bw while creating a repository.
    I am a beginner and tried to seek help from the sap basis guys but of no help.
    Appreciate ur help,
    Many Thanks...Hi Mithu,
    Give the SAP Multi-Dimensional Database server URL and a username, password required to access it.
    If you do not know them, ask your TL/PM, if u do not have one ask the SAP Data warehouse DBA.......
    Venkat
    Edited by: OBIEE+ on Jan 27, 2009 2:21 AM

  • How to Get Current Date from MS Access in a Select Statement

    From a java method, I want to use JDBC to get the current date from MS Access. In Oracle I would do "select sysdate from dual", but I can't figure out how to do it in MS Access. Here are some of my attempts. I have a table in my Access db called PARM.
    //        String sql = "SELECT '0', NOW() FROM PARM";
    //rs.next() is false
    //        String sql = "SELECT NOW() AS CURR_DT FROM PARM";
    //rs.next() is false
    //        String sql = "SELECT DATE() AS CURR_DT FROM PARM";
    //rs.next() is false
    //        String sql = "SELECT NOW()"; 
    //StringIndexOutOfBoundsException: String index out of range: -1
    //        String sql = "select { fn now() } from parm";
            String sql = "SELECT Date()";
    //java.lang.StringIndexOutOfBoundsException: String index out of range: -1
            ResultSet rs = stmt.executeQuery(sql);
            if (rs.next()) {
                return rs.getString(1);
            } else {
                   return null;
              }

    Why are you getting it as a String? You should be getting it as a timestamp.
    Although getString works for me too. There is something else wrong that you haven't shown.
    Here is some shoddy, but simple, test code that demonstrates it working.
    import java.sql.*;
    public class Test{
      public static void main(String args[])throws Exception{
        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        Connection c = DriverManager.getConnection("jdbc:odbc:stats");
        Statement s = c.createStatement();
        ResultSet rs = s.executeQuery("SELECT NOW()");
        while(rs.next()){
          System.out.println(rs.getTimestamp(1));     
        rs.close();
        s.close();
        c.close();
    }

  • How to import data from a text file into a table

    Hello,
    I need help with importing data from a .csv file with comma delimiter into a table.
    I've been struggling to figure out how to use the "Import from Files" wizard in Oracle 10g web-base Enterprise Manager.
    I have not been able to find a simple instruction on how to use the Wizard.
    I have looked at the Oracle Database Utilities - Overview of Oracle Data Pump and the Help on the "Import: Files" page.
    Neither one gave me enough instruction to be able to do the import successfully.
    Using the "Import from file" wizard, I created a Directory Object using the Create Directory Object button. I Copied the file from which i needed to import the data into the Operating System Directory i had defined in the Create Directory Object page. I chose "Entire files" for the Import type.
    Step 1 of 4 is the "Import:Re-Mapping" page, I have no idea what i need to do on this page. All i know i am not tying to import data that was in one schema into a different schema and I am not importing data that was in one tablespace into a different tablespace and i am not R-Mapping datafiles either. I am importing data from a csv file.
    For step 2 of 4, "Import:Options" page, I selected the same directory object i had created.
    For step 3 of 4, I entered a job name and a description and selected Start Immediately option.
    What i noticed going through the wizard, the wizard never asked into which table do i want to import the data.
    I submitted the job and I got ORA-31619 invalid dump file error.
    I was sure that the wizard was going to fail when it never asked me into which table do i want to import the data.
    I tried to use the "imp" utility in command-line window.
    After I entered (imp), i was prompted for the username and the password and then the buffer size as soon as i entered the min buffer size I got the following error and the import was terminated:
    C:\>imp
    Import: Release 10.1.0.2.0 - Production on Fri Jul 9 12:56:11 2004
    Copyright (c) 1982, 2004, Oracle. All rights reserved.
    Username: user1
    Password:
    Connected to: Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Produc
    tion
    With the Partitioning, OLAP and Data Mining options
    Import file: EXPDAT.DMP > c:\securParms\securParms.csv
    Enter insert buffer size (minimum is 8192) 30720> 8192
    IMP-00037: Character set marker unknown
    IMP-00000: Import terminated unsuccessfully
    Please show me the easiest way to import a text file into a table. How complex could it be to do a simple import into a table using a text file?
    We are testing our application against both an Oracle database and a MSSQLServer 2000 database.
    I was able to import the data into a table in MSSQLServer database and I can say that anybody with no experience could easily do an export/import in MSSQLServer 2000.
    I appreciate if someone could show me how to the import from a file into a table!
    Thanks,
    Mitra

    >
    I can say that anybody with
    no experience could easily do an export/import in
    MSSQLServer 2000.
    Anybody with no experience should not mess up my Oracle Databases !

Maybe you are looking for

  • EA4500 – Smart Wi-Fi interface and Windows Network Map issues

    I purchased this Router about 2 weeks ago as a phased upgrade of our Home Network, primarily to enhance media streaming. It has the latest firmware preinstalled from the factory. Prior to the purchase and installation of the EA4500 Router I replaced

  • Daisy-chaining Thunderbolt and Mini DisplayPort

    I have a 13-inch MacBook Pro (Early 2011), i7. In the future, would it be possible to daisy-chain a Thunderbolt-compatible product like the Echo Express (http://bit.ly/pTlDFr) with a monitor that only has DisplayPort, HDMI, and DVI (http://amzn.to/no

  • ASA CX - allows traffic through but web page cannot be loaded

    Hello there, I am having this strange issue with the HTTP traffic passing through the firewall. There is no any policies configured on the CX module for web or application filtering however when I reload the CX module or simply put in in "monitor-onl

  • CREATIVE ZEN, HOW TO CHARGE THE BATTERY.

    <DIV align=center>Hello, Just got a Zen Micro and just installed it and all that and then when i was messing about with it the battery went so when i went to charge it i plugged the USB in the back of my computer and plugged it into my Zen, It did wo

  • [SOLVED] rsnapshot never finishes a backup (PEBCAK)

    I've set up rsnapshot and configured everything, but for whatever reason it either won't make files, or it stops making them about a minute after starting. I have a separate hard drive which I set to mount and unmount just before and just after takin