How to connect the database (JDBC) using service name rather than SID

How should we make the connection to the database using service name. Initially, we are using the SID to make the database connection, with following setting in the data-source.xml in OC4J using ABCDB as the SID.
<data-sources>
     <data-source
          class="com.evermind.sql.DriverManagerDataSource"
          name="jdbc/ABCDB"
          location="jdbc/ABCDB"
          pooled-location="jdbc/OracleDSPooled"
          xa-location="jdbc/xa/OracleDSXA"
          connection-driver="oracle.jdbc.driver.OracleDriver"
          username="ABC"
          password="ABC"
          url="jdbc:oracle:thin:@191.1.4.126:1521:ABCDB"
     />
</data-sources>
It work, but now we need to make the connection using this service name ABCSERVICE, but it doesn't work in the OC4J (JDBC). May I know how should we handle this connection?
Thanks and Regards,
Pang

Finally, I got the solution to make the database connection using service name, with putting the tnsname setting in URL portion.
url="jdbc:oracle:thin:@(description=(address=(host=191.1.4.126)(protocol=tcp)(port=1521))(connect_data=(SERVICE_NAME = ABCSERVICE)))"
And now, it is working fine.
Regards,
Pang

Similar Messages

  • How to connect to database in web service??

    Hi all,
    How to connect to database in web service ? Can anyone give some advice what kind of database should i use? thanks

    No difference. Just connect as usual!
    Let me give you an example:
    Code to connect to postgresql db ...
    public Connection connectPostgresql(String servername, String dbname, String username, String password)
              Connection conn = null;
              try
                        // Load the JDBC driver
                        String driverName = "org.postgresql.Driver";
                        Class.forName(driverName);
                        // Create a connection to the database
                        String url = "jdbc:postgresql://" + servername +  "/" + dbname;
                        conn = DriverManager.getConnection(url, username, password);
                        return conn;               
              catch (ClassNotFoundException e)
                        // Could not find the database driver
                        return conn;
              catch (SQLException e)
                        // Could not connect to the database
                        return conn;
    }Code for an axis web service ...
    public Element[] updateProfile(Element[] params)
              String message = "";
              // get str 1
              Node node1 = params[0].getFirstChild();
              String str1= node1.getNodeValue();
              // get str 2
              Node node2 = params[1].getFirstChild();
              String str2= node2.getNodeValue();
              Connection conn = connectPostgresql ("localhost","myDatabase","myUsername","myPassword");
              // there is a method to insert these params to db
              boolean isInserted = insertParams(conn, str1, str2);
              if(isInserted )
                        message = "OK";
              else
                        message = "Not OK";
              // constructs an array of DOM Elements for message to send back to client
              SOAPBodyElement[] response = new SOAPBodyElement[1];
              response[0] = new SOAPBodyElement(XMLUtils.StringToElement("urn:foo", "e1", message));
              return response;
    }Gokce.

  • Issue while creating connection pool in weblogic using SERVICE NAME

    Found two issues while creating connection pool in weblogic using SERVICE NAME
    1. While running apps from jdeveloper using xxx-jdbc.xml
    weblogic.common.ResourceException: Could not create pool connection. The DBMS driver exception was: Io exception: The Network Adapter could not establish the connection
         at weblogic.jdbc.common.internal.ConnectionEnvFactory.createResource(ConnectionEnvFactory.java:253)
         at weblogic.common.resourcepool.ResourcePoolImpl.makeResources(ResourcePoolImpl.java:1109)
         at weblogic.common.resourcepool.ResourcePoolImpl.makeResources(ResourcePoolImpl.java:1033)
         at weblogic.common.resourcepool.ResourcePoolImpl.start(ResourcePoolImpl.java:214)
         at weblogic.jdbc.common.internal.ConnectionPool.doStart(ConnectionPool.java:1051)
    2. Configuriing the jndi in Weblogic server
    weblogic.common.ResourceException: Could not create pool connection. The DBMS driver exception was: Listener refused the connection with the following error:
    ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
    The Connection descriptor used by the client was:
    localhost:1521:SERVICENAME
         at weblogic.jdbc.common.internal.ConnectionEnvFactory.createResource(ConnectionEnvFactory.java:253)
         at weblogic.common.resourcepool.ResourcePoolImpl.makeResources(ResourcePoolImpl.java:1109)
         at weblogic.common.resourcepool.ResourcePoolImpl.makeResources(ResourcePoolImpl.java:1033)
    Problem
    database url is generated based on SID
    eg: jdbc:oracle:thin:@localhost:1521:SID
    Solution
    (generate seperate url for SERVICE NAME)
    jdbc:oracle:thin:@localhost:1521/SERVICENAME
    ------------------------

    It is so clear: host not found error for network connection and the other SID servcie name not found means your oracle instance name is not up. check with srvctl status for given servcie name or node, else check CRS_Stat -t if you are using RAC.

  • How to connect the database?

    I'm new for oracle developer/2000.
    I installed oracle database 8i in windows 2000 server side, installed developer 6i forms builder in windows(NT) 2000 professional client side. That is all I was done.
    I start forms builder, but I can not connect the database from forms builder.(I configured NET8,and i can connect the database using NET8)
    Please help me.What should I do next? installing more software? installing server side or client side? more configuring? what else?
    Thank you in advance.

    Hi,
    This is not a question particular to portal applications. It should be posted on the general forum. Anyway, please check
    if you have configured the tnsnames.ora on your client machine. You should have an entry for the db connection there.
    Thanks,
    Sharmila

  • Does any body know how to connect the fingerprint scanner using jmf is it p

    Hai,
    I am not getting how to connect the fingerprint scanner how we can do it is it possible for device independent application
    If any body knows anything about this please mail me its very urgent for me
    hope u will be able to tell me something about this .
    Regards
    K Naveen Kumar

    Hi,
    Fingerprint scanners are not popular enough devices to be supported by Java yet. There's no general API or Java interface for it.
    Each manufacturer of a fingerprint device will probably just ship their own drivers or SDKs. More than likely DLL's, so you'd need to write some JNI to call them.
    If you want to allow your application to work with multiple devices, you will have to design it to do that. Ie. write a general "Fingerprint" interface, and write a class which implements that interface for each device you want to support.
    Eg.
    public interface FingerPrintAPI
         public void initialiseScanner ( )
                throws MyScannerException;
         public byte[] getFingerPrint ( )
                throws MyScannerException;
         public double getMatchProbability ( byte[] fingerprint1, byte[] fingerprint2 )
                throws MyScannerException;
         public void closeScanner ( )
                throws MyScannerException;
    }I haven't used a fingerprint device at all, but that's how I would approach it.
    regards,
    Owen

  • How to tell AE CS6 to use bundled Mocha rather than Pro?

    I recently upgraded my bundled Mocha from AE CS6 to Mocha Pro 4, but for some unknown reason, it won't let me export shape data in Mocha.  There seems to be no data at all, as even trying to paste in Notepad results in nothing.  Tracking data, however, works fine (both in AE and Notepad).
    Since I cannot figure out any solution in Mocha, the only thing I can do is use bundled Mocha rather than Pro... but I do not know how to tell AE to use bundled Mocha rather than Pro when I click 'Track In Mocha' (...a setting which was changed when Pro was installed).
    Does anyone know where/how I can switch it to Mocha bundled when you click on Track In Mocha?  (or, does anyone have any idea why Pro would not export shape data, whereas the same project in bundled Mocha did?)
    If anyone has any answers or theories, please let me know ASAP, as I have a project I'm trying to complete, and (as luck always has it) the weekend is now upon us, and support is closed over the weekend.

    I tried connecting MBP and TC via Ethernet - after verifying the settings that you suggested - and it does not work: if I turn Airport off, Time Machine says it can't find the TC
    Any other sugestions?
    Ok, then ethernet is not getting an ip address from the TC and is plugged in wrongly..
    You still didn't give me any idea of what actual model the linksys is.. and why is it in the network.. Is it a modem router?? If you have cable internet just throw it away and use the TC.
    If you have the linksys as modem, then bridge it.. turn off wireless and run pppoe client on the TC.
    If the ISP does not allow pppoe client mode then simply use the TC in bridge. Turn off all wireless in the linksys and just use the TC.
    Still need info on how everything is setup to analyse the problem.

  • How to Connect Oracle Database without using TNS entry

    Hi,
    i need to connect Oracle Database server from my pc without using the TNS entry. How to do that?
    Regards,
    007

    You have marked the question as answered, so it means you can answer my questions:
    1.How do i check that i can make easy connect to the server or not, I mean is it configured on Server ?
    2.Can I make connection with easy connect without having Net Services software installed on the client ?
    3.What if I am not able to access sqlnet.ora ?
    4.Is there any difference in connect string, which is based upon OS for easy connect ?
    5.How do i use global database name, if it is configured ?
    6.What are pros and cons of using easy connect ?
    7....
    20....
    I think this are those 20 questions which John is talking about.
    Regards
    Girish Sharma

  • How to connect the database from one ip to another ip pc.?

    hai,
    iam new to the obiee. i have the database in the ip : 198.0.0.0(for ex) and i have to connect that through the odbc to my pc ip: 198.0.0.1 (for ex). plz explain how we can connect to the other database from our pc to import that database to our administrator tool in bi.
    thanks in advance,

    hi...
    install client software in your machine
    perform, listener configuration using net configuration assistant,
    Now using this listener name, you create a DSN and use it in rpd,, you want to develope
    OR
    go to ODBC Data Source & Administrator and add DSN with Microsoft ODBC for Oracle
    in server field, you write your parent machine\listenername
    and use this in rpd... i hope the second one works out...

  • How to connect Oracle Database by using OID

    Hi,
    I am testing Oracle Directory Manager Version 10.1.4.0.1. I want to authenticate users with LDAP then connect to the database. Is there any step by step documentation how I could configure the OID?
    I have read OID administration guide Version 10.1.4.0.1. and I did not see clear explanation.
    Thank you

    Hi,
    During the oracle client windows installation, you need to select administrator option. Make sure you include Enterprise Security Manager. After the installation, you need to run net manager to establish database connection.
    NY

  • How to check the database existence using java.

    Hi All,
    I need to know if a database exists or not using DB2 sql statements. Is there any sql to find that.
    Thanks in advance

    try to connect to the database. if it is possible, the database exists - if not - well there may be a number of reasons, but if your database URL is correct, your network is ok and your database engine is running, the database is not existent.

  • How to connect the EJB webservices using kxmlrpc in J2ME

    Hi all,
    I am trying to develope a program in J2ME using kxmlrpc. I am having the EJB web serivce as server and its working fine , the webservice coding is as follows and i am using Sun application sever for web services
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.util.ArrayList;
    import javax.ejb.EJBException;
    import javax.ejb.Stateless;
    import javax.jws.WebService;
    import javax.jws.WebMethod;
    import javax.jws.WebParam;
    import javax.sql.*;
    @Stateless()
    @WebService()
    public class test1 {
    /* Sample Web Service Operation */
    @WebMethod(operationName="sample_operation")
    public String operation(@WebParam(name="param_name") String param) {
    // implement the web service operation here
    System.out.println("test the xml rpc");
    param="helloworld";
    return param;
    Any body please help me how to call this web sevices method in J2ME client using kxmlrpc, i tried but it shows execption. And i want to know which url i want ot give inthe XmlRpcclient() and what are all the parameters to be given in xmlrpcclient.execute(). Anybody please help me on this and my kxml coding is as follows:
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    import javax.microedition.io.*;
    import java.io.*;
    import java.util.*;
    import org.kxmlrpc.*;
    public class kxmlrpc_demo extends MIDlet implements CommandListener {
    private List list;
    private Command exitCommand;
    private String[] menuItems;
    private Display display;
    private Alert response;
    private XmlRpcClient xmlrpc;
    private Vector params, xmlArray;
    public kxmlrpc_demo() {
    //Initialize the User Interface
    menuItems = new String[] {"Timestamp", "Randomizer", "AddressBook"};
    list = new List( "Select a service", List.IMPLICIT, menuItems, null );
    exitCommand = new Command( "Exit", Command.EXIT, 1 );
    response = new Alert("Service Return", null, null, AlertType.INFO);
    response.setTimeout( Alert.FOREVER );
    //Add commands
    list.addCommand( exitCommand );
    list.setCommandListener( this );
    //obtain a reference to the device's UI
    display = Display.getDisplay( this );
    }//end MyMidlet()
    public void startApp() {
    display.setCurrent( list );
    }//end startApp()
    public void pauseApp() {
    }//end pauseApp()
    public void destroyApp( boolean unconditional ) {
    //clean up
    list = null;
    exitCommand = null;
    display = null;
    }//end destroyApp
    public void commandAction( Command com, Displayable dis ) {
    if ( dis == list && com == List.SELECT_COMMAND ) {
    switch( list.getSelectedIndex() )
    case 0:
    try
    xmlrpc = new XmlRpcClient( "http://localhost:4116/test1Service/test1?Tester" );
    params = new Vector();
    String serverTime = (String) xmlrpc.execute( "sysTime.getSystemTime", params );
    response.setString( serverTime.toString() );
    display.setCurrent( response );
    catch ( Exception ex )
    response.setString( ex.toString() );
    ex.printStackTrace(); // DEBUG
    display.setCurrent( response );
    }//end try/catch
    break;
    case 1:
    try
    xmlrpc = new XmlRpcClient( "http://localhost:4116/test1Service/test1?Tester" );
    System.out.println("url"+xmlrpc.getURL());
    params = new Vector();
    xmlArray = new Vector();
    xmlArray.addElement( "param_name" );
    // xmlArray.addElement( "5" );
    // xmlArray.addElement( "12" );
    params.addElement( xmlArray );
    String serverTime = (String) xmlrpc.execute( "sample-operation", params);
    System.out.println("servertime: "+serverTime);
    response.setString( serverTime.toString() );
    display.setCurrent( response );
    catch ( Exception ex )
    response.setString( ex.toString() );
    ex.printStackTrace(); // DEBUG
    display.setCurrent( response );
    }//end try/catch
    break;
    case 2:
    response.setString( "Not implemented yet." );
    display.setCurrent( response );
    break;
    }//end switch( list.getSelectedIndex() )
    else if ( com == exitCommand ) {
    destroyApp( true );
    notifyDestroyed();
    }//end if ( dis == list && com == List.SELECT_COMMAND )
    }//end CommandAction( Command, Displayable )
    }//end MyMidlet
    Thanks in advance.
    regards
    Senthil K

    Any body please help me on this. I am really struggling on this

  • How to update the database table using webdynpro??

    Hi,
    Can anybody helm me in updating database table....by entering the values on the output screen of webdynpro component??should i use any commit statement in function module ,which i used to update.

    hi martina....
    consider you are having two input fields bound to attr1 and attr2.
    now after pressing the save button:
    just read teh two attributes to field1, field2 using code wizard. then
    <db name>-<fieldname1> = <field1>.
    <db name>-<fieldname2> = <field2>.
    insert <dbname>.
    ---regards,
       alex b justin

  • Please Its very urgent How to connect the thumb device using java media fra

    I was new to JMF please help me
    i wnat the code for connecting to the signatuure pad or thumb device present iam doing project in biometrics please if any body knows
    the code farward it tome bye
    Advance Thanks

    The SecuGen FDx SDK for Java 1.0 Beta1 is now available. It is posted at http://sgdn.secugen.com. This is a JNI wrapper for the SecuGen FDx SDK v3.0. Sample source code including JSGD, A SWING version of the SecuGen Diagnostic utility. Currently only MS-Windows is supported.
    Best regards.
    =Dan=
    Dan Riley - SecuGen

  • How to order the contact list using first name alphabetically

    I have just imported my contact list and it has organised them elphabetically by the second name even if this does not correspond to a surname. for example kate Mobile comes up under M, and kate Home comes up under H. as most of my contacts are eiether stored as home or mobile this is useless.

    Settings>mail, contacts &amp; calendars> scroll to the bottom and choose both your sort and display order.
    Though it would be better to just make one entry for Kate Doe and list all her phone numbers there.

  • In weblogic Portal 10.3 how to configure the database..?

    Hi,
    Can you tell me how to connect the database is there any document available.If you guys dont mind can you send me the steps..So , that it will be useful for me..
    Thanks & Regards
    Kalyan Kurmam

    Please see these two documentation links:
    http://download.oracle.com/docs/cd/E13155_01/wlp/docs103/db/index.html
    http://download.oracle.com/docs/cd/E13155_01/wlp/docs103/prodOps/teamDevelopment.html#wp1046771

