Changing default database used by ODBC programmatically

Hi,
I have a report that I'm using ODBC to connect with and it can be run against one of two databases.  I am  unable to get it to point to any database other than the default set in the DSN.  I have tried setting the database in the ConnectionInfo object but still points to the default.
Thanks,
Steve

HI,
Sorry for not providing more information.  II'm using CR2008 and Visual Basic 2008.
The code i'm  using is similar to what is in the sample code:
Dim newreport As New frmReportViewer
        Dim DataVariables As DataVariablesType
        DataVariables = DataUtility.GetDataVariables
        Dim crtableLogoninfos As New TableLogOnInfos
        Dim crtableLogoninfo As New TableLogOnInfo
        Dim crConnectionInfo As New ConnectionInfo
        Dim CrTables As Tables
        Dim CrTable As Table
        With crConnectionInfo
            .ServerName = DataUtility.GetDataVariables.dsn
            .DatabaseName = DataUtility.GetDataVariables.Catalog
            .UserID = DataUtility.GetDataVariables.UserId
            .Password = DataUtility.GetDataVariables.Password
        End With
        CrTables = rptDoc.Database.Tables
        For Each CrTable In CrTables
            crtableLogoninfo = CrTable.LogOnInfo
            crtableLogoninfo.ConnectionInfo = crConnectionInfo
            CrTable.ApplyLogOnInfo(crtableLogoninfo)
        Next
        If rptDoc.Subreports.Count > 0 Then
            For count As Integer = 0 To rptDoc.Subreports.Count - 1
                CrTables = rptDoc.Subreports(count).Database.Tables
                For Each CrTable In CrTables
                    crtableLogoninfo = CrTable.LogOnInfo
                    crtableLogoninfo.ConnectionInfo = crConnectionInfo
                    CrTable.ApplyLogOnInfo(crtableLogoninfo)
                Next
            Next
        End If
        newreport.rptViewer.ReportSource = rptDoc
        newreport.Show()
I have steped through the code and the database name, userid, password , server name are being picked up properly.
I am sending the name of the DSN for the Server Name and instead of the default database I am passing the name of a test database.  When the report is displayed, the data is being retrieved from the production databse instead o f test.

