ODBC SOURCE

hi,
is-it possible to get the list of the ODBC sources in a JAVA application (on W2000) ?

This is a work around, try this
import java.util.*;
import java.io.*;
class OdbcList {
     private ArrayList list;
     private RandomAccessFile file;
     public OdbcList() {
          try {
               file = new RandomAccessFile("C:/winnt/odbc.ini","r");
               list = new ArrayList();
          } catch(Exception e) {
               e.printStackTrace();
     public static void main(String args[]) {
          OdbcList dsList = new OdbcList();
          ArrayList list = dsList.getOdbcList();
          for(int count=0;count<list.size();count++)
          System.out.println(list.get(count));
     public ArrayList getOdbcList() {
          try {
               String line=file.readLine();
               while((line=file.readLine()) != null) {
                    if(line.startsWith("[")) list.add(line.substring(1,line.length()-1));
               file.close();
          } catch(Exception e) {
               e.printStackTrace();
          return list;
}You need to specify the path to your odbc.ini thats all. Rest of the code will work for you.
Hope this helps you.
Sudha

Similar Messages

  • How to get the dialog of select ODBC source

    how to get the dialog of select ODBC source which system provide.

    JNI.
    Or buy/find a library that does it for you (using JNI.)

  • How it's possible to add ODBC source to windows resources?

    Hi.
    I'm using DB Connectivity Tools and MS Access Driver to connect to the database. My VI reads previous created data link. My problem is that I need do EXE file, and doesn't know how I can set the ODBC source in Windows directly in LabView, and create Datalink direct in LV (without using Tools->Create Data Link). Maybe somebody knows how to do this. Thanks in advance.

    Wiebe@CARYA wrote:
    In the last string, don't seperate each parameter. Simply put a space
    between two of them, not the quotes and \0. The \0 on the end is
    automatically added by LabVIEW, so there is no need for that as well. Like I
    mentioned, it should look like this: "DNS=databasename DBQ=filepath UID=user
    PWD=password", where the quotes are not in the string. Perhaps the file path
    needs quotes, if it contains spaces, but I don't think I use them, and it
    works fine.
    Instead of creating a DSN you can also simply pass those parameters to the "connection string" parameter of the DB Tools Open Connec (String).vi.
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • ODBC Sources in OWB

    Hello,
    I have a question regarding ODBC and OWB.
    How can I get a connection from OWB to an ODBC source.
    I have an exsisting and proofed (I use it from SQL Plus) database link.
    My OWB installation has 3 types of Integrators: Flat Files 3.0, Oracle DB and Apps 3.0 and SAP Applications 3.0 .
    What have I got to do now, to connect to an ODBC source?
    If I create a new MODULE and select Generic Oracle DB App as application and Oracle Generic Gateway Connectivy as application version (or an Oracle DB), I get a Java NullPointerExeption when using the DB-Link for my ODBC connection.
    Anyone outside who has an idea.
    Regards
    Ulrich

    Dear all
    The following is taken from one of our internal documents on how to set up ODBC connections to an AS/400. Hope this helps. This would apply to OWB 3i and 9i.
    Configuring Oracle Heterogeneous Services to Connect to a Non-Oracle Database
    =============================================================================
    This document is intended to describe how to connect to a non-oracle source using Oracle’s Heterogeneous Connections. (Generic Connectivity)
    1.     Install the data dictionary tables and views for Heterogeneous Services.
    - Login as sys and run the script caths.sql
    This script is located in $ORACLE_HOME/rdbms/admin
    2.     Set up an ODBC connection to the target database
    - Select Control Panel, Administrative Tools, Data Sources (ODBC)
    NB This must be a system DSN not a User DSN
    3.     Add the following entry to Tnsnames.ora in the $Oracle_home\network\admin directory
    hsas400 =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = tcp)(host=<hostname>)(port=1521))
    (CONNECT_DATA =
    (SID = as400)
    (HS=OK)
    •     N.B The address information is based on the Oracle connection and not the target database. The SID name can be chosen but must be identical to the SID configured later on in the listener.ora
    4.     Add the following entry to Listener.ora in the $Oracle_home\network\admin directory
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC=
    (SID_NAME=as400)
    (ORACLE_HOME=c:\oracle\ora81)
    (PROGRAM=hsodbc)
    - NB The SID_NAME must be identical to the SID used in tnsnames.ora. The Program must be hsodbc (this is an executable program)
    5.     Stop and Start the Oracle Listener
    - Select Control Panel, Administrative Tasks, Services
    - Select the Oracle_HomeTNSListener and stop
    - Restart the service
    6.     Check the Service is running
    - From a command prompt type ‘ lsnrctl status’
    - Check that a service handler for the new sid is running
    7.     Create the initialisation file
    - Navigate to the directory $Oracle_Home\hs\admin
    - A sample file inithsodbc.ora file exists. Copy this file into the same directory using the format init<SID>.ora. In my example the SID used is as400 so the file name will be initas400.ora
    8.     Initialisation File configuration
    - Configure the newly create file to with the following information
    HS_FDS_CONNECT_INFO = RENSQL <name of ODBC connection created in step 2>
         HS_FDS_TRACE_LEVEL = 0
    9.     Create a database link to access target database
         SQL> create public database link as400
         SQL> connect to “user” identified by “password” <optional
         SQL> using 'hsas400'; < the connection name created in tnsnames.ora
    10.     Test the connection
         SQL > select * from products@as400
    - N.B Use a known table that exists on the target database
    To check the creation of the database link run:
         Select * from all_db_links
    Connecting to OWB using HS
    Do not deploy the Database link code to the server as the package deployment will fail. This is because the database link created takes priority over the public DB Link created and as it is owned by the OWB schema can only be used by system and the OWB schema.
    regards
    Mark Rittman
    Plus Consultancy

  • How to get information from ODBC sources to Forms Builder environment

    Hi,
    Could anyone help me, to get some examples or more information, that how can I get information from ODBC sources to Forms Builder environment. I have a need to read data for example to LOV.

    If you are on Forms 6i you install the Oracle Client Adaptor from the Forms CD. You then have a way of connecting to ODBC datasources.
    To connect to ODBC at the same time as you are connected to Oracle you can use the EXEC_SQL package to create a second connection via odbc and issue select statements against that datasource.

  • ODBC Sources

    Can OWB access an ODBC source directly?
    I have created an ODBC connection in SQLPLUS which is up and running, but at present, the only way to access the actual tables at present is to create a 'view' of the tables.
    I believed that, through the Oracle Generic Gateway Connectivity, I would be able to connect to a data source created through the Microsoft ODBC Control Panel.
    Thanks
    Chris McGill

    Oracle Generic connectivity refers to a database-to-database connection, not a direct connection from OWB to a remote database. Therefore, from OWB you can access all the remote objects in this way.
    Regards:
    Igor

  • ODBC source, do I have to set up DSN? If so how do I deploy File or Machine DSN?

    I have a Datasource that uses a ODBC connection Manager. On my Dev machine, I set up a User DSN, by going into my control panel, etc.  I see you can also build it in the datasource, but it still saves it as a File or Machine Data Source.
    This is a pain in the butt.  With OLEDB everything is in the connection string.  I don't have to set up DSN.
    When I deploy my package, will I have to go to the extra steps of setting up a DSN on the machine (or a DSN file on the machine) that host the SQL Server I am deploying to.   This means I will have to go through a whole level of bureaucracy and
    red tape to get this done cause that server is locked down.
    This kinda sucks, especially cause I heard OLE DB is going away and ODBC is the new standard.
    Please help, if you know how I can set up ODBC without DSN.  One that works when I deploy without all the extra steps?
    Thanks,
    Mike

    Hi Mike,
    Just as Hsbal said, we can use a connection string for ODBC, so that we don’t have to pre-create the DSN on the systems that will be running the SSIS package.
    Please note that most of the Source can use a connection string without DSN. Please use the correct connection string based on the source. For more details, please refer to the following document:
    http://www.mattmasson.com/2013/11/using-hive-odbc-from-ssis/
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Querying for ODBC Sources

    Can someone tell me how to "query" a Windows system to find out what ODBC data sources are available, and also how to capture the connection string information associated with anyone of thoses sources?
    Thank you
    AG

    This is OS specific which means the following:
    -It has nothing to do with JDBC.
    -It will have to use JNI or Runtime.exec() to get the info.
    I believe there is at least one third party java library for this that you can search for on the web.
    Or you can code your own solution. The values are kept in the windows registry, you scrap them out and then display them.

  • SSIS: Export data from ODBC source to Excel only 5000 rows at a time

    Greetings,
    Im inserting data into Excel using SSIS.
    Im getting the following exception:
    '[Excel Destination [32]] Error: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005.
    An OLE DB record is available. Source: "Microsoft Office Access Database Engine" Hresult: 0x80004005 Description: "Spreadsheet is full.".'
    I did some research using the following link:
    http://office.microsoft.com/en-us/excel-help/excel-specifications-and-limits-HP010073849.aspx
    It states that you can populate the maximum of 1,048,576 rows by 16,384 columns
    The data i am importing into Excel is only about 100,000 rows by 5 columns
    After doing some research I am now aware that this is to much data for Excel to handle at one time.  I was advised to lower the amount of rows SSIS is exporting into Excel........How do I lower the amount of rows to 5,000 at a time is SSIS?

    Having the maxbufferrowsize
    But I have a doubt that it is related. You probably max up the allowed size for your version of Excel.
    Arthur My Blog

  • MaxL for Import of Data & Dimension info using an ODBC source (Oracl based)

    See below for syntax issues with using the SQL Interface with MaxL to load first a dimension, then data. (Any one have experience with getting the exact syntax for this?) ThanksMAXL> import database ESSBASE_APPNAME.ESSBASE_DBNAME dimensions connect as ORACLE_USER identified by ODBC_DEFINITION using rules_file LdJob; 6 - (1) Syntax error near end of statement. 50 - MaxL compilation failed.MAXL> import database ESSBASE_APPNAME.ESSBASE_DBNAME data connect as ORACLE_USER identified by ODBC_DEFINITION using rules_file LdTurn; 6 - (1) Syntax error near end of statement. 50 - MaxL compilation failed.

    I think i got my error. I have to say 'import database dimensions from data_file........' instead of 'import database data from data_file............'. I dont know how to delete this post so i am not deleting it.

  • Determining the ODBC data source from a Subreport - VB6, CR8.5 OCX

    I am using Crystal 8.5 OCX and VB6 to run some reports.  Users run reports on different databases with the same table structures.  All run from ODBC sources that change in name also.  The reports are just rpt files on the hard drive that are run when the user wants them run.
    The running is fine and I can change database locations without problems.  But I have run across circumstances now that some reports have some subreports that have different ODBC drivers from the main report and therefore need to be changed differently.  I won't always know what the subreport names are nor if they even exist in specifc reports.  The code below is what I am using and it works to change the subreport connection.  But I can't figure out how to determine what the current connection is when it was designed.  If I know what the connection is when it is designed, I can redirect it to the proper new driver.
        intNumSubs = crReports.GetNSubreports
        For X = 0 To intNumSubs - 1
            title = crReports.GetNthSubreportName(X)
            With crReports
                .SubreportToChange = title
                strCurrentConnect = 'want to add something here to find the current connection string and then make a decision to change it or not
                .Connect = sConnect
            End With
        Next X
    My default solution that I believe will work is to force the naming of a subreport specifically to identify the subreports that need different ODBC drivers from the default change, but I am not the only programmer of reports so anyone could name a subreport anything and that is very difficult to change once designed.
    So does anyone have any idea how I can get the connection string or the ODBC driver that the subreport was created on from a subreport (and I guess I will probably be interested in the main report also) before I change it?
    TIA rasinc

    Please re-post if this is still an issue to the Legacy Application Development SDKs Forum or purchase a case and have a dedicated support engineer work with you directly

  • ODBC not working in Reports 6i.

    I can not connect to any ODBC database via Reports 6i. When asked for username etc, I put in mnewman/mnn4578@ODBC:*, I get the DSN selection dialog, I switch to the machine tab, and select the odbc source I want, the system then responds with REP-0501: Unable to connect to teh specified database. And ORA-00022. invalid session id; access denied.
    I have tried both checking the trusted connection dialog box on MS SQL server 7.0, and not checking it. It does not help. I have tried to connect to MS ACCESS 97, and Visual FoxPRo with the same error messages. How do I specify an ODBC connection to a database that is not password protected?
    [email protected]
    P.S. I downloaded the evaluation version of Reports 6i from your website. I would like to create one of our in house report applications on it to convince my boss that Oracle reports is superior to the antiquated time consuming mehtod of producing MIF files from ADOBE framemaker, merging them with database generated MIF code & data, viewing and possibly fixing up final output, the converision to PDF and or HTML.

    Answering Oracle Reports questions is a bit out of my league, but I deal with a lot of ODBC apps, so I'll take a shot.
    Try doing the following-
    1) Open the Control Panel, Open the Data Sources (ODBC) control, and select the DSN you'll be using.
    2) Put mnewman in the User ID field and mnn4578 in the password field.
    3) I'm not familiar with the Oracle Reports dialog you're referring to when you say "I put in mnewman/mnn4578@ODBC:*", but make sure that you aren't providing more information than is being asked for (i.e. putting user/password@ODBC:* in a field that just asks for username). Since it's asking you to pick a DSN, it should be able to pull username/password information from the DSN.
    Justin Cave
    ODBC Development

  • Newbie: Problem with jdbc-odbc and MS SQL server 2005

    I'm on win vistax64 with SQLSERVER 2005 and I have set up the odbc source as system dsn using the SQL Native Client driver with SQL authentication and the connectivity test in the end succeeds.
    I'm trying to make a simple web app that will connect to the database and perform simple querries. It's a school assignment.
    I'm using the jdbc-odbc bridge because it's the simplest way to do it and it's what we were shown in class.
    I get the following irritating error:
    "Cannot establish a connection to jdbc:odb:sstmdb using sun.jdbc.odbc.JdbcOdbcDriver ([Microsoft][ODBC Driver Manager] Data source name not found and no default driver specifies)".
    I'm working with netbeans 5.5.1 and this error is what I get when in the runtime tab I try to connect with the jdbc-odbc. I get a similar error in the logs when I try to run the app on the j2ee server.
    This is the java class that establishes the connection.
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    public class Connector {
        private static final String dbUrl="jdbc:odbc:sstmdb";
        private static final String user="kimon";
        private static final String password="jackohara";
        public static Connection getConnection(){
            Connection conn = null;
            try {
                Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                conn = DriverManager.getConnection(dbUrl,user,password);
            } catch (SQLException e) {
                e.printStackTrace(); 
            } catch (ClassNotFoundException e) {
                e.printStackTrace(); 
            return conn;
    }It has worked perfectly on my school PC with winXP and MSDE2000.
    What am I missing?

    Ok, help came from an other way where I was inquiring about a different problem:
    Connectivity works fine by using User DSN instead of System DSN for the ODBC source.

  • Update oracle table using data through ODBC

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

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

  • 64-bit ColdFusion 9 ODBC drivers confusion? (architecture mismatch)

    Hi all - I'm having problems setting up ColdFusion ODBC sources in a pure 64-bit environment. Server specs:
    Windows 2008 R2 (64-bit)
    ColdFusion 9.01 (251028) Enterprise, 64-bit
    I have 64-bit ODBC drivers for all of my database sources:
    64-bit SQL Server (bundled with Windows 2008 R2)
    64-bit MS Access 2010 (with 64-bit Access ODBC driver from Office 2010 64-bit install)
    64-bit ODBC drivers for Sybase SQL Anywhere 11 (from SyBase)
    Using the (64-bit) ODBC Administrator, I can create system DSNs and they test out perfectly. (From my test Access database, I can use these DSNs to pull data from SQL Server and from SQL Anywhere.) Since this is working, I'm pretty confident that my drivers are all 64-bit and that everything is happy.
    Now for ColdFusion...
    When I try to create a new data source in the ColdFusion Administrator and I use, the "ODBC Socket" option, I am presented with a drop-down list of my 64-bit ODBC system DSNs (good!), but whenever I select one and save, I invariably get an "architecture mismatch" error like below:
    Connection verification failed for data source: MSSQLtestDatabase
    java.sql.SQLException: [Macromedia][SequeLink JDBC Driver][ODBC  Socket]internal error: The specified DSN contains an architecture mismatch  between the Driver and Application
    The root cause was that:  java.sql.SQLException: [Macromedia][SequeLink JDBC Driver][ODBC Socket]internal  error: The specified DSN contains an architecture mismatch between the Driver  and Application
    I am well aware that "architecture mismatch" errors mean that you're trying to mix 32-bit drivers with a 64-bit application (or vice-versa), but I'm pretty sure that everything in my environment is 64-bit.
    As a further test, I created a few 32-bit ODBC system DSNs and the ColdFusion Administrator does not present them as options in the drop-down list of ODBC DSNs (good!). So, it seems like the Administrator is smart enough to show only the 64-bit DSNs, but whenever you try to connect to one, it gets confused and kicks up an "architecture mismatch" error.
    So is there any obvious configuration error here? Is there a 32-bit subcomponent to ColdFusion (JDBC, etc.) that's confusing things? (I ran the ColdFusion_9_WWE_win64.exe setup downloaded from Adobe's site.) Is 64-bit ColdFusion ready for prime time? Any suggestions would be greatly appreciated. Thanks, Joe

    OK, just did a little Googling for you about this, Josie (and others). There seem to be a few alternative solutions, each with pros and cons.
    The easiest, though, may be to simply use the 32-bit (instead of default 64bit) ODBC control panel, and then again use the MS Access driver in the CF Admin (not the ODBC socket one) to point to that. This is discussed here:
    http://www.cfexecute.com/post/access-dsns-in-64bit-coldfusion
    There's also a little more that may help at the bottom of this:
    http://www.zidsoft.com/x64.html
    MS also covers the topic here:
    http://msdn.microsoft.com/en-us/library/ms712362%28VS.85%29.aspx
    Other CF-specific solutions include:
    - run CF instead in 32-bit mode (even on the 64-bit machine). See discussion at http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:60467
    - if you have 2 boxes available, you could run CF in 32-bit mode on one box (just for providing access to the 32-bit Access driver), then "proxy" the DSN setup from the 64-bit CF machine to access the DSN on the 32-bit machine (See http://www.coldfusionmuse.com/index.cfm/2009/4/7/MS.Access.Proxy)
    - get an alternative jdbc driver for Access (HXTT), mentioned in the threads above
    - did you happen to try the "microsoft access with Unicode" driver option in the CFAdmin? That is quite different from the one that is not "with Unicode", so worth a try if nothing else works for you.
    Let us know if any of these suit you.
    Also, I appreciate the annoyance of those who would think this should "just work" without workarounds. I think I have clarification there.
    First, the CF9 System Requirements page is unclear on this. While its systems support matrix lists 32 and 64 but windows (among others), those don't list what DBs are supported on each. Instead, there's a database support matrix at the bottom, which does indicate that Access is supported, but it doesn't break it down per OS, let alone bit-level of each OS.
    But I just found a clarificaiton in a devnet article (by an Adobe engineer) that does seem to put the nail in the coffin:
    "Most of the functionality and features of ColdFusion run just fine on 64-bit platforms, however, certain features like ColdFusion COM interoperability, ColdFusion Delphi interoperability, and Microsoft Access database connectivity do not work on a ColdFusion 64-bit platform. A few other features, such as ColdFusion .NET integration services and database drivers currently run in 32-bit mode." (http://www.adobe.com/devnet/coldfusion/articles/64_bit_print.html)
    I think most haven't noticed this or made much of it simply because Access has been eschewed by so many for so long.
    /charlie
    Providing CF troubleshooting services at carehart.org/consulting
    [email protected]

Maybe you are looking for