Creating a DSN Programmatically

I want to create a DSN programmatically through my java program. Normally what we do is we create a DSN manually and then access that DSN through our java program but in my case i dont want that DSN to be created manually i want it to happen programmatically. how do i go for it. The database i would be using can be oracle, SQL server 2000, MYSQL, DB2. Please help me in this regard. Thankyou in advance

Here is my code to connect to SQL Server without a
DSN but it gives asn Error that No suitable Driver
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").ne
wInstance();
con=DriverManager.getConnection("Driver={SQL
Server};Server=local;"+
               "Uid=sa;Pwd=admin;");
That error means that the URL isn't right.
"Server=local"? Could that be "localhost"?
Google for DSN less connection SQL Server:
http://forums.hostmysite.com/post-6380.html
%

Similar Messages

  • How to create a DSN for Oracle Provider for OLE DB in a web server

    Dear Guys,
    I am a Excel VBA developer.
    My requirement is from the Excel I have to call a Stored Procedure with REF CURSOR.
    Normally I am using Microsoft ODBC for Oracle Driver for connecting Oracle DB, which is in the Server .
    We have users using the Excel reports across the globe.
    Sending Excel report is enough, the clients can connect DB from Excel via the DSN created in a web server.
    But, I came to know that we can't access the REF CURSOR using Microsoft ODBC for Oracle Driver and it is possible to access by using ORA OLE DB Provider.
    I have installed Oracle Client in my machine and tried using ORA OLE DB Provider like below
    +con.ConnectionString = "Provider=OraOLEDB.Oracle.1;User ID=user_name;" & _+
    +"Password=pwd;Data Source=Oracle;"+
    The Excel worked fine in my machine but when I run the same Excel in my user machine in a different country I couldn't connect to DB.
    Because the user machine doesn't have Oracle Client installed. We have n number of users across the world and we can't install Oracle client individually.
    So, I have the plan of creating a DSN in a web sever as I used for Microsoft ODBC for Oracle Driver.
    But, my doubt is how can I create a DSN for accessing ORA OLE DB provider? Is there any driver for ORA OLE DB provider? or is there any alternate solution for my issue?
    Can anybody help me on this ASAP?
    Thanks & Regards,
    Satz

    I have created a DSN in a web server (a Public IP machine) that is mapped to a Oracle DB.
    In my Excel using VBA coding, with the help of RDO object I will call the DSN in the Web server using the connection string like "DSN=ORS;UID=SDATA;PWD=SDATA;"
    This is working fine and in this case the client machine doesn't need Oracle client to be installed or any TNS entry.
    The user can run the Excel report by clicking a button and the click event connects the DSN in the web server (through its URL) and routes to the mapped DB and fetches the quried data.
    Please note that the above DSN is created based on Microsoft ODBC for Oracle driver.
    But the issue is using the Microsoft ODBC for Oracle driver I couldnt call the SP with Ref Cursor.
    When I searched in Internet I came to know using the provider oraoledb.oracle we can call SP that uses REF CURSOR.
    Now my question is what is the driver name that I can use to create a DSN to make use of the provider oraoledb.oracle for calling the SP with REF CURSOR from Excel VBA coding ?
    Appreciate your prompt reply.
    Thanks & Regards,
    Sathish

  • Automatically create ODBC DSN connection with special port and password. Add-OdbcDsn cmdlet

    Hi,
    I first posted a question in the SQL forum but I'm posting it here instead because its a Powershell question.
    In a non-persitent VDI enviroment we are trying to automatically create a ODBC DSN connection to a SQL server.
    We are using Windows 8.1 so we also have Powershell 4 together with the add-odbcdsn cmdlet. 
    But when trying to add set -SetPropertyValue for network port different than default and a password we get an error.
    here is the command:
    Add-OdbcDsn -Name test -DriverName "SQL Server" -DsnType User -SetPropertyValue @("PWD=test", "SERVER=10.0.0.1")
    and here is the error message:
    Add-OdbcDsn : Attempt to set the {UID or PWD} key of a DSN. These keys should not be stored in the registry for securit
    y reason. Provide the credential information at runtime via SQLDriverConnect, SQLConnect or SQLBrowseConnect.
    At line:1 char:1
    + Add-OdbcDsn -Name test -DriverName "SQL Server" -DsnType User -SetPropertyValue @ ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidArgument: (MSFT_OdbcDsnTask:Root/Microsoft/...SFT_OdbcDsnTask) [Add-OdbcDsn], Cim
    Exception
    + FullyQualifiedErrorId : MI RESULT 4,Add-OdbcDsn
    NB!:  this command does not contain a port number, but when adding it without a password(PWD string) we just the default port.

    Hi Primeid,
    Agree with Jrv, we cannot store  UID and PWD in an ODBC datasource, For example, you can create a DSN using the user interface but if you look at the DSN stored in the registry the UID and PWD are not stored.
    ODBC it is always required when you connect using a DSN that the caller supply UID and PWD if they want to use standard login during connection time. 
    These similar discussion are for your reference:
    Creating ODBC DSN for SQL Native
    Client fails for not-integrated authentication
    is user name and password required in ODBC admin / User DSN?
    In addition, to read data from a SQL Server database using an ODBC DSN with SQL Authentication via powershell, please refer to this script:
    Open SQL database with ODBC DSN and SQL AuthenticationIf
    there is anything else regarding this issue, please feel free to post back.
    If you have any feedback on our support, please click here.
    Best Regards,
    Anna Wang
    TechNet Community Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • Creating JAR files programmatically

    I am trying to create JAR files programmatically using the java.util.zip and java.util.jar APIs. I am starting with just a set of directories containing .class files. I can seem to make the JAR but if I try to use any of the classes in it they don't work. But, if I unzip the JAR using WinZip, the classes are usable. So I am somehow building the JAR file incorrectly. Does anyone have any ideas or suggestions? The code is pretty long so I won't post it yet but I can send it to you if you'd like to see it. Contact by email if you'd like to see the code. Thanks.

    What paths are you encoding? Here are a couple of rules:
    1 - All paths are '/' separated, and do not begin with a '/'.
    2 - All paths are relative (see 1) and contain the exact package name of the class, plus the class.
    E.G., the class java.lang.Object would look like this in your jar:
    java/lang/Object.classNothing more or less.

  • Create ADF elements programmatically using Java

    Hello,
    I use JDeveloper 11.1.1.2.0 and Java 6 (of course)
    <f:view>
    <af:document title="Some Text" id="d1">
    <af:messages id="m1"/>
    <af:form id="f1">
    <af:panelGroupLayout layout="vertical" id="pgl1" halign="center">
    <af:outputText value="Song" id="ot1"/>
    <af:media source="/midi/song.midi"
    standbyText="Song sample" player="quicktime" id="m2"
    contentType="audio/x-midi"/>
    </af:panelGroupLayout>
    </af:form>
    </af:document>
    </f:view>
    I would like to create this construct programmatically. The reason is that I would like to create not only one <af:media> tag but more. But for some reasons it's not a fixed portion of songs I could anticipate. Therefore I want to take the construct above as a template and add more <af:media> tags I need at the moment I realize how many songs I want to play.
    I would like to call this construct from a command button or link on another side to open a new window in which the user could choose among different songs to play.
    Do I have to use DOM or XPath to setup this or is ADF able to offer some support ?
    Best regards
    Martin
    Edited by: user463656 on 05.05.2010 01:41

    Should be something like:
    <f:view>
    <af:document title="Some Text" id="d1">
    <af:messages id="m1"/>
    <af:form id="f1">
    <af:panelGroupLayout layout="vertical" id="pgl1" halign="center"  binding="#{ManagedBean.panelGroup}">
    <af:outputText value="Song" id="ot1"/>
    </af:panelGroupLayout>
    </af:form>
    </af:document>
    </f:view>And somewhere in the MagaedBean methods:
    public class ManagedBean{
    RichMedia rm;
    while .. {
    rm = new RichMedia();
    rm.setstandbyText(....);
    rm.setSource(....);
    panelGroup.getChildren().add(rm);
    }And then refresh the panelgroup with partialTrigger ot partialTarget.
    Edited by: Valhery on 2010-5-5 2:04

  • How to create an IDoc programmatically at Inbound side?

    Hi,
    How to create an IDoc programmatically at Inbound side?
    Assume that you have a file(material master details) which is enough to create master data.
    Regards,
    Thiyagu

    Read the documentation of this FM first:
    FU IDOC_INBOUND_ASYNCHRONOUS                                                                               
    K. tekst
                                                                                    IDoc inbound processing via tRFC                                                                               
    Functionality
                                                                                    This function module starts inbound processing in the case of port type    
        "tRFC". The function module is a successor to INBOUND_IDOC_PROCESS,        
        which processes IDocs in the Release 4.0 record types. If you are          
        processing IDocs in Release 3.X record types, the function module          
        INBOUND_IDOC_PROCESS must still be called.                                                                               
    The function module checks the ID 'EDI_MES' in authorization object        
        B_ALE_RECV against the received message type.                                                                               
    The IDocs are saved by the function module IDOC_INBOUND_WRITE_TO_DB (a     
        COMMIT for all IDocs) and then transferred directly to the application     
        by the dispatcher module IDOC_START_INBOUND.                                                                               
    Parameter
                                                                                    IDOC_CONTROL_REC_40                                                        
        IDOC_DATA_REC_40                                                                               
    Exceptions
                                                                                    Functiegroep                                                                               
    Edited by: Micky Oestreich on Jun 11, 2009 12:52 PM

  • Steps to create new DSN

    Hi Team,
    Kindly provide me the stpes to create new DSN in Unix as i am new to Essbase admin.

    Here a couple of links that should get you on your way
    SQL interface on linux 64
    http://download.oracle.com/docs/cd/E17236_01/epm.1112/esb_sql_interface/config_ds.html#Sq_ch02523068
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Creating af:showPopupBehavior programmatically

    Hello,
    How can I create <af:showPopupBehavior> programmatically in my managedBean?
    Let's say I have a commandMenuItem:
    <af:commandMenuItem text="Delete" id="cmi3">
    <af:showPopupBehavior popupId="p2"/>
    </af:commandMenuItem>
    I want to create this commandMenuItem in my managedBean. How can I add the showPopupBehavior to it?
    Thanks
    Shahe

    Hi shahe,
    in your managed bean create a Actionlistener method for command menu item , in that method add the following code
    RichPopup.PopupHints ph = new RichPopup.PopupHints();
    yourpopupname.show(ph);
    This will show popup when your Commandmenu item is clicked
    Note: yourpopupname is the popup binding created in the managed bean
    Thanks
    V T

  • How to create a dsn

    hi,
    i am on win xp sp2 pro, installed oracle 10g xe, i also have the odbc driver.
    i try to create a dsn and i try to test it i just displays a dialog box and just an ok button no messages nothing and then just closes down. and windows asks me to send error report
    how do i set up a dsn that works.?
    thanks bye
    typo error
    Message was edited by:
    user491518

    1) make sure XE database and XE listener are started, and HR user is unlocked.
    2) Open Microsoft ODBC manager
    Press "Add..." button in the "User DSN" tab
    Select "Oracle in XE" driver and press "Finish" button.
    In the "Oracle ODBC Driver configuration", enter:
    Data Source Name: XE
    TNS service name: XE
    user id: hr
    Press "test connection" button and enter password: hr
    You can use any other user as well.
    I tested it in Windows 2000 system - it worked.
    Edward

  • Unable to Create a DSN.

    Hi all,
    I am working on a client machine and it is Windows Server 2008 R2.
    I don't have privileges to re install the Oracle client in my machine.
    I am trying to create DWH tables into a schema from DAC using DSN.
    When i am trying to create a DSN using ODBC drivers, I am getting "D:\app\vbikkavolu\product\11.2.0\dbhome_1\BIN\sqoras32.dll" error.
    To Resolve this issue even i copied the sqora32s.dll from the other client (which is working fine) to current client in my machine, but no luck. Still getting the same error.
    Downloaded the latest sqoras32.dll from the oracle site, but getting the oracle drier could not be loaded error.
    Some folks are saying that we need to correct the registry entries for the current oracle client to resolve this issue.
    Could anyone please let me know what are the default registry values do i need to set close this issue.
    Thanks
    Ravikiran

    Melvin,
    Thanks, but I'm not running a JRun server, so updating the DD
    drivers won't help me out. I'm running WinXP Pro and IIS server in
    a development enviornment.
    I've updated to CF MX 7 and am still getting error messages.
    using (local) results in the following error message:
    Connection verification failed for data source: webquery
    java.sql.SQLException: [Macromedia][SQLServer JDBC
    Driver]Error establishing socket. Unknown host: (local)
    The root cause was that: java.sql.SQLException:
    [Macromedia][SQLServer JDBC Driver]Error establishing socket.
    Unknown host: (local)
    using localhost or 127.0.0.1 or using name of Server all
    result in the following error message:
    Connection verification failed for data source: webquery
    java.sql.SQLException: [Macromedia][SQLServer JDBC
    Driver]Could not establish a connection using integrated security:
    No LoginModules configured for JDBC_DRIVER_01
    The root cause was that: java.sql.SQLException:
    [Macromedia][SQLServer JDBC Driver]Could not establish a connection
    using integrated security: No LoginModules configured for
    JDBC_DRIVER_01
    I've developed sites in the past using access, CF/mysql and
    php/mysql; this is my first attempt at using MS-SQL.
    david

  • Creating dynamic dsn

    i want to create dynamic dsn i.e i have built a small package which is on a cd and i want that whoever installs the package will not have to set up the dsn .it will be setup automatically i.e anyone can use it
    how to do it

    It's been answered on this forum before - thank you, Thomas K.
    You can connect to Access without a DSN using a URL like this:
    Connection connection = DriverManager.getConnection("jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb)};DBQ=<full path to Access mdb file>");You don't have to create a DSN that way.
    Is that what you want? - MOD

  • Create Taskflow object programmatically

    Hi All:
    Could any one point me to any API that allows me to create Taskflow object programmatically?
    I would like to automatically create an Taskflow object that "wrap around" our object when the user drag n drop the object to an jspx page.
    Thanks

    Hi,
    Assuming that you are using ADF BC 11g and without fully knowing your case...
    I could say you could use ViewObjectImpl methods through your ApplicationModule..
    The methods are there.. and you will use them whenever you want.
    With this way you will not have to create any bindings programmatically..
    In fact, I am not certain if what you are asking is possible..
    However, here are some links that migh help you with the Binding Layer.
    http://www.oracle.com/technetwork/developer-tools/adf/learnmore/adfinsider-093342.html
    http://blogs.oracle.com/workingwithadf/entry/intro_to_adf_binding_layer
    http://download.oracle.com/otn_hosted_doc/jdeveloper/11gdemos/insiderBinding1/BindingsPart1.html
    http://download.oracle.com/otn_hosted_doc/jdeveloper/11gdemos/adfinsider-binding-internals-2/adfinsider-binding-internals-2.html
    Regards,
    Dimitris.

  • Create Check Box Programmatically

    Hi ALL
    Let me know how to Create Check Box Programmatically using table column.
    Thanking You
    Rehards
    Lakmal

    You can't create Forms widgets dynamically. What you have to do is create them at design time and then hide/unhide them at runtime using things like stacked canvases.
    Regards
    Grant Ronald

  • Creating ODBC DSN for SQL Server in LINUX

    Hi All,
    I am getting probelms in creating DSN for SQL server. I have created an entry in odbc.ini file under ODBC sources and provided the SQL server detiails as follows
    [ODBC Data Sources]
    AnalyticsWeb=Oracle BI Server
    Cluster=Oracle BI Server
    SSL_Sample=Oracle BI Server
    SQL_DB=DataDirect 5.1 SQL Server Wire Protocol
    [SQL_DB]
    Driver=/u01/OracleBI/odbc/lib/SEmsss23.so
    Description=DataDirect 5.1 SQL Server Wire Protocol
    Address=172:16:1:169, 1433;
    AlternateServers=
    AnsiNPW=Yes
    ConnectionRetryCount=0
    ConnectionRetryDelay=3
    Database=actdb/act7
    LoadBalancing=0
    LogonID=oracle
    Password=tiger
    QuoteID=No
    ReportCodePageConversionErrors=0
    When I test the connection ,i am getting the following error
    +[nQSError: 16023] The ODBC function has returned an error. The database may not be available, or the network may be down.+
    Can you please help in fixing this issue.I am not sure of the Drivers and the descrition that I am using are correct or not.
    Please let me know the process of creating the DSN for SQL server in LINUX and also how can we check the available drivers in LINUX?
    Thank You in advance,
    S1r1

    OBIEE does all of its data retrieval from the server. Your server needs to be able to query all of the data sources that you define.
    The client is irrelevant here, it's just a web browser consuming data that the BI Server returns to it.
    So yes you need to define connectivity from your Linux server to your SQL Server box.
    The Systems Requirements doc (http://download.oracle.com/docs/cd/E10415_01/doc/bi.1013/e10417.pdf) details DataDirect ODBC drivers that are provided for non-Widows connectivity to SQL Server

  • How to create user dsn for microsoft access driver(*.mdb,.*accdb) in 64 bit

    hi,
    how to create user dsn for microsodt access driver(*.mdb,*.accdb) using command line in 64 bit.
    i have installed 64 bit drivers and when use following command
    C:\Windows\System32>odbccad.exe CONFIGDSN "Microsoft Access Driver (*.mdb,*.accdb)" "DSN=GLDatabase|Description=GL Data Source|DBQ=C:\DataBase\1.mdb"
    CONFIGDSN:'unable to create a datasource for the "Microsoft Access Driver (*.mdb,*.accdb)" component not found in the registry with the error code -2147467259
    but it works with C:\Windows\SysWow64

    yes i have installed Microsoft Access Database engine 2010 redistributale => AccessDatabaseEngine_x64.exe
    i can able to create user dsn using odbccad32.exe in system32 folder but using command line its not working
    C:\Windows\System32>
    odbccad.exe CONFIGDSN "Microsoft Access Driver (*.mdb,*.accdb)" "DSN=GLDatabase|Description=GL Data Source|DBQ=C:\DataBase\1.mdb"
    CONFIGDSN:'unable to create a datasource for the "Microsoft Access Driver (*.mdb,*.accdb)" component not found in the registry with the error code -2147467259

Maybe you are looking for

  • Adobe Reader 6 and windows 8.1

    i recently bought a new laptop and it has windows 8.1.  i have always preferred to use Adobe Reader 6 because i can delete pages, insert pages, etc.  problem is it won't work with 8.1.  how do i get the new adobe reader to do what i used to be able t

  • Generic Extraction Problem

    HI There, I am trying to creat grneric extractor (with Table) on MBEW table .while i saving it is not saving.it is showing some some error . *ERROR IS Diagnosis You tried to generate an extract structure with the template structure MBEW. This operati

  • Why im not getting my security questions reset email ?

    i created my apple id a long time ago , and i forgot my security questions anwsers and my apple id is constantly asking for them ! i tried resetting by email and the destination email is correct but im not getting any mail what so ever ! what should

  • Dynamically change Database, Server and Command From VB6

    I have a crystal report which connects to an iSeries box via an OLE DB datasource, however i need to have this same report conect to two different iSeries, with the tables for the sql (command) located in two different libraries. Is it possible to ch

  • How can I install Gimp for pictures effects ? They say i can't cause it's not an apple product ! :(

    How can I install GIMP for pictures effects ?  They say I couldn't cause it's not an apple product ?