Similar Messages

  • Changing default database and application passwords

    Hi,
    We have default passwords for our newly configured Oracle ERP (R12).
    I have a concern regarding the changing of default password. Does changing the default passwords will have any effect on normal working of ERP and database.
    I know that we shouldn't change default APPLSYSPUB password. What about the following default passwords?
    a) Default accounts having default password in database (DBA_USERS):
    CTX SYS
    OLAPSYS
    DBSNMP
    DMSYS
    GL (oracle users .e.g AP, GL, AR)
    APPLSYSPUB
    OUTLN
    PERFSTAT
    SYS
    b) Default accounts present in Oracle Application (FND_USERS) :
    IBE_GUEST
    OP_CUST_CARE_ADMIN
    ASGADM
    MOBILEADM
    APPSMGR
    IBEGUEST
    OP_SYSADMIN
    AUTOINSTALL
    WIZARD
    IEXADMIN
    ASGUEST
    IBE_ADMIN
    ERP version : 12.1.2
    Database Version: 11.2.0.1
    Thanks in advance.
    Regards,
    Gaurav

    Hi Gaurav,
    Yes as stated by Srini, It's highly recommended that you change tyhe default password in order to safeguard your instance by outside threats.
    But please be cautious as you cant change these accounts as "alter user <username> identified by <new password>", but rather use FNDCPASS utility. I advice you to check on the TEST system before implementing on the PROD instance if you dont have prior experience using FNDCPSAS.
    Please also refer notes:
    How to Change Applications Passwords using Applications Schema Password Change Utility (FNDCPASS or AFPASSWD) (Doc ID 437260.1)
    FNDCPASS Troubleshooting Guide For Login and Changing Applications Passwords (Doc ID 1306938.1)
    How to change passwords to include special characters using FNDCPASS (Doc ID 1336479.1)
    FNDCPASS Utility New Feature: Enhance Security With Non-Reversible Hash Password (Doc ID 457166.1)
    Also see forum search:
    Forum Search: FNDCPASS
    Hope this helps!
    Best Regards

  • Not able to connect to database using Oracle ODBC Driver

    Hi,
    I have installed Oracle client on a system. there are 2 homes installed. When I check the ODBC administrator, I see that only one ODBC driver is present. There are Net 8 services configured in both the homes.
    When I try to connect to a database with the services configured in the second home using the ODBC driver, I am getting an error that the TNS name could not be resolved.
    How can I use the ODBC driver to connect to the databases using services defined in the second home?
    The name of the ODBC driver is 'Oracle in <firsthomename>
    Thanks & Regards

    Hi,
    Thanks for the help.
    I tried this, but it doesn't work. I'm still getting the error.
    Now I am not able to create a DSN when I set the ORACLE_PATH to the second home. It says 'the setup routines for the Oracle in ora1 ODBC Driver could not be loaded due to system error code 998.'
    Any other solution?
    Thanks in advance & Regards
    Anuja

  • Change default database during export

    Hi,
    I have installed 2 databases, db1 and db2. First, installed db1, then installed db2. I wanted to export a table from db1, then export the table to db2. I tried to do this by exp and imp at dos prompt. I found that the default database is db2. I want to know how to set the default database to db1? Hope anyone can answer me.
    Thanks
    Best regards,
    Collin

    Hi,
    To get the problem cleared,
    Is you situation looks like this ?
    Source :
    database : db1
    user : db1
    default tablespace : db1
    Destination :
    database : db2
    user : db2
    default tablespace db2
    If so, you can;
    Create a tablespace db1 and set default tablespace of user db2 to db1.
    alter user db2 default tablespace db1;
    Then do the import;
    imp ...... fromuser=san touser=san;
    Regards.

  • Change default gateway using *netipaddress* cmdlet

    Hi, is there a way to change the DFG after the IP is assigned to an adapter?
    I am using Server 2012. I created a new IP using "new-netipaddress -Ipaddress 1.2.3.4 -prefixlength 24 -interfaceindex 10". I have forgotten to add the -defaultgateway parameter in the command. IP address was sucessfully assigned, but I cannot figure out
    a way to change/add a default gateway.
    Does anyone know how to do it via native powershell cmdlets (no gwmi, functions or scripts)?
    Cheers

    I am having a similar problem and using Remove-NetIPAddress does not really help. Remove-NetIPAddress does not affect gateway settings and gateways remain assigned to the net adapter. Furthermore, after I use RemoveNetIPAddress cmdlet, the NetTCPIP\Get-NetIPConfiguration
    cmdlet starts producing a non-terminating error. Here is a repro script:
    PS C:\> $IPAddress = '192.168.0.1'
    PS C:\> $DefaultGateway = '192.168.0.1'
    PS C:\>
    PS C:\> # Enumerate NIC configurations.
    PS C:\> $networks = NetTCPIP\Get-NetIPConfiguration
    Exception setting "NetProfile": "Cannot convert the "System.Object[]" value of type "System.Object[]" to type
    "Microsoft.Management.Infrastructure.CimInstance"."
    At C:\Windows\system32\WindowsPowerShell\v1.0\Modules\NetTCPIP\NetIPConfiguration.psm1:128 char:13
    +             $IPConfig.NetProfile = Get-NetConnectionProfile -InterfaceAlias $IfA ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [], SetValueInvocationException
        + FullyQualifiedErrorId : ExceptionWhenSetting
    PS C:\> # Look for NIC that is not on corpnet.
    PS C:\> $privateNetwork = $networks | ? { $_.IPv4Address.PrefixOrigin -ne 'Dhcp'}
    PS C:\> $privateNetworkName = $privateNetwork.InterfaceAlias
    PS C:\> $privateNic = NetAdapter\Get-NetAdapter -Name $privateNetworkName
    PS C:\> $privateNic | NetTCPIP\Set-NetIPInterface -Dhcp Disabled
    PS C:\> $privateNic | NetTCPIP\Remove-NetIPAddress -Confirm:$false
    PS C:\> $privateNic | NetTCPIP\New-NetIPAddress -IPAddress $IPAddress -PrefixLength 24 -DefaultGateway $DefaultGateway
    NetTCPIP\New-NetIPAddress : Instance DefaultGateway already exists
    At line:1 char:15
    + $privateNic | NetTCPIP\New-NetIPAddress -IPAddress $IPAddress -PrefixLength 24 - ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidArgument: (MSFT_NetIPAddress:ROOT/StandardCimv2/MSFT_NetIPAddress) [New-NetIPAddr
       ess], CimException
        + FullyQualifiedErrorId : Windows System Error 87,New-NetIPAddress

  • Changing default printer using CVI

    Hi All,
    I am currently developing a project using CVI 5.0.1. In this project I
    would like to allow the user to change the default printer or select the
    printer to print to.
    Can anyone help?
    Richard

    Use SetPrintAttribute on the Printer Name attribute and specify the name of
    the printer in your printer setup.
    Best Regards,
    Chris Matthews
    Measurement Studio Support Manager
    "RBL" wrote:
    >Hi All,>>I am currently developing a project using CVI 5.0.1. In this project
    I>would like to allow the user to change the default printer or select the>printer
    to print to.>>Can anyone help?>>Richard>>

  • I want to connect SAP HANA database (Default database) using JDBC connection URL.

    I am using trial account .at sap cloud server.
    What will be my URL of SAP HANA database for Trail account.
    For ex:
    java.sql.Connection conn= java.sql.DriverManager.getConnection("jdbc:sap://<YOUR SAP HANA IP>:host","<YOUR SAP HANA USER>","<YOUR PASSWORD>");
    I had User and password but what supposed to be used in place of IP and Host ?

    Thanks .But iwant to use like this ..and below properties are not working
    repliesd as connectin refused -813
    please help onthis
    <bean id="dataSource"
          class="org.springframework.jdbc.datasource.DriverManagerDataSource">
          <property name="driverClassName" value="com.sap.db.jdbc.Driver"/>
          <property name="url" value="jdbc:sap://localhost:30015/?currrentschema=TestSchema" />
          <property name="username" value="p1940828544"/>
          <property name="password" value="[email protected]"/>
       </bean>

  • Change default port used for FlexUnit reports

    Good day,
    I have recently set up a CruiseControl server that runs two concurrent builds. Most of these builds contain FlexUnit tests. I am well aware that the default port for FlexUnit task is 1024 and I know that only one listener can access the port at one time. I tried passing a different port number but the flexunit task hangs. So, I was wondering if anyone has tried changing the default port to something other than 1024.

    Hi Michael,
    I created a bug for tracking, as you requested (https://bugs.adobe.com/jira/browse/FXU-153).

  • Changing Content Database using Powershell

    Hi,
    I have a web application created. I have a another content DB, which I want to associate to the existing web application.
    I mean, the existing content db should be removed and the new Content db attached.
    What are the steps to achieve the same using powershell?
    Thanks

    Hi,
    For your issue, you can
    Dismount-SPContentDatabase and Mount-SPContentDatabase.
    A typical command to detach a database would be:
    Dismount-SPContentDatabase -Identity <contentdb>
    A typical command to attach a content database would be:
    Mount-SPContentDatabase -Name <contentdb> -DatabaseServer <dbserver> -WebApplication <webappname>
    Here is a link about
    Managing SharePoint Content Databases with PowerShell, you can use as a reference:
    http://www.mssqltips.com/sqlservertip/2608/managing-sharepoint-content-databases-with-powershell/
    Best Regards,
    Lisa Chen
    Forum 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 Subscriber Support, contact [email protected]

  • Change default program used when sd card installed

    When I insert an SD card in my Macbook Pro containing RAW Images, my Nikon program opens (auto play) to import the photos. My preference would be to have Adobe Lightroom open by default instead.

    Launch iPhone -> Preferences -> General -> Connecting Camera opens: <put the app you want in here>
    Also look at iPhone -> Preferences -> Advanced -> Edit Photos: <put the app you want in here>

  • JSP connected to MS Access using JDBC-ODBC

    If I want to run a jsp file connected to a MS Access database using jdbc-odbc bridge.
    I thought that I should use the following code to make the connection:
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    String database = "jdbc:odbc:Driver={Microsoft Access Driver(*.mdb)}; DBQ=http://myComputerName:8080/examples/jsp/DatabaseTest/mydatabase.mdb;DriverID=22;READONLY=fals";
    sqlca = DriverManager.getConnection(database, "dba","sql");
    but Tomcat 4.1 produces many errors.
    The file runs fine when I determine the complete path and include the local drive (C://) of the database Like the following:
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    String database = "jdbc:odbc:Driver={Microsoft Access Driver(*.mdb)};
    DBQ=C:/Tomcat4.1/webapps/examples/jsp/DatabaseTest/mydatabase.mdb;DriverID=22;READONLY=fals";
    sqlca = DriverManager.getConnection(database, "dba","sql");
    Of course I do not want to use the second code because I want to use my computer as a host.
    I will appreciate any answer!

    Yes, using the DSN, it works fine.
    But, I think it will run from the drive C.
    I want to use my computer as a host. So, I think that I should include the name of the computer in the path.
    I do not know may I am confused.
    I appreciate your reply. Thanks!

  • How to change  default unit on Database 11g

    Hi All
    I'm using Oracle Database 11g Enterprise Edition Release 11.1.0.6.0.
    If I define my column:
    USERID VACHAR2(8) --> Default USERID VACHAR2(8 BYTE)
    How can I change default unit BYTE to CHAR as the following
    USERID VACHAR2(8) --> Default USERID VACHAR(8 CHAR)
    Thanks alot
    Thiensu2810

    I have set Database system with the following SQL:
    alter system set nls_length_semantics=char;
    alter session set nls_length_semantics=char;
    But, It does not match.
    And when I insert data, the following error occured.
    SQL> insert into binhtest values('初期化パ');
    ORA-12899: value too large for column string (actual: 12, maximum: 8)
    I've checked value of NLS_LENGTH_SEMANTICS, it is CHAR
    SQL>SHOW PARAMETER NLS_LENGTH;
    NAME | TYPE | VALUE
    NLS_LENGTH_SEMANTICS | String

  • Changing default SQL database within Teststand

    I am designing a "universal" test system for a variety of my company's products.
    The test results are supposed to be logged to a MS SQL (2008) database. I've created two databases for two different products. Let's call them OneTestDB and TwoTestDB for now.
    No problems so far. Now, I want to use a user, TestLogin, to write the test data to the both of my databases, however, TestLogin can seems only to be able to write to the DB set as default.
    I could solve the problem by using different users, but since I want it to be possible for the same user to test different products, I would prefer to avoid this.
    After searching the net for an answer I found that that what I'm trying to do is done by the query "EXEC sp_defaultdb 'USER', 'DATABASE'. (Would USE {DATABASE} work as well?)
    The database name is given at runtime. (DATABASE = StationGlobals.ProductName + "TestDB")
    Here is my question: how , and where, to put that code into Teststand (2010 SP1) so that I can change the database to which I want to save the test results?
    I have been trying to use the database tools given in Teststand, but obviously I am not doing it the right way.
    Solved!
    Go to Solution.

    I managed to fix it myself.
    The solution was the following SQL statement "EXEC sp_defaultdb 'TestLogin', '" + StationGlobals.ProductName + "TestDB'"
    If someone has a better idea how to solve the issue, feel free to enlighten me.

  • How to change default value in a table using ALTER TABLE

    Hi,
    How to change default value in a table
    I have a table TEST which has 2 fields CODE of Datatype VARCHAR2(10) and Indicator as VARCHAR2(1).
    I want to change the default value using ALTER TABLE TEST of field Indicator to 'I'.
    Any help will be needful for me
    Thanks and Regards

    user598986 wrote:
    Hi,
    How to change default value in a table
    I have a table TEST which has 2 fields CODE of Datatype VARCHAR2(10) and Indicator as VARCHAR2(1).
    I want to change the default value using ALTER TABLE TEST of field Indicator to 'I'.
    ALTER TABLE  test
    MODIFY (indicator DEFAULT 'I'); 
    Incidentally, INDICATOR is a keyword in Oracle, so you may have problems using it as a column name. If so, you'll have to enclose the column name in double-quotes, and be careful to use capital letters inside the quotes.
    Edited by: Frank Kulash on Aug 26, 2009 11:42 AM

  • How can I connect to the database using ODBC within excel.

    Hi,
    How can I connect to the database using ODBC within excel and just refresh the data when needed.
    Thanks,
    Priyanka
    Edited by: user554934 on Jun 9, 2009 2:53 AM

    This is NOT an APEX relevant question, try posting it in the SQL/PL/SQL Forum..
    Thank you,
    Tony Miller
    Webster, TX

Maybe you are looking for