Brand newbie question on database connection

I'm brand new to Oracle databasing and am having trouble figuring out how to set up a connection to an existing database. Specifically, I'm not clear at all about the use of the tnsname.ora file. What I'm trying to do is set up a connection using an .asp page to connect to this database. I'm using :
     objConnect.Open ("Provider=MSDASQL;DRIVER={Microsoft ODBC for Oracle};Server=F12_PROD_MARS.WORLD;UID=FLGI;PWD=FLGI")
[/CODE]
Which gives me the "ORA-12154: TNS:could not resolve service name" error. I know the information that I need in my tnsname.ora file is:F12_PROD_MARS =
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=
(PROTOCOL=TCP)
(Host=172.31.xx.xx)
(Port=1521)
(ADDRESS=
(PROTOCOL=TCP)
(Host=172.31.xx.xx)
(Port=1526)
(CONNECT_DATA=
(SID=MARS)
I don't know where the tnsname.ora file is supposed to be located or how to reference it from .asp or anything like that though. The only database connection experience I have is with my own access databases, but none trying to connect to someone elses oracle db. Any help at all or a link to some kind of starters guide would be much appreciated. Also, I downloaded pl/sql developer, but I cannot log on to that either. I don't know if its the same connection issue here, but I know my user/pass for the server is correct, what do I enter for database, so that the application knows where to go? Thanks again... -ST

objConnect.Open ("Provider=MSDASQL;DRIVER={Microsoft
t ODBC for
Oracle};Server=F12_PROD_MARS.WORLD;UID=FLGI;PWD=FLGI")I take it you have the Oracle Client installed on the web app server i.e. where the MS ODBC driver lives
ODBC now looks for tns name "f12_prod_mars.world" ...
Which gives me the "ORA-12154: TNS:could not resolve service name" error.
I know the information that I need in my tnsname.ora file is:
F12_PROD_MARS =
... because it looks for that name, including .world, and cant find it. Name "f12_prod_mars" is not the same name, obviously. (like test.com and test.se are different)
I don't know where the tnsname.ora file is supposed
to be located or how to reference it from .asp orWhere is it located now? If you search the harddrives for tnsnames.ora, what do you get?
connection issue here, but I know my user/pass for
the server is correct, what do I enter for database,
so that the application knows where to go? ThanksIf an app, like sql*plus, is asking for "Database:" it often means you give the tns name (=the alias for the tns connect descriptor, which is the thing with lots of ('s and )'s) :)
Message was edited by:
orafad

Similar Messages

  • Design question for database connection in multithreaded socket-server

    Dear community,
    I am programming a multithreaded socket server. The server creates a new thread for each connection.
    The threads and several objects witch are instanced by each thread have to access database-connectivity. Therefore I implemented factory class which administer database connection in a pool. At this point I have a design question.
    How should I access the connections from the threads? There are two options:
    a) Should I implement in my server class a new method like "getDatabaseConnection" which calls the factory class and returns a pooled connection to the database? In this case each object has to know the server-object and have to call this method in order to get a database connection. That could become very complex as I have to safe a instance of the server object in each object ...
    b) Should I develop a static method in my factory class so that each thread could get a database connection by calling the static method of the factory?
    Thank you very much for your answer!
    Kind regards,
    Dak
    Message was edited by:
    dakger

    So your suggestion is to use a static method from a
    central class. But those static-methods are not realy
    object oriented, are they?There's only one static method, and that's getInstance
    If I use singleton pattern, I only create one
    instance of the database pooling class in order to
    cionfigure it (driver, access data to database and so
    on). The threads use than a static method of this
    class to get database connection?They use a static method to get the pool instance, getConnection is not static.
    Kaj

  • Question regarding Database Connection.

    Normally, after we open a database connection, we could use the Connection.close() method to close and return database connection back to a connection pool.
    What would happen if I nullify the connection without using the close() method to close a database connection?
    Would the database connection automatically close after I nullify it?
    If not, how the connection going to return back to the connection pool?

    The connection will close/be released automatically when the garbage collector runs, but you should NEVER rely on that because you never know when the GC will run or if it will collect all objects or only part of them. Best approach is to always have a finally block where you close/release the connection.
    Alin.

  • Newbie questions about Database replication, "backups", and sql version

    Just created my first Sql Database using the "SQL Database Management Portal". A blast but three questions come to mind:
    1. Is this DB automatically
    "replicated"? (In other words,  is DB "failover" or clustering,  a feature of all newly created Azure databases?) 
    2. Our on-premise model is to make a daily DB backup which is saved to a nightly tape. If needed, we can restore a two-month old database backup under a new name to compare it with the current one. Does Sql Azure support this capability
    or not? Can it be requested?
    3.  Which on-premise version of sql is "Sql Azure" closest to? (2014?)
    TIA,
    edm2
    P.S. My database was created using the "web" edition.

    Hi edm,
    According to your description, you create a SQL Azure database in Azure platform. The replication feature is not supported by Microsoft Azure SQL database. If you want to sync the SQL Azure database and local database, you can use SQL Azure Data Sync service.
    For more information, see:
    http://blogs.technet.com/b/the_cloud_pilot/archive/2011/10/24/your-first-sql-azure-data-sync-step-by-step.aspx
    In addition, if you have Web or Business Edition databases, you must create your own backup strategy. You can use database copy or Import and Export services to create copies of the data and export the file to an Microsoft Azure storage account. Meanwile,
    Windows Azure SQL Database provides a mechanism for automating the process for exporting a database to BACPAC files on a set interval and frequency. For more information, see:
    Schedule an Automated Export:
    http://msdn.microsoft.com/en-us/library/hh335292.aspx#automate
    Windows Azure SQL Database Backup and Restore strategy:
    http://www.mssqltips.com/sqlservertip/3057/windows-azure-sql-database-backup-and-restore-strategy/
    Currently, Azure uses a special version of Microsoft SQL Server as its backend. It provides high availability by storing multiple copies of databases, elastic scale and rapid provisioning, when we check the version of SQL Server, it shows as follows.
    Microsoft SQL Azure (RTM) - 11.0.9216.62
    Regards,
    Sofiya Li
    If you have any feedback on our support, please click
    here.
    Sofiya Li
    TechNet Community Support

  • Newbie question: can I connect an USB external HD to an iPad?

    Hi,
    I'm still deciding if I should buy an iPad or not and one of the questions I have is if I can connect an USB external HD to an iPad.
    Can you help me please?
    Thanks

    abarrote wrote:
    one of the questions I have is if I can connect an USB external HD to an iPad.
    no.
    JGG

  • NEWBIE question - no wireless connection required, do I 'turn off' Airport?

    Hello,
    Today I have purchased my first ever MAC. (IMAC 20/2.0/1GB/250GB/SD-GBR)
    When I set this up I want it to work on my ethernet wired LAN, should I 'turn off' the Airport Express thing ?
    I do not have wireless, and am not likely to have.
    Any suggestions ?

    Yeah, turn off your wireless. It won't stop you from connecting to your ethernet, macs search for available connections and connect to them in the order of priority you set in your networks preferences - but even if airport is highest, it will still find your ethernet and use that if no airport is available.
    So you could leave it on and it would make no difference, but I say turn it off because airport uses power! Save the planet.

  • ODI database connection - session question

    Hi,
    I have a package, where I have used a procedure.
    In my procedure, I open a database connection.
    My question is - In my next procedure - will I be able to use my same database connection which I created in previous step?
    Re-phrasing the question - for any number of database transaction happening in a package, will ODI opens multiple database connection per step or will there be only one single database connection?
    Thank you,
    Paras

    I believe its one per session so one connection inside the package. I think you should be , although i have not tried it practically.

  • Database Connection design question

    Hello, I have a design question. Awhile back I needed to create a database connection to SQL Server, so I created a class to do it
    import java.sql.*;
    import java.io.*;
    import java.net.MalformedURLException;
    import org.w3c.dom.Document;
    import org.w3c.dom.*;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import org.xml.sax.SAXException;
    import org.xml.sax.SAXParseException;
    public class SQLServerConnection
         private static Connection connection = null;
         public SQLServerConnection(String user, String password, String dbName) throws java.sql.SQLException
              getDBConnection(user, password, dbName);
         public SQLServerConnection(String configFileName) throws java.sql.SQLException
              getDBConnection(configFileName);
         private void getDBConnection(String user, String password, String dbName) throws java.sql.SQLException
             DriverManager.registerDriver(new com.microsoft.jdbc.sqlserver.SQLServerDriver());
             connection = DriverManager.getConnection(
                  "jdbc:microsoft:sqlserver:" + dbName, user, password);              
         private void getDBConnection(String configFileName) throws java.sql.SQLException
              String user;
              String password;
              String dbName;
              try
                   DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
                   DocumentBuilder db = factory.newDocumentBuilder();
                   Document doc = db.parse(configFileName);
                   doc.getDocumentElement().normalize();
                   // get the configuration information
                   password = getConfigParameter("password", doc);
                   user = getConfigParameter("username", doc);
                   dbName = getConfigParameter("databasename", doc);
                   getDBConnection(user, password, dbName);
              catch (MalformedURLException murle)
                   System.out.println("Unable to connect to: " + configFileName + " -- " + murle);
                   System.exit(1);
              catch (FileNotFoundException fnfe)
                   System.out.println("Configuration file " + configFileName + " not found.");
                   System.exit(1);
              catch (IOException ioe)
                   System.out.println("IOException: " + ioe);
                   System.exit(1);
              catch (javax.xml.parsers.ParserConfigurationException pce)
                   System.out.println ("Parser Configuration Error: " + pce);
              catch (SAXException saxe)
                   System.out.println ("SAXException: " + saxe);
         private String getConfigParameter(String paramName, org.w3c.dom.Document doc)
              NodeList nl = doc.getElementsByTagName(paramName);
              if(nl != null)
                   Node n = null;
                   for (int i = 0; i < nl.getLength(); i++)
                        n = nl.item(i);          
                        if(n.hasChildNodes())
                             NodeList children = n.getChildNodes();
                             return ((Node)children.item(0)).getNodeValue();
              else
                   System.out.println ("nl is null");
              return "";          
         public void setCatalog(String catalogName) throws java.sql.SQLException
              connection.setCatalog(catalogName);
         public Connection getConnection()
              return connection;
         public void closeConnection()
              try
                   connection.close();
              catch(java.sql.SQLException sqle)
                   System.err.println ("SQL Server Connection failed to close: " + sqle);
    }Later on, I needed to do the same thing for MySQL, so I created a class for that, MySQLServerConnection which is exactly the same as above, except for:
    private void getDBConnection(String user, String password, String dbName) throws java.sql.SQLException
              try
                   Class.forName("com.mysql.jdbc.Driver").newInstance();
                   connection = DriverManager.getConnection(dbName, user, password);     
              catch(java.lang.ClassNotFoundException cnfe)
                   System.out.println (cnfe);
              catch(java.lang.InstantiationException ie)
                   System.out.println (ie);
              catch(java.lang.IllegalAccessException iae)
                   System.out.println (iae);
         }Later, on, I did the same thing with OracleServerConnection. My question is, I know this is probably not optimal code. For example, I didn't originally have a close connection method, so I had to go in and code one for all 3. I'm assuming that an interface would be a good idea so that if I have to code another database connection class I make sure and include all of the appropriate methods. I'm also assuming that it would have been smart to have a master class, maybe something like DatabaseConnection and extended these classes from that. Am I on the right track? Totally offbase?

    @nclow - I will work on trying the Factory Pattern for this over the weekend and post when I finish to see what you think.
    @abillconsl - just to make sure I understand, you're saying that I just try to connect and it will cycle through the different database connection possibilities and connect when it finds the right one? If it fails all 3, log an appropriate message. One question I have about this is, I thought I was being object oriented by separating the different types of db connections (Oracle, SQL Server, MySql) into different classes. Am I missing the point of OOP by what I was/am trying to accomplish? Going overboard? Also, does your way try and connect to all 3 even if I connected to one already?
    Thx, Grantarchy
    Edited by: grantarchy on May 9, 2008 9:50 PM

  • Questions about the database connection

    hi all,
    I am developing a project with JDeveloper 10g and I created a database connection to my Oracle RAC database.
    However, whenever I start the project with the JDeveloper and I do a "netstat -an" with the command prompt window. I show there are over 100 connection ESTABLISHED to my database. I don't have any idea how this happens. The problem is since there are over 100 connection established, I couldn't run the project with the JDeveloper's embedded OC4J.
    Can anyone help me to fix this problem?

    I have set the Max connections to 30 in the connection-pool setting of my project in the Embedded OC4J Server Preferences, but it doesn't work.
    There are still over 100 connections to the database...

  • Deploy form, question about database object or connection parameters

    When form to be deployed to the dev/test/production environment, should it be compiled with that specific database connection username, password and sid? Another words, when I compile the database objects created for the compile is embedded in the .fmx file?
    thanks for help

    You won't need to compile your forms if the passwords of the target schema differs. It also doesn't matter on what platform/architecture the database server runs on. However it would matter how you created your schema objects. And of course it will matter if the platform your forms run on differ. The list of "what you need to do when you don't want to compile against the target database" is a long one.
    Here is a short list of don'ts
    - no +select * from [...]+ views
    - no +select * from [...]+ in forms cursors and the like
    - %TYPE is evil
    - %ROWTYPE is much more evil
    Those are just a few obvious things developers can mess up. Of course we all know that this sort of things are bad programming practice but they do happen. And as said: that's just the most obvious things. I work for a vendor where only the compiled files are shipped to the customer, and the road to this goal is a hard and bumpy one. If you don't want bad surprises in production I suggest you implement a fixed build process routine and a fixed upgrade process where you can ensure that the target database where the forms run against match exactly the development database you compile your forms from a logical point of view. The far easier exit is to just compile your forms on the target platform against the target database but I understand that this is not always possible.
    cheers

  • Hi i am newbie to Database connectting technology

    Hi i am using SQL server instead of Oracle,but i have lack of experience in making database connection to SQL Server from Java.Could you anybody please help me,and give me a best example with code.

    There are some examples in the help files that come with the jdbc driver: [http://msdn.microsoft.com/data/jdbc/]

  • Database connectivity question?

    when I select the OLE DB provider is "microsoft OLE DB provider for
    ODBC Drivers",I can write to database,but I can't read from database
    using data connectivity toolkit?
    but when I select the OLE DB provider is "microsoft JET 4.0 OLE DB
    provider"
    that's no problem.i don't known why?
    thank you in advance!
    [email protected]

    ebarker wrote in message news:<[email protected]>...
    > Please look at the
    > href="http://www.ni.com/pdf/manuals/321525c.pdf">LabVIEW Database
    > Connectivity User Manual, specifically chaper 2, as it explains in
    > great detail the differences between the two different providers.
    > Good luck!
    I have saw LabVIEW Database Connectivity User Manual,I can't get some
    useful information.
    when I select the OLE DB provider is "microsoft OLE DB provider for
    ODBC Drivers",I can write to database,but I can't read from database
    using data connectivity toolkit?I stored data in access database (.db
    file) and i use the SQL language:
    SELECT * FROM motor WHERE serial="aaa"
    the error is :
    "error-21472179
    04 occurred at conn Execute.vi-fetch record.vi(myvi).
    possible reasons:
    Invlid string:specified field does not exist or contains an
    unsupported character"
    but when I select the OLE DB provider is "microsoft JET 4.0 OLE DB
    provider" ,i can read the record using the same language.

  • Create database connection  once.

    a newbie's Question. I want to create a database connection in a jsp file just once so that when a user hits the same jsp, the connection is not needed to be recreate until he/she leaves the page or shut it down. thanks.

    bad design.
    connections don't belong in jsps. they should be checked in and out of a container-managed connection pool by a java bean that interacts with the database on behalf of the client. not the right way to do it.
    %

  • RV042G Newbie Questions

    I have the new Cisco RV042G router, and I have just a few "newbie questions" about it as I get started using it:
    The firmware on board is v4.2.1.02. Since this is a brand new router, is that the latest firmware?
    Under Time>DST Dates, what do I need to configure in there? I'm in the US, Central Time.
    I want to use Back to My Mac from iCloud (formerly MobileMe). Under the iCloud preferances pane on my Mac, it's saying: "Back to My Mac may be slow because NAT Port Mapping (NAT-PMP) or Universal Plug and Play (UPnP) is turned off on your router. Turn on NAT-PMP or UPnP." What should I enable on my router in order for Back to My Mac to better function?
    I'm using a VOIP phone on the network (only 1 device with a couple phones). Are there any QoS settings I should tweak for better performance of my VOIP phone? I did change the port the VOIP phone is connected to to High (instead of Normal) under Port Settings. Will this help boost performance?
    I also want to setup a VLAN on a port for guests to access the Internet, but not have any access to my personal network. Here's the steps I've done so far. Is this sufficient or is there anything else I need to do?
    I went to Setup>Network, enabled Multiple Subnets.
    I added 192.168.254.1/255.255.255.0 as a subnet.
    I went to Port Management>Port Setup, set the port I wanted to use (Port 4) to VLAN2.
    I went to Firewall>Access Rules, added two rules:
    Deny All Traffic from 192.168.254.0 to 192.168.1.0.
    Deny All Traffic from 192.168.1.0 to 192.168.1.0.
    Thanks everyone for your help!

    Easy.  just goto the DHCP field and fill in the Static DHCP fields.
    Assigning static IP addresses by adding devices from a list
    Click Show unknown MAC addresses. The IP & MAC binding list appears. If the web browser displays a message about the pop-up window, allow the blocked content.
    The devices are listed by the IP address and the MAC address. (Typically the MAC address appears on a label on the bottom panel or back panel of a device.) If needed, you can clickRefresh to update the data.To select a device, first enter a descriptive Name. Then check the Enable box. Alternatively, select all devices in the list by clicking the check box at the top of the Enable column.
    Click OK to add the devices to the Static IP list, or click Close to close the pop-up window without adding the selected devices. After you click OK, a message appears. The message includes important information. Read it before clicking OK. Keep the browser open and wait until the selected MAC addresses appear in the Static IP list.
    Modify or remove list entries, as needed:
    To modify the settings: Click a device in the list. The information appears in the text fields. Make the changes, and then click Update. If you do not need to make changes, you can click Add New to de-select the entry and clear the text fields.
    To delete an entry from the list: Click the entry that you want to delete, and then clickDelete. To select a block of entries, click the first entry, hold down the Shift key, and then click the final entry in the block. To select individual entries, press the Ctrl key while clicking each entry. To de-select an entry, press the Ctrl key while clicking the entry.
    Assigning static IP addresses by entering devices manuallyIn the Static IP Address section, add or edit entries as needed. Remember that the settings are not saved until you click the Save button.
    To add a new device to the list: Enter the following information, and then click Add to list.
    Static IP Address: Enter the static IP address. You can enter 0.0.0.0 if you want the router to assign a static IP address to the device.
    MAC Address: Enter the MAC address of the device. (Typically the MAC address appears on a label on the bottom panel or the back panel of a device.) Enter the address without punctuation.
    Name: Enter a descriptive name for the device.
    Enable: Check this box to assign the static IP address to this device.
    To add another new entry: Enter the information, and then click Add to list.
    To modify the settings: Click a device in the list. The information appears in the text fields. Make the changes, and then click Update. If you do not need to make changes, you can clickAdd New to de-select the entry and clear the text fields.
    To delete an entry from the list: Click the entry that you want to delete, and then click Delete. To select a block of entries, click the first entry, hold down the Shift key, and then click the final entry in the block. To select individual entries, press the Ctrl key while clicking each entry. To de-select an entry, press the Ctrl key while clicking the entry.
    Using the Static IP List to Block Devices
    You can use the Static IP list to control access to your network. You can block access by devices that are not on the list or do not have the correct IP address.
    Add devices to the Static IP list as described in Static IP Addresses.
    Enable or disable the following features:
    Block MAC address on the list with wrong IP address: Check this box to prevent a computer from accessing your network if its IP address has been changed. For example, if you previously assigned a static IP address of 192.168.1.100 and someone configures the device to use 192.168.149, the device will not be allowed to connect to your network. This feature discourages users from changing their device IP addresses without your permission. Uncheck the box to allow access regardless of the current IP address assignment.
    Block MAC address not on the list: Check this box to block access from devices that are not included in the Static IP list. This feature prevents unknown devices from accessing your network. Uncheck the box to allow access by any connected device that is configured with an IP address in the correct range.
    Hope that helps.
    Regards Simon
    http://www.linksysinfo.org

  • Question: 10gR2 database can not see the 11gR2 ASM diskgroup?

    Hi there,
    env:
    uname -rm
    2.6.18-92.1.22.el5xen x86_64
    Single server(non-RAC)
    note: we don't want to upgrade 10gr2 database into 11gR2 yet. But we created the 11gR2 ASM, then a 11gr2 database on ASM, and plan to migrate datafile in 10gR2 database to 11gR2 ASM
    1. oracle 10gR2 installed first version: 10.2.0.3.0
    2. then install 11gR2 Grid Infrastructure, and created ASM (version 11gr2)
    $ sqlplus / as sysasm
    SQL*Plus: Release 11.2.0.1.0 Production on Tue Oct 19 10:30:56 2010
    Copyright (c) 1982, 2009, Oracle. All rights reserved.
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    With the Automatic Storage Management option
    SQL> col name form a15
    SQL> col COMPATIBILITY form a15
    SQL> col DATABASE_COMPATIBILITY form a15
    SQL> l
    1* select name , STATE, COMPATIBILITY, DATABASE_COMPATIBILITY from v$asm_diskgroup
    SQL> /
    NAME STATE COMPATIBILITY DATABASE_COMPAT
    ORCL_DATA1 MOUNTED 11.2.0.0.0 10.1.0.0.0
    ORA_DATA MOUNTED 10.1.0.0.0 10.1.0.0.0
    3. in 10gR2 database
    sqlplus /
    SQL*Plus: Release 10.2.0.3.0 - Production on Tue Oct 19 12:12:31 2010
    Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
    With the Partitioning and Data Mining options
    SQL> select * from v$asm_diskgroup;
    no rows selected
    4. pin the node into css
    # /u01/app/product/11.2.0/grid/bin/crsctl pin css -n mynodename
    CRS-4000: Command Pin failed, or completed with errors.
    Question: 10gR2 database can not see the 11gR2 ASM diskgroup?
    please help
    Thanks
    Scott

    What is the output of
    olsnodes -t -n
    Also, see unix error log and ohasd error log if you find anything in that

Maybe you are looking for

  • Hyperlink failure on last pages of PDF (exported from InDesignCS)

    Per Bill@VT from the Acrobat Forum, I'm posting my Acrobat/InDesign question here as well. I thank you in advance for any possible assistance: Hello. I have a 211-page catalog I've created in InDesign CS in which I have created hundreds of Hyperlinks

  • What's with new Fireworks CS4 update?

    After years of neglect finally CS4 gets a 100MB update, but what exactly are the updates? What has changed? I went to adobe.com and nothing did I see; how is that even possible?! Can someone give us a rundown of the update? Does it address any of the

  • Multiple IP Addres one NIC Card..

    So I found this article on Apple http://developer.apple.com/server/optimizexserve.html Unfortunately it did not work on 10.4 and if you look at the date on that, it would be 2003 so I was wondering how you do this? I have 15 IP's coming to my XServe

  • Faces data missing; how to recover?

    About 2 months ago, I verified my back-ups, wiped my drive, and did a fresh install of everything on my MacBook Pro. Many problems were solved, and all was well -- including with my iPhoto library -- until today. Although I don't access Faces often,

  • Creating a bean within another bean and JNDI

    Hello, I am trying to have one bean (a session bean) create another bean (entity bean). I keep getting a naming exception. Both beans are deployed in the same JAR file. Also, I can directly create the entity bean (from a client test app). Here is the