Results 1 to 9 of 9

Thread: Connecting to an Oracle DB through SID

  1. #1

    Default Connecting to an Oracle DB through SID

    I want to connect to an Oracle database, through a SID. The problem is, I can't find a configuration to do it. We used to connect to an Oracle DB on IP and Port, but it should be SID now.

    Can someone help me correct this configuration:
    Code:
    <bean id="geoDataSource" class="org.apache.commons.dbcp.BasicDataSource">
    	<property name="driverClassName" value="oracle.jdbc.OracleDriver" />
    	<property name="url" value="jdbc:oracle:thin:@(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = XXX.XXX.XXX.XXX)(PORT = XXX))(ADDRESS = (PROTOCOL = TCP)(HOST = XXX.XXX.XXX.XXX)(PORT = XXX))(LOAD_BALANCE = yes)(CONNECT_DATA =(SERVICE_NAME = SERVICE_NAME)))" />
    	<property name="username" value="USER_NAME" />
    	<property name="password" value="PASSWORD" />
    </bean>
    Last edited by Bjorn121; Oct 25th, 2007 at 07:35 AM.

  2. #2

    Default

    I found this link: http://www.jguru.com/faq/view.jsp?EID=444466 and I changed it to jdbc: oracle:thin: @localhost:1521:SID, but that doesn't work either.

    Error:
    Io exception: The Network Adapter could not establish the connection

    If anybody has some advice, feel free to share it .

  3. #3
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,632

    Default

    Well obviously the database cannot be accessed, do you run your database locally with the given SID? Or is it on another server?
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  4. #4

    Default

    It's on another server. I want to connect to a client, which knows where the database is located, so I don't have to use magic with an IP as a wand. The problem is that no matter what configuration I use, it always fails.

    I've been looking at it all day, but I can't find a solution.

  5. #5
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,632

    Default

    1. Make sure the oracle client is running/installed on your local machine
    2. Not sure of the client listens on 1521

    We use a remote client with pretty much the same configuration...
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  6. #6

    Default

    Client is running, because other applications use the same client. If it wouldn't be up, I think a lot of clients would be calling right now .

    I used 1521 en 1621 and no result thus far. What is your configuration, if I may ask? Just erase the sensitive data.

  7. #7
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,632

    Default

    Which configuration do you mean? My jdbc url?

    Code:
    jdbc:oracle:thin@[server]:1521:[SID]
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  8. #8

    Default

    I assume that server is the server where the client is installed? Just to be sure.

  9. #9
    Join Date
    Aug 2004
    Location
    Saskatoon SK Canada
    Posts
    29

    Default

    Quote Originally Posted by Bjorn121 View Post
    It's on another server. I want to connect to a client, which knows where the database is located, so I don't have to use magic with an IP as a wand. The problem is that no matter what configuration I use, it always fails.
    I'm not entirely sure I understand your configuration, but it sounds like you want your application on machine A to connect to a database on machine B. If that is the case, then the connection string in the application will have to have a server name/ip address in it. I suppose you could use a generic server name and redirect that name to the proper server using the localhosts file on machine A. Another alternative would be to use Oracle Names (or whatever it is Oracle is calling it now).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •