How to Create ODBC Data Source (DSN)  Programmably?

Very troublesome to go to control panel and manually create the Data Source. Anyone know of any free Java Library which enables us to do it from a Java program?

/* 2003/02/06 eric.leung
* Source : HOME
import java.sql.*;
import java.lang.*;
public class ejdbcsel {
     public static void main(String args[]) {
          // eric_jsp is ODBC User DNS
          // String url = "jdbc:odbc:eric_jsp";     
          // Using DSNless connection
          String url = "";
          url = "jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb)}" +
          ";SERVER=127.0.0.1;DBQ=c:\\example\\ERIC_JSP.mdb";
          Connection con;
          String query;
          query = "select * from pt_mstr";     
          Statement stmt;
     try {     
          Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
     } catch (ClassNotFoundException e) {
          System.err.print("ClassNotFoundException " );
          System.err.println(e.getMessage());
     try {
          con = DriverManager.getConnection (url,"","");
          stmt = con.createStatement();
          ResultSet rec = stmt.executeQuery(query);          
          // Scan the Database
          while(rec.next()) {
               System.out.println(rec.getString("pt_part") + "\t"
               + rec.getString("pt_desc"));     
          stmt.close();
          con.close();
     } catch (SQLException ex) {
          System.err.println("SQLException: " + ex.getMessage());
     catch (Exception e) {
          System.err.println("Error: " + e.toString() + " " + e.getMessage());

Similar Messages

  • How to create Hive data source?!!

    I am trying to create hive data source connection.
    I am stack on creating connection profile and configuring "Generic JDBC Driver" .. after i added drivers i keep getting " Required property in driver definition missing value: Driver Class." error.
    I am adding a screenshot with the list of drivers.

    Kevin
    In Jdbc node create a Jdbc Connection Pool with the
    Url=jdbc:borland:dslocal:/jbuilder6/samples/Ejb/db/esite.jds
    and driver=com.borland.datastore.jdbc.DataStoreDriver. Create a Datasource
    using a Jndi & Jdbc Connection Pool.
    Deepak
    Kevin Gao wrote:
    in jbuilder6 samples instructions,there is instruction as:
    Create a WebLogic data source named ESiteSource. You will need to check
    your WebLogic documentation on how to create a data source. You will need
    the following settings
    1.The database URL should be of the following format:
    jdbc:borland:dslocal:/jbuilder6/samples/Ejb/db/esite.jds, ensuring that you
    have the correct path to esite.jds.
    2.The driver will be com.borland.datastore.jdbc.DataStoreDriver.
    3.This JDataStore is not password protected, but you must still specify a
    user; any user will do, e.g., user=Frank;password=
    but how to create a data source in weblogic?
    help me please!
    thanks in advance!
    Kevin Gao
    EMAIL:[email protected]

  • How to create JNDI data source name in Tomcat 6.0.18 server?

    Hai,
    How to create JNDI data source name in Tomcat 6.0.18 server?
    Regards,
    MariMuthu.A

    [http://google.com/search?q=jndi+site:tomcat.apache.org+6.0]

  • How to create Geniric data source using the SAP FUNCTION MODULE

    Hi,
    I want to create genric data source using function module
    MD_STOCK_REQUIREMENTS_LIST_API (delivered by sap)
    for this function module where I can find  Extract Structer
    or I have to create ?
    How can i use this ?
    Thanks in Advance

    Hi Shilpa,
                  Check here..........
    Using function module as the generic extractor
    Generic Delta Update using Function Module
    Document regarding R/3 extractors using function module/user exits
    Generic extractors using FM

  • How to create XML data source/ and load data from a web service to BI

    All,
    I m trying to find a 'how to' document (or any document) that shows how to create an XML data source to load data directly from a web service or from an XML file.
    I appreciate any help.

    Hi Mike,
    Two more for you:----
    /thread/111488 [original link is broken]
    http://help.sap.com/saphelp_nw70/helpdata/en/e6/1dd53bb90cbb1ae10000000a11402f/content.htm
    Regards,
    Suman

  • How to create generic data source in R/3

    hi experts !
    i m a beginner in BIW.
    i wan to create a generic data source in my R/3 system. since there exists a Z table which i want to use in designing an infocube in my BI system. please someone help me how should i begin with doing it ?
    thanx in advance
    akanksha

    Akanksha,
    Here am providing you with a scenario when we go for Generic Datasource and also the steps to create a Generioc DS:
    We can create datasource based on View, Table, SAP Query or ABAP Query, and Function Module.
    Scenario for Generic Datasource.
          One of the Manager who using reports wanted to have the  report which will him the list customers and sales document numbers created by them.
         In this case we can use of VIEW where kna1 and vbak tables were combined in the View definition or else u can say that “ABAPer had given the required view”.
    How to create the generic Datasource.
          Goto RS02, select the Transactional Data, it will takes us to the next screen, where we need to give application component name say SD (01), then give the name of the Datasource that u wanted, select view and give the view name. Below that field we need give 3 descriptions. Then save and activate the datasource.
        Go back to the RSA6 screen transport it to BW system. Replicate the DS.
    Hope it helps..
    Assign Points if it helps
    Regards,
    Gattu

  • How to create master data source for Profit center group in source system

    Profit center group information is available in SAP(T-code:kch3). But, I want to have this information in BW too.
    Can anyone tell me how to create a datasource for Profit center group? And which SAP table is able to feed master data for this information?
    Many thanks
    rajatina.

    HI ,
    It looks lilke we need to use the FM like 'G_SET_LIST_SELECT' to get the Profit
    Here ais note from the forums to get profit center group from table
    From Table SETLEAF,  Field SETCLASS  =  '0106'. Field SUBCLASS with controlling area. Profit center in Field VALFROM.
    You will get Group name in Field SETNAME.
    Regards,
    Sathya

  • How to create JDBC data source w/o LDAP server

    I am trying to test using JDBC data source on a computer without a LDAP server. Is there an alterative JNDI solution? How about using file system or RMI registry JNDI service providers?

    Any J2EE container should be able to handle that. I use JNDI data sources with Tomcat 4.1.27. I'm sure any other J2EE app server (e.g., WebLogic, WebSphere, JBOSS, etc.) would be able to manage it, too. - MOD

  • Setting up an ODBC data source to connect to BerkleyDB

    How can I set up an ODBC data source (DSN) to connect to BerkleyDB. I installed Berkeley DB 11gR2 (11.2.5.0.21) on Windows XP 32-bit and I can see the sqlite3odbc.dll in the installation bin folder but there seems to be no BerkleyDB ODBC driver listed in Windows ODBC Adminstrator app

    Hi,
    I'm afraid that we don't ship an installer with our initial release. It is possible to install manually, but it requires making some changes to the source code, building the ODBC driver and installing manually.
    The steps are as follows:
    <li>Edit the file db-5.0.21/sql/odbc/sqlite3odbc.c at line 15919 change "drivername" and "dsname" variables to contain the driver strings you would like to use.
    <li>Follow the instructions to build the dll in the install guide here: http://www.oracle.com/technology/documentation/berkeley-db/db/installation/build_win_sql.html#id3371140. NOTE: You only want to follow the build steps here, not the configure or install steps.
    <li> Once you have built the sqlite3odbc.dll file, you'll need to follow the manual install steps defined in the README here: http://www.ch-werner.de/sqliteodbc/README . Search for the section titled Win32 install/remove/shell by RUNDLL32
    I hope this helps, let me know if you need further information.
    Regards,
    Alex Gorrod, Oracle Berkeley DB

  • Not able to create a Data source with qty filed in the table

    Hi i am having scenario.
        i am doing a Genric R/3 extraction for R/3 system. I created a view from two tables. I have added a net quantity field also in then view table. But when i created a data source for that view it is showing a error message which says that it cannot create a data source with a quantity field in the table.
    Here is my question. How to create a Data Source for a view table which has Qty filed in it.
    Pls help with this.
    Senthil

    Hi Sensai,
       U need to add reference table for the unit .... when added into the view u create .......the reference table name u can find in the table itself from where it is brought into the view.... in the table currency quantity fields........
    U can add that table in the currency /quantity fields of the view....u need to add referecne field and table...and activate ........
    i think it works
    Regards
    vamsi

  • Creating DB2 data source in weblogic 9.2

    Hello,
    Steps how to create DB2 data source in weblogic 9.2 especially what driver to use for the same.

    Please look at Oracle docs
    Configuring JDBC Data Sources
    Supported Database Configurations
    Create JDBC data sources
    Thanks,
    Souvik.

  • Cannot create new Data Source - Oracle ODBC does not show in System DSN

    On Windows 7 x64, Installed Oracle 10g to use ODBC to connect to Oracle database but am not able to create new data source as Oracle ODBC does not show in System DSN.... only shows SQL server etc etc...

    If you installed 32-bit Database Client, try the 32-bit ODBC admin tool: C:\Windows\SysWOW64\odbcad32.exe
    Note that 10.2.0.5 is the earliest "10g" version supported on Win 7.
    http://download.oracle.com/docs/cd/B19306_01/relnotes.102/b15680/toc.htm#BABEBBJF
    As an alternative, try the 11.2 Instant Client.
    For 32-bit apps: http://www.oracle.com/technetwork/topics/winsoft-085727.html
    64-bit/x64: http://www.oracle.com/technetwork/topics/winx64soft-089540.html

  • Cannot see System DSN ODBC Data source (however user DSN is Ok)

    We have installed BO 6.5.1 on Windows 2008 R2 64 bit and set up ODBC Data source to the existing SQL server.
    When we try to set the BO up (Administration>Safe recovery etc.), in the "Database middleware selection" - "Define new connection" - "Data source name" we cannot see the System DSN name that we've created in the Window's "ODBC data source administration" control panel applet. If we create a User DSN, we can see it ok but it works for one user only (as it should).
    So, in a nutshell, if we setup a User DSN it works fine but if we setup a system-wide System DSN BO cannot see it. I've got no idea why...
    Can anyone point me to the right direction, please?

    Are you using the ODBC Administrator from control panel?  If so, try launching this instead:  odbcad32.exe from start/run.
    This is the 32-bit ODBC administrator and since we are a 32-bit application, a 32-bit DSN will need to be configured.
    Here's another forum thread that may be helpful:
    http://social.msdn.microsoft.com/Forums/en/sqldataaccess/thread/49e206c3-f4f8-4757-8990-71b93120d2bc
    and this one too:
    http://forums.techarena.in/windows-x64-edition/698703.htm
    Thanks
    Jonathan

  • How can I delete an ODBC data source after 10g client has been uninstalled?

    I uninstalled the 10g client and now when I attempt to delete the ODBC data source, I get an error: "The setup routines for the Oracle in Oraclient10g_home2 ODBC driver could not be found. Please reinstall the driver. I re-installed the client and I get the same error, but I had to specify a new home. I still get the error. Anyone have an answer or a workaround to deleting the ODBC entry so that I can re-create with the same name later under the 9i client?

    I have the same problem... and nobody gots the point:
    1st. the ODBC and the client/home exists on the machine...
    2nd. the client/home is unistalled and so...
    3rd. tada! Now we have a impossible-to-unistall ODBC entry!
    That is happening on a Windows, at last to me...
    Please, help us if someone knows how to remove this ODBC entry... if know how to DO the stuff (permissions, system, all that things is answered above).
    Best regards,
    Bruno Araujo

  • How to create odbc (dsn) connection for OBIEE AND INFOR in unix environment

    Hi,
    we are establishing OBIA in Unix environment we set all the things fine but we are getting problem how to create ODBC connection
    for INFORMATICA AND OBIEE. I searched some blogs thats telling there is a ODBC.INI file we need to configure.
    but i am not getting clear idea to give parameters and it will not showing any TNSNAME ..........etc
    please any body give clear idea about how to create ODBC connection and LOCATION of that file AND parameter which i need to give.
    Thanks,
    charan....

    Hi Dpka,
    yah i already checked that one but i have not find out any parameter for TNS NAME information.
    is OBIEE connected to ORACLE DATA BASE without giving TNS information?............in UNIX OPERATING SYSTEM.
    pls give me the clear idea abt how to connect OBIEE, INFORMATICA to ORACLE DATA BASE IN UNIX ENVRNMENT
    thanks,
    charan.

Maybe you are looking for

  • How to make SharePoint 2013 search only in document content?

    We are using SharePoint 2013 environment and are facing following issue while doing search in the document library.  There is  one document library named "MYDOC" .and it has two columns name 'DocTitle' and 'DocTag'.. Although we are able to perform s

  • In FM 8 and 9, Xref generated text invisible and xref is reported broken

    Hi all, We were working in 8 and now in 9, and have not been able to solve this problem: For xrefs to another document, the generated text (based on the srcfile attribute) is correct in the XML.  When we open it in Frame, sometimes it is invisible an

  • Link to download Hotfixes/Updates?

    Our ColdFusion instance is locked down inside our DMZ, so while the built-in update feature is cool, we still need to download hotfixes in order to install them. I've done a bunch of searches and come up empty. Can anybody point me to a location to d

  • TestStand 4.0 Watch Expression Panel Patch

    There is a patch available for TestStand 4.0.  This patch improves the performance of the Watch Expression in the TestStand 4.0 Sequence Editor.  For more information regarding this patch, please see the Readme. http://joule.ni.com/nidu/cds/view/p/id

  • IDOC posting problem

    Hi, Currently i am facing one issue with bd87 tcode, when evr i tried to process the idoc thr BD87, automatically debugging mode is switched on.Actually the user is not having the authorization and  even we did n't set any debugging related parameter