Maybe you are looking for

  • IllegalArgumentException: While exporting to PDF in Websphere 6

    Hi, <br> We are using Crystal Report XI and Java 1.5. We are using JRC jars to parse the Crystal Report in Server side. From our application we will export the report to PDF. It is working fine for all reports except for a specific report where it gi

  • Problem with Analytical function

    hi, I have two tables and my expected result is given below.. I used the LEAD function to get (start_Date and new_Date) which i have shown in my expected result..my problem is with rel_type and org_id. I am not able to get those values to its corresp

  • Custom fields on Shopping Cart in SRM 6.0 SP03

    Hello All, I have made a WD enhancment and added my Custom fields on the Header tab of the Shopping cart. But the fields are static as of now, as i am not able to handle the fields in the Post and Pre-exit methods of the Web dynpro enhancement. CAn a

  • Run Stores Procedure,  RadioButton - Important

    Hi everyone, I am trying to run this Stored Procedure, I have the following: PROMPT(RADIOBUTTON,%MESES%,"seleccionar meses a promediar",1,{"1 mes"," 2 meses"," 3 meses"," 5 meses"},{"1","2","3","5"}) TASK(Execute formulas,LOGICFILE,%APPPATH%..AdminAp

  • Picture Duplicating

    +I wonder if you can help me with something. I have started to put iPhoto Albums onto my iPhone. If I sync an Event, it all works fine and I end up with the camera roll and the new Event I just synced onto iPhone.+ +The problem I have is when I do th