Excel - ODBC-JDBC - Sybase

Hi All,
I have a problem with the data converison.
The problem is that my excel file has 6 columns. All of them are general but 2 of them have years and amounts in them but they are still supposed to be GENERAL TYPE. Now for some reason my JBCD result inteprets them as numeric fields and I want them as alphanumeric fields like all the other fields. What could I do?
Now does the problem lie in the excel file or with the jdbc driver?
Any help would be appreciated greatly!! :)
Thanks,
Rob

but the problem is that i use resultset.getString("year") so it should take year as a string already but if i put in 19%94 for the year in the excel file.. it gives me a string with NULL in java which it shouldn't

Similar Messages

  • Regarding ODBC/JDBC driver

    Hi
    To connect SAP BO Tools with HANA, document says ODBC/JDBC thru SQL is required.
    What does it mean.. Does connectivity need both or we can use any one of them?
    Anybody know when to use which one?.
    To my understanding, i feel either one of them can be used...but when it has to be used?
    No document explains on this.. pls share if any document.
    Regards
    Magalingam

    Hi,
    To Connect BO Tools to HANA,using jdbc driver is recommended.ODBC will be used by the Tools like Analysis for Office and Excel in somecases(through MS SQL Query option).
    You can create a relational connection using the jdbc driver in IDT and can publish to BOE CMC which can be used for the creation of Universe so that BO Tools like Dashboard,Crystal Reports,WebI and Explorer can consume HANA data through this JDBC Connection.
    Hope this helps you.
    Rgds,
    Murali

  • TP4: can not run application with ODBC-JDBC bridge

    Hi,
    I tried to connect to a oracle 10gR1 Database via ODBC-JDBC bridge.
    Test connection in dialog "Edit Database Connection" is sucessfull.
    When trying to run the application following error occures:
    ===========================================
    08/05/09 11:48:57 SCHWERWIEGEND: AbstractInfo.getAnnotation oracle.webservices.annotations.async.AsyncWebService cannot be found in the given classpath.
    08/05/09 11:48:57 SCHWERWIEGEND: AbstractInfo.getAnnotation oracle.webservices.annotations.async.AsyncWebService cannot be found in the given classpath.
    09.05.2008 11:48:58 oracle.j2ee.util.AnnotatedLogger logWithThrowable
    SCHWERWIEGEND: J2EE JCA-07001
    oracle.oc4j.sql.DataSourceException: Unable to create: sun.jdbc.odbc.JdbcOdbcDriver
         at oracle.oc4j.sql.config.DataSourceConfigUtils.createDataSource(DataSourceConfigUtils.java:403)
         at oracle.oc4j.sql.DataSourceUtils.createDataSource(DataSourceUtils.java:288)
         at com.evermind.server.DataSources.createNativeDataSource(DataSources.java:153)
         at com.evermind.server.DataSources.initDataSources(DataSources.java:1117)
         at com.evermind.server.ApplicationStateRunning.initDataSourceConnector(ApplicationStateRunning.java:1782)
         at com.evermind.server.ApplicationStateRunning.initConnector(ApplicationStateRunning.java:1436)
         at com.evermind.server.ApplicationStateRunning.initConnectors(ApplicationStateRunning.java:422)
         at com.evermind.server.ApplicationStateRunning.initializeApplication(ApplicationStateRunning.java:247)
         at com.evermind.server.Application.setConfig(Application.java:538)
         at com.evermind.server.Application.setConfig(Application.java:433)
         at com.evermind.server.ApplicationServer.addApplication(ApplicationServer.java:2125)
         at com.evermind.server.ApplicationServer.initializeDeployedApplications(ApplicationServer.java:1865)
         at com.evermind.server.ApplicationServer.setConfig(ApplicationServer.java:1235)
         at oracle.oc4j.server.ServerFactory$Worker.start(ApplicationServerFactory.java:249)
         at oracle.oc4j.server.ServerFactory$Worker.run(ApplicationServerFactory.java:259)
         at java.lang.Thread.run(Thread.java:595)
    Caused by: java.lang.ClassCastException: sun.jdbc.odbc.JdbcOdbcDriver
         at oracle.oc4j.sql.config.DataSourceConfigUtils.createDataSource(DataSourceConfigUtils.java:401)
         ... 15 more
    08/05/09 11:48:58 WARNUNG: Application.setConfig Application: current-workspace-app is in failed state as initialization failed.
    java.lang.InstantiationException: oracle.oc4j.sql.DataSourceException: Unable to create: sun.jdbc.odbc.JdbcOdbcDriver
         at com.evermind.server.ApplicationStateRunning.initConnector(ApplicationStateRunning.java:1465)
         at com.evermind.server.ApplicationStateRunning.initConnectors(ApplicationStateRunning.java:422)
         at com.evermind.server.ApplicationStateRunning.initializeApplication(ApplicationStateRunning.java:247)
         at com.evermind.server.Application.setConfig(Application.java:538)
         at com.evermind.server.Application.setConfig(Application.java:433)
         at com.evermind.server.ApplicationServer.addApplication(ApplicationServer.java:2125)
         at com.evermind.server.ApplicationServer.initializeDeployedApplications(ApplicationServer.java:1865)
         at com.evermind.server.ApplicationServer.setConfig(ApplicationServer.java:1235)
         at oracle.oc4j.server.ServerFactory$Worker.start(ApplicationServerFactory.java:249)
         at oracle.oc4j.server.ServerFactory$Worker.run(ApplicationServerFactory.java:259)
         at java.lang.Thread.run(Thread.java:595)
    Caused by: oracle.oc4j.sql.DataSourceException: Unable to create: sun.jdbc.odbc.JdbcOdbcDriver
         at oracle.oc4j.sql.config.DataSourceConfigUtils.createDataSource(DataSourceConfigUtils.java:403)
         at oracle.oc4j.sql.DataSourceUtils.createDataSource(DataSourceUtils.java:288)
         at com.evermind.server.DataSources.createNativeDataSource(DataSources.java:153)
         at com.evermind.server.DataSources.initDataSources(DataSources.java:1117)
         at com.evermind.server.ApplicationStateRunning.initDataSourceConnector(ApplicationStateRunning.java:1782)
         at com.evermind.server.ApplicationStateRunning.initConnector(ApplicationStateRunning.java:1436)
         ... 10 more
    Caused by: java.lang.ClassCastException: sun.jdbc.odbc.JdbcOdbcDriver
         at oracle.oc4j.sql.config.DataSourceConfigUtils.createDataSource(DataSourceConfigUtils.java:401)
         ... 15 more
    09.05.2008 11:48:58 com.evermind.server.ServerMessages severe
    SCHWERWIEGEND: Exception beim Initialisieren der bereitgestellten Anwendung: current-workspace-app. Application: current-workspace-app is in failed state as initialization failed
    java.lang.InstantiationException: Application: current-workspace-app is in failed state as initialization failed
         at com.evermind.server.Application.setConfig(Application.java:636)
         at com.evermind.server.Application.setConfig(Application.java:433)
         at com.evermind.server.ApplicationServer.addApplication(ApplicationServer.java:2125)
         at com.evermind.server.ApplicationServer.initializeDeployedApplications(ApplicationServer.java:1865)
         at com.evermind.server.ApplicationServer.setConfig(ApplicationServer.java:1235)
         at oracle.oc4j.server.ServerFactory$Worker.start(ApplicationServerFactory.java:249)
         at oracle.oc4j.server.ServerFactory$Worker.run(ApplicationServerFactory.java:259)
         at java.lang.Thread.run(Thread.java:595)
    Caused by: java.lang.InstantiationException: oracle.oc4j.sql.DataSourceException: Unable to create: sun.jdbc.odbc.JdbcOdbcDriver
         at com.evermind.server.ApplicationStateRunning.initConnector(ApplicationStateRunning.java:1465)
         at com.evermind.server.ApplicationStateRunning.initConnectors(ApplicationStateRunning.java:422)
         at com.evermind.server.ApplicationStateRunning.initializeApplication(ApplicationStateRunning.java:247)
         at com.evermind.server.Application.setConfig(Application.java:538)
         ... 7 more
    Caused by: oracle.oc4j.sql.DataSourceException: Unable to create: sun.jdbc.odbc.JdbcOdbcDriver
         at oracle.oc4j.sql.config.DataSourceConfigUtils.createDataSource(DataSourceConfigUtils.java:403)
         at oracle.oc4j.sql.DataSourceUtils.createDataSource(DataSourceUtils.java:288)
         at com.evermind.server.DataSources.createNativeDataSource(DataSources.java:153)
         at com.evermind.server.DataSources.initDataSources(DataSources.java:1117)
         at com.evermind.server.ApplicationStateRunning.initDataSourceConnector(ApplicationStateRunning.java:1782)
         at com.evermind.server.ApplicationStateRunning.initConnector(ApplicationStateRunning.java:1436)
         ... 10 more
    Caused by: java.lang.ClassCastException: sun.jdbc.odbc.JdbcOdbcDriver
         at oracle.oc4j.sql.config.DataSourceConfigUtils.createDataSource(DataSourceConfigUtils.java:401)
         ... 15 more
    09.05.2008 11:48:58 oracle.j2ee.util.AnnotatedLogger logWithThrowable
    WARNUNG: J2EE JNDI-00002
    09.05.2008 11:48:58 oracle.j2ee.util.AnnotatedLogger log
    WARNUNG: Kein javax.jms.ConnectionFactory in null gefunden
    09.05.2008 11:49:01 com.evermind.server.http.HttpMessages internalErrorWhileTryingToInstantiate
    SCHWERWIEGEND: Interner Fehler ausgelöst beim Versuch, die Web-Anwendung zu instanziieren: GoodsReceipt-ViewController-webapp definiert in Website Default Web Site. Application: current-workspace-app does not exist. Error creating Web application: GoodsReceipt-ViewController-webapp
    Ready message received from Oc4jNotifier.
    Embedded OC4J Server startup time: 12375 ms.
    =========================================
    OC4J is up and running, but browser gives error message (404 Not found)
    With JDBC connection this application works fine.
    Here my jdev specific environment variables:
    SET JOH=c:\software\Oracle_JDEV11gP4
    SET JDEV_USER_DIR=c:\jdeveloper\home
    SET JAVA_HOME=c:\software\Oracle_JDEV11gP4\jdk\bin
    Can anybody help me?
    br
    Peter

    Peter --
    Can you please describe your use case? The JDBC-ODBC bridge driver is not all that reliable. Sun considers it "transitional" and it is not supported by them.
    http://java.sun.com/j2se/1.5.0/docs/guide/jdbc/bridge.html
    We still include the driver in JDev primarily to allow connections to MS datasources like Excel and Access that don't have free/open-source pure JDBC drivers. Why would you use the JDBC-ODBC bridge to connect to an Oracle database?
    -- Brian

  • Oracle Cloud connections by other databases via ODBC/JDBC/XML

    If we move to the Oracle Cloud, will these tables be available from other SQL clients via ODBC/JDBC/XML? It obviously works fine with an internally hosted Oracle solution, but I didn't know if moving the Oracle Cloud would remove these features. Thanks.

    You need a service to auto start/stop instances. Pls See
    Re: Oracle instance is going to idle when i restart/start the machineRgds,
    Ahmer

  • JDBC - Sybase Connectivity Issue

    I'm a Java beginner.When using the java JDBC i'm experiencing the following issues
    Connection string used - jdbc:sybase:Tds:<Serverip>:<ServerPort>
    Driver File - com.sybase.Jdbc2.Jdbc.SybDriver
    Initially when i tried using these values i'm able to establish the database connection.But recently i changed the machine name.I'm using the same machine for both Database and Java.After the machine name changes i'm getting the following error
    SQLException:Jz006:caught IOException:java.net.connect Exception.
    Please help me...

    Just rename back the host. Do it work?
    See [http://tmaj.pathology.jhmi.edu/doc/manual/FAQs.html#DATABASE_TROUBLESHOOTING]
    I found somewhere that
    Note: The following exception occurs when you click Test Connection to connect a Sybase data source from the administrative console.
    Test connection failed for data source isagent on server server1 at node
    svtaix24Node01 with the following exception: java.lang.Exception:
    java.sql.SQLException: JZ006: Caught IOException: java.net.ConnectException: A
    remote host refused an attempted connect operation.DSRA0010E: SQL State = JZ006,
    Error Code = 0
    This exception occurs when the Sybase data source port number is not matched to the port configured in Sybase server.
    The default port number is 5000.
    Check the port number of your Sybase server in the interfaces file under /<sybase install directory>.

  • Heterogeneous Services + Excel ODBC Driver ???...Urgent PLEASE...

    Hai all,
    I like to use HS+ excel Odbc driver to load data from excel file to owb. I do all the steps correctly. I created a mapping. While deploying the mapping I got the following error.
    "error occurred when looking up remote object <unspecified>.EmployeeRange@EXCEL_SID.US.ORACLE.COM@DEST_LOCATION_EXCEL_SOURCE_LOC
    ORA-00604: error occurred at recursive SQL level 1
    ORA-02019: connection description for remote database not found
    Could you please help me... its very urgent for my application....
    Thanks and regards
    Gowtham

    SUDHAKAR,
    If you use Oracle Generic Connectivity you can access any ODBC or OLE DB compliant data source including Excel. You will also have to have the ODBC or OLE DB driver on the Excel side. For further information, please take a look at:
    http://otn.oracle.com/products/gateways/content.html
    Regards:
    Igor

  • ODBC-JDBC Bridge

    Hello everybody,
    I am working on project to create an ODBC-JDBC Bridge which exposes a JNI layer between the ODBC and the JDBC calls.
    In short :
    Lets consider,
    Java already has a JDBC driver. X is a project manager who wants to use the functionality of this driver in C++. One option is to rewrite the entire driver in C++. X is now worried because he does not want to waste time and resource in doing this resource. In mean time Y gives a valid suggestion. He proposes to replicate the entire class structure of the JDBC driver. Effectively he would end up writing a wrapper class that exposes JNI methods to talk to the JDBC driver. So the classes he finally develops are just wrappers which send and get data to and from the driver.
    My Progress :
    Basically I tool following approach :
    1. I created a JNI wrapper class that would replicate all the Java classes embedded in the jar files.Please note here that the C++ code is just act as a wrapper.The Wrapper is only acting as an access point between the C++ and the JAVA code.
    2. Now how to use these wrapper to bridge ODBC - JDBC driver?
    Can anyone please give me right direction after step 1 (any type of valid suggestions are accepted .... documents,links,steps,flow etc....)?
    Thanks in Advance....

    Is this a real project? What are the actual requirements, since this seems a little backwards. What is the actual database that has a JDBC driver but no ODBC driver. Writing the driver in C or C++ is probably a better choice.
    Or is this an academic exercise?
    And yes, these questions are "valid suggestions", and even if they weren't you have no control over what responses you will get on this forum.

  • Easysoft odbc jdbc bridge

    I have written aprogram which reading data from Msaccess using easysoft odbc jdbc bridge . but got error in connectivity looks like something wrong in
    Class.forName ("jdbc.easysoft");
    pls help if anybody is using easysoft bridge
    thx

    LanceJ wrote:
    I'm facing a challenge providing ODBC for an in-memory Java application. There are commercial frameworks such as Simba and DataDirect but both involve extensive licensing and are too elaborate (given only read-only capability with basic single table querying required).
    As stated that is not possible.
    Read the following and then restate the question
    [http://forums.sun.com/thread.jspa?threadID=211735&start=2&forumID=48]
    Another option I'm investigating is to use an ODBC-JDBC bridge driver (such as provided by EasySoft) in combination with a bespoke JDBC connector. The question is, how complex is it to implement a SELECT-only JDBC driver to interface directly with a Java app? (And as extension, are there any libraries that can assisting in creating a JDBC driver?)That doesn't make sense.
    The bridge and any "ODBC" interface is going to interact with the ODBC shell and a ODBC driver (nothing to do with java.) You can't create a ODBC driver without creating a ODBC driver. Which would seem obvious.
    If you want to create a JDBC driver - which is not the same as an ODBC driver then you must implement the interfaces. Simple as that. That however requires that you must have some way to actually access the database.

  • SQL Server 2005 with an ODBC-JDBC Bridge

    Hello,
    I use an ODBC - JDBC Bridge (because when I use SQL Server 2005 Driver JDBC Version 1.1, the text connection failed). I don't know why I can't reverse my model.
    What happened?
    thanks
    Billie

    We have also a SQL server 2000 instance at the same server. Yesterday I have spoken with the sql server admin and he told me that he has disconnect the sql server 2000 databases whatever this means. :-D
    Now all works fine. Thank you for your help
    BTW I use the following connection string:
    jdbc:sqlserver://my_db_server;instanceName=my_instance_name;DatabaseName=my_db_name

  • How can Form6i connect to other DB connection like ODBC,JDBC

    Hi,
    Can anyone tell me that how can Form6i connect to other DB connection like ODBC,JDBC
    If anyone knows, please tell me immediately. I am in very urgently situation!!!
    So if anyone knows, Please! Please! tell me.
    Thanks in advance,
    Oil

    Hi,
    Ypu can connect using OCA (Open Cliente Adapter).

  • Help! Check data in MS Excel file(JDBC-ODBC)

    Hi guys,
    I wrote a program that can check data in MS Excel file.
    User can input a sentence like "1->2" ,"1->3" (one determine one), then the program can find the data which violate the integrity constrains(functional dependency).For example, if we have the functional dependency "TSeq_gi->TSeq_accver", the program looks for two or more tuples with the same "TSeq_gi" value but the different "TSeq_accver" value in Excel file. These tuples violate the integrity constraint. But now,I can't figure out how to modify this program to multiple determine one. (like 1 3->5 or 1 3 4 5->7) . 1 3 ->5 means: look for 1 and 3 have same value but 5 different. I get stuck. Can some experts help me?
    The code and Excel file are in below link. Download and play it! Thank you~~
    Karen.
    http://us.f1f.yahoofs.com/bc/665bbb4/bc/Java/code.zip?bf6cljAB_wgRYVQf
    PS: You need to set up JDBC ODBC driver in MS windows "Administrative Tools" first. Data Souce name is Test .
    Main logic class:
    class MyActionListener implements ActionListener{
    public void actionPerformed(ActionEvent e){
    if (e.getActionCommand()=="SEARCH")
         try{
         Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
         con1= DriverManager.getConnection("jdbc:odbc:Test");
         stmt2= con1.createStatement();
    input1 = new String(pathTf.getText());     
         main_loop: while(true){
    if (input1.equals("0")){     
              // break out of while(1)
              break main_loop;
         st= new StringTokenizer(input1," ,-=>");          
              while(st.hasMoreTokens()){
                   // analyze the input stream.
                   // Attention, the program didn't do the input value check.
                   input1= st.nextToken();
                   input2= st.nextToken();               
              query= "select "+ schema[Integer.parseInt(input1)-1]+ ","+ schema[Integer.parseInt(input2)-1]+ " from [Sheet1$]";     
              rs2= stmt2.executeQuery(query);     
              rowCounter= 0;
              list1.clear();
              list2.clear();
              list3.clear();
              while(rs2.next()){
                   // increase the row counter
                   rowCounter++;
                   // initial the flag
                   col1= rs2.getString(1);
                   col2= rs2.getString(2);               
                   // for the initalization
                   if (list1.isEmpty()){
                   list1.addElement(col1);
                   list2.addElement(col2);
                   row="Row 2";
                   list3.addElement(row);     
                   // compare weather exist dependance
                   else
                   for (int i=0;i<list1.size();i++){
                        // if col1 match with the first part of value in the list
                        if (((String)list1.get(i)).equals(col1)){
                             // The independence pair match
                             if (((String)list2.get(i)).equals(col2)){
                                  break;
                             else
                                  textArea.append("\n"+"Violate Integrity Constraints Found : "+" Row "+ (rowCounter+1)+ " not match with "+ list3.get(i)+".");
                                  System.out.println("\n"+" Row "+ (rowCounter+1)+ " not match with "+ list3.get(i)+".");      
                                  break;                    
                        // if col1 not match with any value, add a new record in list
                        else
                             list1.addElement(col1);
                             list2.addElement(col2);
                             row="Row "+ (rowCounter+1);
                             list3.addElement(row);
                   }// end of for
                   }//end of else
    }//end of while
    }//end of while(1): main_loop
         }catch(Exception ex){
         //System.err.println(ex);

    sorry~~I am new here!
    class MyActionListener implements ActionListener{
             public void actionPerformed(ActionEvent e){
                  if (e.getActionCommand()=="SEARCH")
                 try{
                          Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                          con1= DriverManager.getConnection("jdbc:odbc:Test");
                          stmt2= con1.createStatement();
                          input1 = new String(pathTf.getText());
             main_loop: while(true){
                     if (input1.equals("0")){
                                 // break out of while(1)
                     break main_loop;
                      st= new StringTokenizer(input1," ,-=>");
                     while(st.hasMoreTokens()){
                                  // analyze the input stream.
                                     input1= st.nextToken();
                                     input2= st.nextToken();
                          query= "select "+ schema[Integer.parseInt(input1)-1]+ ","+ schema[Integer.parseInt(input2)-1]+ " from [Sheet1$]";
                     rs2= stmt2.executeQuery(query);
                     rowCounter= 0;
                     list1.clear();
                     list2.clear();
                     list3.clear();
                    while(rs2.next()){
                           // increase the row counter
                    rowCounter++;
                           // initial the flag
                    col1= rs2.getString(1);
                    col2= rs2.getString(2);
                           // for the initalization
                      if (list1.isEmpty()){
                          list1.addElement(col1);
                           list2.addElement(col2);
                            row="Row 2";
                          list3.addElement(row);
                        // compare weather exist dependance
                           else
                              for (int i=0;i<list1.size();i++){
                                // if col1 match with the first part of value in the list
                                     if (((String)list1.get(i)).equals(col1)){
                              // The independence pair match
                     if (((String)list2.get(i)).equals(col2)){
                         break;
                              else
                textArea.append("\n"+"Violate Integrity Constraints Found : "+" Row "+ (rowCounter+1)+ " not    match    with "+ list3.get(i)+".");
               System.out.println("\n"+" Row "+ (rowCounter+1)+ " not match with "+ list3.get(i)+".");
                            break;
                          // if col1 not match with any value, add a new record in list
                            else
                                 list1.addElement(col1);
                                 list2.addElement(col2);
                                 row="Row "+ (rowCounter+1);
                                 list3.addElement(row);
                       }// end of for
                   }//end of else
               }//end of while
            }//end of while(1): main_loop
                                 }catch(Exception ex){
                                     //System.err.println(ex);
                                     }

  • How to process Excel through JDBC

    Hi, there!
    In windows,we could build an ODBC Driver for excel,then how to write the sql statment to query and update the content of the excel through JdbcOdbcDriver?
    I have create an ODBC DataSource named Register,the excel file is RegisterInfo.xls and the name of the sheet that My data was stored in is RegisterInfo,How should I do?
    Thanks a lot.

    Your JDBC driver class is sun.jdbc.odbc.JdbcOdbcDriver
    The connection URL is jdbc:odbc:<name of your DSN>
    (I'm not sure how you would treat spaces in the DSN name, so I'd leave them out)
    To see the data
    SELECT * FROM "RegisterInfo$"
    Don't forget the quotes around the table name, because I'm not sure if the $ at the end isn't somehow interpreted. If you have spaces in the table name (=Worksheet) you need them anyway. The same goes for any columns that have a space in their name.
    Thomas

  • Connection to Excel using JDBC

    Hi
    I developed a program to send userid to excel sheet using jdbc...
    While i opened excel sheet and try to send data through jdbc it works great ...
    But the problem is while i closed the excel sheet and try to send data to excel sheet, it spells success.
    But the data i entered is not in that excel sheet ...
    What to do .???
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.sql.*;
    public class InsertExcel
    static JFrame frame;
    static JPanel panel;
    static JTextField textuserid;
    static JTextField textfirstname;
    static JTextField textlastname;
    static JButton submit;
    static JButton exit;
    public static void main(String args[])
    frame = new JFrame("Inserting to excel sheet");;
    panel = new JPanel();
    JLabel labeluserid = new JLabel("User id ");
    JLabel labelfirstname = new JLabel("First Name");
    JLabel labellastname = new JLabel("Last Name");
    textuserid = new JTextField(20);
    textfirstname = new JTextField(20);
    textlastname = new JTextField(20);
    submit = new JButton("Submit to Excel sheet");
    exit = new JButton("Exit");
    panel.add(labeluserid);
    panel.add(textuserid);
    panel.add(labelfirstname);
    panel.add(textfirstname);
    panel.add(labellastname);
    panel.add(textlastname);
    panel.add(submit);
    panel.add(exit);
    frame.getContentPane().add(panel);
    frame.setSize(1024,100);
    frame.setVisible(true);
    frame.setDefaultCloseOperation(3);
    submit.addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent e)
         try
              Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
              Connection con = DriverManager.getConnection("jdbc:odbc:Excel Files","","");
              PreparedStatement stat2 = con.prepareStatement("insert into
    [Book1$](USERID,FIRST_NAME,LAST_NAME) values (?,?,?)");
              stat2.setString(1,textuserid.getText());
              stat2.setString(2,textfirstname.getText());
              stat2.setString(3,textlastname.getText());
              stat2.executeUpdate();
              JOptionPane.showMessageDialog(frame,new String("Successfully entered to excel sheet !!!"));
         catch(Exception e1)
              JOptionPane.showMessageDialog(frame,new String("Error while inserting to excel sheet !!! \n" +
    e1));
    exit.addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent ex)
         System.exit(0);
    }

    I think this thread has been cross-posted

  • Excel ODBC Connection Issues

    I'm having some issues importing external data from an Oracle 9i database.
    Here is what is happening:
    I am initially able to import data from the table I want to into Excel.
    I do this through "Data -> Import External Data -> New Database Query" where I have my .ORA data source. I'm able to log in using my user and password and import the table. My problems come after I import this first set of data.
    If I try to "Edit Query…" I get an error box that says "[Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed".
    If I try to "Refresh Data" I get two error boxes. The first is just: "[Microsoft][ODBC driver for Oracle][Oracle]" and the next says: "[Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed". It then prompts me for the User name and password of the DB I'm connecting and after I enter the information, I get the same two error messages.
    Also, if I attempt to establish another connection following the "Data -> Import External Data…" steps I run into a different problem. Upon entering the information for the User Name and password prompt I get two error messages. One says "!" and the next box says "Couldn't read this file". Once I click "OK" in those boxes, the Microsoft Query window automatically opens with nothing in it.
    I can't seem to figure out why I can initially pull down data and then cannot succeed afterwards. I'm unable to connect to the DB I have through Excel until I completely closed all Microsoft Excel instances.
    I also use this data source in Microsoft Access without any problems.
    My Excel version is 2003.
    I'm using Oracle Drivers I'm using are from an "Instant Client" package.
    Any thoughts why I'm having these connections issues?
    Thanks in advance.

    This issue is closed.
    The solution was:
    "Data -> Import External Data -> Import Data"
    Select "New Source" and select the "Oracle" data source and filled in the appropriate information. This was similar to the database query but it actually works.

  • Using Excel & ODBC data source to get data

    I've been using MS Excel to extract MS SQL Server data from our ERP system for years but we are now moving to Oracle 12i. What are my options in the Oracle world? Can it be configured much the same way; that is by configuring an ODBC data source and connecting directly to the database???
    Thanks in advance.

    user11307988 wrote:
    I've been using MS Excel to extract MS SQL Server data from our ERP system for years but we are now moving to Oracle 12i. What are my options in the Oracle world? Can it be configured much the same way; that is by configuring an ODBC data source and connecting directly to the database???
    Thanks in advance.Adding to sb92075's brief but accurate statement, from one of my recent presentations (note - no need for an ODBC connection):
    'Need to add a reference to Microsoft ActiveX Data Objects 2.8 Library before starting
    '*** This section might be in the top portion of the user form, worksheet code, or module:
    'Declare a connection object in the general section to hold the connection to the database
    Dim dbVMFG As ADODB.Connection
    'Declare a set of variables to hold the username and password for the database
    Dim strUserName As String
    Dim strPassword As String
    Dim strDatabase As String
    Dim i as Integer
    Dim intResult As Integer
    Dim strSQL as String
    Dim lngRow as Long
    On Error Resume Next
    strDatabase = "MyDB"
    strUserName = "MyUser"
    strPassword = "MyPassword"
    'Connect to the database
    'Oracle connection string
    Set dbVMFG = New ADODB.Connection
    dbVMFG.ConnectionString = "Provider=OraOLEDB.Oracle;Data Source=" & strDatabase & ";User ID=" & strUserName & ";Password=" & strPassword & ";ChunkSize=1000;FetchSize=100;"
    dbVMFG.ConnectionTimeout = 40
    dbVMFG.CursorLocation = adUseClient
    dbVMFG.Open
    If (dbVMFG.State <> 1) Or (Err <> 0) Then
        intResult = MsgBox("Could not connect to the database.  Check your user name and password." & vbCrLf & Error(Err), 16, "Excel Demo")
    Else
        strSQL = "SELECT" & VBCrLf
        strSQL = strSQL & "  ID AS RESOURCE_ID," & VBCrLf
        strSQL = strSQL & "  DESCRIPTION" & VBCrLf
        strSQL = strSQL & "FROM" & VBCrLf
        strSQL = strSQL & "  MY_TABLE" & VBCrLf
        strSQL = strSQL & "WHERE" & VBCrLf
        strSQL = strSQL & "  DESCRIPTION LIKE '%10%'" & VBCrLf
        strSQL = strSQL & "ORDER BY" & VBCrLf
        strSQL = strSQL & "  ID"
        'Add a new worksheet to the new workbook, add after the last sheet
        ActiveWorkbook.Sheets.Add
        ActiveWorkbook.ActiveSheet.Name = "JustATest"
        snpData.Open strSQL, dbVMFG
        If snpData.State = 1 Then
            'Slow Method------------------------------------
            lngRow = 0
            'Header Row
            For i = 0 To snpData.Fields.Count – 1
                lngRow = lngRow + 1
                ActiveSheet.Cells(lngRow, i + 1).Value = snpData.Fields(i).Name
                ActiveSheet.Cells(lngRow, i + 1).Font.Bold = True
            Next i
            'Detail Rows
            Do While Not snpData.EOF
                lngRow = lngRow + 1
                For i = 0 To snpData.Fields.Count - 1
                    ActiveSheet.Cells(lngRow, i + 1).Value = snpData.Fields(i)
                Next i
                snpData.MoveNext
            Loop
            'End Slow Method------------------------------------
            'Fast Method----------------------------------------
            'Do not use this and the slow method!
            For i = 0 To snpData.Fields.Count - 1
                ActiveSheet.Cells(1, i + 1).Value = snpData.Fields(i).Name
            Next i
            ActiveSheet.Range(ActiveSheet.Cells(1, 1), ActiveSheet.Cells(1, snpData.Fields.Count)).Font.Bold = True
            ActiveSheet.Range("A2").CopyFromRecordset snpData
            'Auto-fit up to 26 columns
            ActiveSheet.Columns("A:" & Chr(64 + snpData.Fields.Count)).AutoFit
            'End Fast Method----------------------------------------
            snpData.Close
        End If
    End IfA couple of notes:
    1. Do not repeatedly connect to the database, execute a SQL statement, and disconnect from the database - connect once and stay connected.
    2. Use bind variables where possible in SQL statements for constants (literals) which might change from one execution to the next - let me know if you need s code example showing bind variable usage in Excel.
    Charles Hooper
    IT Manager/Oracle DBA
    K&M Machine-Fabricating, Inc.

Maybe you are looking for