Getting database name in JDEV 10.1.3.4 programmatically?

Hello:
Is there a way get the database name I am accessing and show it on a web page?
Thanks

Usual question back to you, what technologies within JDev are you using? ADF BC, EJB etc etc.
There's probably some way to get it off a Jdbc Connection. Alternatively just write a query against the database such as:
Select name from v$database;
or
Select database_name from dual;
or
Selct global_name from global_name;
If memory serves me correctly these don't necessarily work in all versions of the database. Check which works for you.
CM.

Similar Messages

  • Get database name

    Hello,
    I am using JDev 11.1.1.4.0.
    One of a requirement for me is to send email notification to a group of users. While composing a message, the subject should prefix with the database name. For instance, if the message is about a new Employee being added, the subject should read like this:
    "HR: New employee has been added"
    Is there a way to get the name of DB without executing sql query "SELECT ORA_DATABASE_NAME FROM DUAL"?
    If there isn't, do I have to create a new VO just for this?
    Thanks,
    Joonsup

    Hi,
    you create a public method in the AM Impl class and expose it as a client method. Then use the code below
        public String getDatabaseInformation(){
            DBTransaction dbTransaction = (DBTransaction) this.getTransaction();
            PreparedStatement prepStatement = dbTransaction.createPreparedStatement("select * from dual", 0);
            try {
              String dbSchema = prepStatement.getConnection().getMetaData().getUserName();
              String connectURL = prepStatement.getConnection().getMetaData().getURL();
              //returns schema_name@host:port:sid         
              return dbSchema + connectURL.substring(connectURL.indexOf("@")-1);
            } catch (SQLException e) {
                e.printStackTrace();
          return null;
        }This way the information is accessible from the web client and from ADF BC model itself
    Frank
    Edited by: Frank Nimphius on Aug 2, 2011 5:02 PM

  • How to get database name

    How do i get the database name in reports. we can get this in form by get_application_property, do we have anything like that in reports
    thanks

    Check the database dictionary tables.
    sys.v_$parameter certainly contains a parameter with the name 'db_name'and the value of the database name.
    see what you get when you run:
    select * from sys.v_$parameter where name='db_name'
    If the user running the report won't have the select priviledge on sys.v_$parameter, then you will have to create a function that returns the value for the db_name parameter (that is in the schema of a user that has that priviledge) and grant execute on it to the user that runs the report and create a synonym for that function.

  • How to get Database name/IP address of the database server from forms10g

    Hi everybody,
    How do I get the database instance name and IP address of the database server?
    I am using Foms 10g and the database server is Oracle 10g.
    Sukanta

    Dear...........
    Plz use this code
    select SYS_CONTEXT('USERENV', 'IP_ADDRESS', 15) ipaddr from dual;
    SELECT utl_inaddr.get_host_address IP ,UTL_INADDR.get_host_name NAME FROM dual;
    select SYS_CONTEXT('USERENV', 'HOST') HELLO from dual;
    select SYS_CONTEXT('USERENV', 'TERMINAL') HELLO from dual;
    select SYS_CONTEXT('USERENV', 'OS_USER') HELLO from dual;
    SELECT SYS_CONTEXT ('USERENV', 'SESSION_USER') FROM DUAL;
    SELECT SYS_CONTEXT ('USERENV', 'DB_UNIQUE_NAME') FROM DUAL;
    thx.

  • How to know database name and schema name by providing package name?

    Hi,
    Could someonw will help me to get database name and schema name by providing package name ?
    I have used the query : select * from all_objects where object_name='Package_name'; but it simply returns schema name where as i need DB name and username.
    --Prajakta

    but it simply returns schema name where as i need DB name and username.
    i want to retrive the DB name for package name
    Based on your questions, I wonder if you are used to working in SQL Server? (The server, database, and schema are part of the 4-part  name of an object, independent of any user.)
    In SQL Server, schema and username are two separate physical concepts.  "Schema" is purely logical in Oracle: a user which owns objects is often called a "schema".
    In Oracle, "database" is roughly equivalent to the SQL Server concept  "server" (what you log in to).  It is not part of the naming path to a specific object  (unless there is a database link involved, but there is no indication that's what you have here).  In Oracle you connect to an Instance (or Service) and people often call this the "database", but there is a fine semantic distinction there (separate topic). 
    Once connected in Oracle, you fully-qualify an object by only a 2-part owner and object name (possibly 3-part if a database link is involved user.object@link).
    12c added another wrinkle to all of this, but I'll assume this question was more basic than that, because you likely would have mentioned if this was a 12c question.

  • Why do I get a class conflict between the Prepare SQL.vi and the Get Column Name.vi with the SQL Toolkit compatibility vis from the Database Connectivity Toolkit?

    I have done extensive programming with the SQL Toolkit with LabVIEW versions through 6.1. My customer now wants to upgrade to Windows 7, so I am trying to upgrade to LabVIEW 2009 (my latest purchased version) using the Database Connectivity Toolkit, and the SQL Toolkit Compatibility vis. Everything seemed to be going okay with the higher level SQL operations, but I ran into trouble with the Get Column Name.vi. 
    The pictures below show the problem. The original SQL Toolkit connected the Prepare SQL.vi with the Get Column Name.vi with a cluster of two references, one for connection, and one for sql. The new compatibility vis have a class conflict in the wire because the Prepare SQL.vi contains a cluster with connection, and command references, but the Get Column Name.vi expects a cluster with connection and recordset references. 
    How do I resolve this conflict?
    Thank You.
    Dan

    I've never worked with the old version of the toolkit, so I don't know how it did things, but looking inside the SQL prep VI, it only generates a command, and the the column name VI wants a recordset. I'm not super familiar with all the internals of ADO, but my understanding is that is standard - you only have the columns after you execute the command and get the recordset back. What you can apparently do here is insert the Execute Prepared SQL VI in the middle and that will return what you need.
    I'm not sure why it worked before. Maybe the execute was hidden inside the prep VI or maybe you can get the column names out of the command object before execution. In general, I would recommend considering switching to the newer VIs.
    Try to take over the world!

  • How can I get a list of database names from environment

    Hi,
    How can I get a list of database names from environment.
    I had found a method in JE API Docs named Environment.getDatabaseNames(), and i couldn't found the same method in Berkeley DB.
    I use java interface, is it supported?
    Thanks.

    Hello,
    I don't know if it would work for you, but have you checked the db_archive utility at:
    http://download.oracle.com/docs/cd/E17076_01/html/api_reference/C/db_archive.html
    Check the -s option.
    Thanks,
    Sandra

  • How can I get a report to use a DSN instead of a database name?

    DSNs are great things.  By using a DSN in a database connection string, you don't have to worry about what happens if you have to look at a different database, or if a database name changes.  All you have to do is change the database the DSN points to, and everything that was built using that DSN still works.
    Everything, that is, except Crystal Reports.
    I am using CR XI.  Our customer's database is named "Anneal", and it uses PostgreSQL.  I have several copies of that database, taken at different times and for different purposes, on my machine:  "Anneal", "AnnealTest", "Anneal_2_8_10", and on and on.  I also have a DSN named "WinCaps".  The reorts I have developed for this customer were set up to use an ODBC connection based on the WinCaps DSN.  But if WinCaps pointed to the "AnnealTest" database when it the report was created, and then I delete the AnnealTest database and change the WinCaps DSN to point to a database named "Anneal", and then try to open the report, I get a complaint that the AnnealTest database does not exist!  Yes, I know it doesn't exist.  I am expecting CR to use the DSN I told it to use, which should get me to the Anneal database.
    The fact that CR complains about the AnnealTest database tells me that internally, CR is retrieving the actual name of the database and storing that instead of storing the DSN name, completely defeating the purpose of the DSN.
    Is there any way I can set up my report to use whatever database the DSN happens to be pointing to, instead of the database the DSN pointed to at design time?
    Thanks very much!
    Rob Richardson

    Hi Rob,
    Crystal assumes you are setting location to the database and it stays that way when run. Yes we do keep the connection info in the RPT file.
    There's a few options that may help. First, can you upgrade to CR XI R2? It' still supported...
    Go to this link: http://www.sdn.sap.com/irj/boc and download the trial version of CR XI R2 and use your XI keycode, then apply the patches which you can get to by clicking on the BusinessObjects tab above, then Downloads.
    Direct link to the Trial version: http://www.sap.com/solutions/sapbusinessobjects/sme/freetrials/index.epx
    Second, in the report itself check on the Verify on first refresh, save the report and then test it on another PC connecting another database.
    Next option to to try these registry key changes, usual warnign about altering the registry:
    HKEY_CURRENT_USERSoftwareBusiness ObjectsSuite 11.0Crystal ReportsDatabaseOptions - VerifyWhenDBDriverUpgraded = Yes
    And try changing this one also - DontAutoConvertODBC = Yes
    Close the Designer first or your changes won't stay.
    THey may have to simply verify the data manually and then save the report so the updated location info is saved in the Report.
    Crystal is very database dependant obviously so asumming changes made to the DSN are automatically updated can cause a lot of issues for the end user also but it depends on your point of view. We consider this working as expected.
    Thank you
    Don

  • How to get Database Vendor Name or Database Type...

    Hello,
    Is it possible to get the vendor or database from jdbc connection?
    Or maybe from the loaded Driver Class...
    The classpath and the jdbcurl seems not to be the right way
    Greetings & Thanks
    Peter

    void printDBInfo(Connection con) {
       try {
          DatabaseMetaData conMD = con.getMetaData();
          System.out.println("Driver Name: " + conMD.getDriverName());
          System.out.println("Driver Version: " + conMD.getDriverVersion());
          System.out.println("Database Name: " + conMD.getDatabaseProductName());
          System.out.println("Database Version: " + conMD.getDatabaseMajorVersion());
       } catch (Exception ex) {
          ex.printStackTrace();
    }

  • How to compare 2 different database to get table name which are not present in second database

    How to compare 2 different database to get table name which are not present in second database

    Sorry cannot test it right now
    use db1
    go
    select * from sys.tables t where not exists
    (select * from db2.sys.tables s where t.object_id=s.object_id)
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Getting column names empty from MS Access database

    Hi,
    I have MS Access intalled in my desktop.I am using aveConnect jdbc driver to connect to MS Access database.
    I am trying to retrieve all the table name and column names of respective tables .
    But when i get column name as empty string when i try to retrieve the column name of a table.
    here is the sample code i use.
    I am getting the column count of a particular table and type of the column.
    It would be nice if some could help me .
    ResultSet ColumnData = meta.getColumns(null, null, "TBLACCOUNT", null);
                   System.out.println( "ColumnData:" +ColumnData);
                   if (ColumnData!= null) {
                        System.out.println("ColumnData not null");
                        ResultSetMetaData rsmd = ColumnData.getMetaData();
                        int columnCount = rsmd.getColumnCount();
                        String columnName = rsmd.getColumnName(1);
                        String columnType = rsmd.getColumnTypeName(1);
                        System.out.println("columnCount is " +columnCount);
                        System.out.println("The name of the first column is: " +columnName);
                        System.out.println("The data type of the first column is: " +columnType);
    thanks
    sheeba

    You're here in a JDBC forum, not a SQL forum. I suggest you to start learning SQL and come back once you have JDBC issues.
    Here is a list of links to all SQL tutorials available on the Internet.
    http://www.google.com/search?q=sql+tutorial

  • Get the database name

    Hai,
    Iam currently logged onto oracle without any DBA privileges and want to know the database name. Please let me know how can i find it.
    Thanks.

    if u have "Select Any Table" privilege to your database user in which u logged in then fire the below query.
    Select name from v$database;

  • Error: The specified mailbox database [Mailbox Database Name] does not exist, when you try to export mailbox in Exchange 2007

    [Symptom]
    ======================
    In Exchange 2007, when you want to export mailbox to a .pst file, you should run the
    Export-Mailbox cmdlet from a 32-bit computer that has the following installed:
    The 32-bit version of the Exchange management tools
    Microsoft Office Outlook 2003 SP2 or later versions
    If not, you may encounter the following error message:
    You check that you have these required installed, but you get the error below when you run Export-Mailbox in EMS.
    “The specified mailbox database [Mailbox Database Name] does not exist.”
    [Cause Analysis]
    =======================================
    This is because that the account you use to run Export-Mailbox cmdlet don’t have the Exchange Server Administrator role assigned.
    You can check if this account has been delegated the Exchange Server Administrator role through the following path.
    EMC -> Organization Configuration-> Check permissions in the result pane.
    To delegate this Exchange Server Administrator role, right click on the
    Organization Configuration node and choose Add Exchange Administrator,
    you will see the Add Exchange Administrator window.
    [More Information]
    ==============================
    Export-Mailbox
    http://technet.microsoft.com/en-gb/library/aa998579(v=exchg.80).aspx
    How to Export and Import mailboxes to PST files in Exchange 2007 SP1
    http://blogs.technet.com/b/exchange/archive/2007/04/13/3401913.aspx
    Exchange 2007 cannot export pst files via its powershell
    http://social.technet.microsoft.com/Forums/forefront/en-US/b3bc0dce-35f3-4a69-9a33-4f2a855b9f94/exchange-2007-cannot-export-pst-files-via-its-powershell?forum=exchangesvrgenerallegacy
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

    Hi,
    Based on my test, if you make the user the owner of the database (rather than a user with the db_owner role), when you create a query, it creates it under the dbo schema rather than DOMAIN\username.
    Steps to do so (in Management Studio):
    Right click database, select Properties 
    Click File 
    Change Owner in the textbox 
    OK to confirm 
    Downside - other users under db_owner role will still have their username appended. So schemas have to be created for these users.
    Jaynet Zhang
    TechNet Community Support

  • How to get the name of current monitor?

    I have a script which is used to get some application data. The script take parameters such as "LOB" so it can query data for different department. When it found something, it raise an event in event log.
    Therefore this script is used by several different monitors. Each monitor calls the script by passing different parameters. To better understand the event was created by which monitor, I want the script can get the name of monitor which calling it and they
    list it in the event log too. 
    Currently, I am passing $MPElement$ as one script parameter so I can get the monitor's GUID. Then get the name by running powershell command. Is there an easier way to get the monitor name? Thanks!

    The best way to do this is to put the monitor name as a property bag in the script and pass that to your event details. Otherwise, we're looking at querying the database each time the monitor generates an event, and this is overhead that is really not
    necessary. The other option, which is just even worse in terms of performance, is to use powershell to query the SDK for the monitor name. Both of these options are not going to be a good solution, because now you need to implement action accounts that can
    either query the database or the sdk.
    Jonathan Almquist | SCOMskills, LLC (http://scomskills.com)

  • ITunes 11.4.0.18 will not get track names for imported mp3 albums.

    I'm new to Apple (Windows 7 i7 Sandy Bridge processor 16GB ram) and recently got an iPod touch 5g 64GB and I am trying to figure out iTunes.  I have GB's of albums that I have collected over the years in mp3 format.  When I imported them to iTunes via...File>Add Folder to Library...It imported all of my albums, but, almost NONE of the tracks are in order and they are "scattered" for lack of a better word.  Some are with the albums they are supposed to be with, but MOST made their own names and albums.  Getting the tracks with the albums I fixed by doing it manually.  Getting the tracks in order in the albums...HELP.  I tried to "Get Track Names", but iTunes comes back with "iTunes cannot get CD track names for songs that were not imported using iTunes.  To allow iTunes to look for CD track names for this song, import the song again using iTunes."????  I'm assuming that iTunes will only get the track names if they are imported from CD only and not mp3?  If I have to manually enter all of the information in myself....God help me...just leave it unorganized???

    When iTunes imports a CD it records the information used to look up the album in the Gracenotes database. When you add your tracks into a different library that data is no longer available. See Grouping tracks into albums for some tips on organizing iTunes content.
    tt2

Maybe you are looking for

  • Windows Server 2008 black screen with mouse *PLEASE HELP*

    Hello fellow techs, I have been tearing my hair out for the past 12hrs on this issue. About 3 weeks ago, one of our clients reported that they were experiencing issues on the network so one of the staff went into the server room and noticed the scree

  • Email notifications have stopped and unable to re-...

    Email notifications have stopped for 3 accounts where I need to print the bills for company records.  Despite emailing and phoning the bills are still not coming through.  I could log on to see the bills, but am no longer able to do this.  I have tri

  • Can i sync with windows media player?

    Am i able to sync music to my ipod with windows Media player? or do i have to use itunes?

  • Is there not an easier way to find missing songs?

    Is there a smarter way to find missing songs and albums besides having to go through each one individually? Some kind of batch process would be nice... How do you guys efficiently find missing songs or albums?

  • IDA (intrusion detection APP) for my mac

    Is there an app that starts recording or snaps pics when someone tries to login and get the password wrong ???? also whats the IR sensor in the front for ?