Mildet connect to oracle DB using servlet problem ,help please

hi guys i have a problem am tring to connect my midlet to databse through midlet but i don`t know what is the problem so far the midlet already connect to my servlet url but the servlet cant read the parameters to open the connection for database
my servlet code
* To change this template, choose Tools | Templates
* and open the template in the editor.
import java.io.*;
import java.net.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.text.*;
* @author freddy
public class getconnection extends HttpServlet {
    Statement statement;
ResultSet rs=null;
String bstr=null;
String bstr1=null;
String bstr2=null;
public void init()
    * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
    * @param request servlet request
    * @param response servlet response
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
        response.setContentType("text/html;charset=UTF-8");
        PrintWriter out = response.getWriter();
        try {
            /* TODO output your page here
            out.println("<html>");
            out.println("<head>");
            out.println("<title>Servlet getConnection</title>"); 
            out.println("</head>");
            out.println("<body>");
            out.println("<h1>Servlet getConnection at " + request.getContextPath () + "</h1>");
            out.println("</body>");
            out.println("</html>");
        } finally {
            out.close();
    // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
    * Handles the HTTP <code>GET</code> method.
    * @param request servlet request
    * @param response servlet response
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
        processRequest(request, response);
  doPost(request,response);
    * Handles the HTTP <code>POST</code> method.
    * @param request servlet request
    * @param response servlet response
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
        processRequest(request, response);
        DataInputStream in = new DataInputStream(
                (InputStream)request.getInputStream());
        String sid = in.readUTF();
        String user = in.readUTF();
        String pwd = in.readUTF();
      //  "jdbc:oracle:thin:@localhost:1521"+": "+sid
        String message = message = "Name:"+bstr+" telephone:"+bstr1+" burthday:"+bstr2;
         try {
            connect(sid,user, pwd);
            message += "100 ok connected";
        } catch (Throwable t) {
            message += "200 " + t.toString();
        response.setContentType("text/plain");
        response.setContentLength(message.length());
        PrintWriter out = response.getWriter();
        out.println(message);
        in.close();
        out.close();
        out.flush();
    private void connect(String sid, String user,String pwd)
    throws Exception {
        // Establish a JDBC connection to the MYSQL database server.
        //Class.forName("org.gjt.mm.mysql.Driver");
        Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
        Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:"+sid,user,pwd);
        System.out.print("connected");
        try{
           statement =conn.createStatement();
            rs=statement.executeQuery(" Select*from WOH.P_DEMGRAPHICS where P_ID='P1000 '");
        catch(SQLException e)
        System.err.print(e);
       try{
while (rs.next()) {
bstr=rs.getString(2);
bstr1=rs.getString(3);
bstr2=rs.getString(4);
statement.close();
   catch (SQLException e) {
//bstr += e.toString();
System.err.println(e);
System.exit(1);
        // Establish a JDBC connection to the Oracle database server.
        //DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
        //Connection conn = DriverManager.getConnection(
        //      "jdbc:oracle:thin:@localhost:1521:"+db,user,pwd);
        // Establish a JDBC connection to the SQL database server.
        //Class.forName("net.sourceforge.jtds.jdbc.Driver");
        //Connection conn = DriverManager.getConnection(
        //      "jdbc:jtds:sqlserver://localhost:1433/"+db,user,pwd);
    * Returns a short description of the servlet.
    public String getServletInfo() {
        return "Short description";
    // </editor-fold>
}Midlet code
* To change this template, choose Tools | Templates
* and open the template in the editor.
import java.io.*;
import java.util.*;
import javax.microedition.io.*;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
* @author freddy
public class testOrcl extends MIDlet  implements CommandListener {
   protected String url;
    private String username;
    private Display display;
    private Command exit = new Command("EXIT", Command.EXIT, 1);;
    private Command connect = new Command("Connect", Command.SCREEN, 1);
    private TextField tb;
    private Form menu;
    private TextField tb1;
    private TextField tb2;
    DB db;
    public testOrcl() throws Exception
        display=Display.getDisplay(this);
        url="http://localhost:8084/getConnection/getconnection";
    public void startApp() {
        displayMenu();
    public void displayMenu()
    menu= new Form("connect");
     tb = new TextField("Please input database: ","",30,
                TextField.ANY );
        tb1 = new TextField("Please input username: ","",30,
                TextField.ANY);
        tb2 = new TextField("Please input password: ","",30,
                TextField.PASSWORD);
        menu.append(tb);
        menu.append(tb1);
        menu.append(tb2);
        menu.addCommand(exit);
        menu.addCommand(connect);
        menu.setCommandListener(this);
        display.setCurrent(menu);
    public void pauseApp() {
    public void destroyApp(boolean unconditional) { }
    public void commandAction(Command command, Displayable screen) {
        if (command == exit) {
            destroyApp(false);
            notifyDestroyed();
        } else if (command == connect) {
            db  = new DB(this);
            db.start();
            db.connectDb(tb.getString(),tb1.getString(),tb2.getString());
* To change this template, choose Tools | Templates
* and open the template in the editor.
import java.io.*;
import java.util.*;
import javax.microedition.io.*;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import java.lang.*;
* @author freddy
public class DB implements Runnable  {
    testOrcl midlet;
     private Display display;
        String sid;
        String user;
        String pwd;
        public DB( testOrcl midlet)
        this.midlet=midlet;
        display=Display.getDisplay(midlet);
    public void start()
    Thread t = new Thread(this);
            t.start();
    public void run()
     StringBuffer sb = new StringBuffer();
            try {
                HttpConnection c = (HttpConnection) Connector.open(midlet.url);
               c.setRequestProperty(
                   "User-Agent","Profile/MIDP-2.1, Configuration/CLDC-1.1");
                c.setRequestProperty("Content-Language","en-US");
                c.setRequestMethod(HttpConnection.POST);
                DataOutputStream os =
                        (DataOutputStream)c.openDataOutputStream();
                os.writeUTF(sid.trim());
                os.writeUTF(user.trim());
                os.writeUTF(pwd.trim());
                os.flush();
                os.close();
                // Get the response from the servlet page.
                DataInputStream is =(DataInputStream)c.openDataInputStream();
                //is = c.openInputStream();
                int ch;
                sb = new StringBuffer();
                while ((ch = is.read()) != -1) {
                    sb.append((char)ch);
           showAlert(sb.toString());
                is.close();
                c.close();
            } catch (Exception e) {
                showAlert(e.getMessage());
     /* This method takes input from user like db,user and pwd and pass
            to servlet */
        public void connectDb(String sid,String user,String pwd) {
            this.sid = sid;
            this.user = user;
            this.pwd = pwd;
        /* Display Error On screen*/
        private void showAlert(String err) {
            Alert a = new Alert("");
            a.setString(err);
            a.setTimeout(Alert.FOREVER);
            display.setCurrent(a);
   

Comment out process request or rewrite & move it to a position after you read the parameters and connect to the db. Decide where you want to write to the output stream. Also, you have some superfluous casting.
I take it that you are using netbeans? If you debug and step through the code you will get an idea of the flow. The steps should be, midlet connects with POST, doPost is called, server reads parameters, server opens connection, executes query, releases/closes connection, and writes a response to the midlet.
Some notes about the connect method; The scope of rs may cause problems. It is unlike you will have a valid result set if you have a problem with create statement or execute. Take a look at connection pooling and be mindful how the connections are opened, used, and closed; put all the important cleanup operations in a finally. Remove system.exit from your servlet. Actually I would suggest limiting the scope of all your vars;
If you store the username, password, and sid on the midlet, you may have trouble updating the installation base if you need to change the values for any reason. Also, you have clients which contain your database u/p, susceptible to snooping and decompilation. Use the servlet to abstract the db from the client. And use a datasource (with connection pooling) for obtaining connections to db.

Similar Messages

  • Connect to oracle database using c program

    I am using AIX environment and i want to connect to oracle database using c program.

    http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10825/pc_03dbc.htm#i5880

  • Can we connect to oracle 9i using vb6.0 in 64 bit machine.

    Can we connect to oracle 9i using vb6.0 in 64 bit machine.
    Code i have written is
    dim conn as new ADODB.Connection
    conn.open("Provider=MSDAORA.1;password=pw;user id=usname;data source=dbname;Persist Security info=false")
    but it is throwing an error saying
    "Connection not open"
    But the same code is working in vb.net.
    Do we need to install any providers for 64 bit machine?

    I have had no luck doing this in the 64-bit ODAC or otherwise. If anybody succeeds I would love to hear about it. My experience follows for those interested:
    I am trying to migrate some working VB6 code from Windows 2000 Server to 64-bit Windows Server 2003 but can't get the OLEDB connection to Oracle to work.
    In the working code (x86 environment), I am using ADO 2.8 and Microsoft OLEDB Provider for Oracle (MSDAORA). Since the Microsoft OLEDB provider for Oracle is no longer supported or available on Windows Server 2003 x64, I tried to use the 32-bit Oracle OLEDB provider in ODAC 10.2 but may have run into the parsing bug posted on MSDN (http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=159581). Next, I successfully installed the beta 64-bit version of ODAC 10.2, but when I try to open the connection I receive "Error 3706 Provider cannot be found. It may not be properly installed." However, I can successfully TNSPing the data source.
    Windows Server 2003 x64 (not Itanium)
    Oracle Enterprise 9.2
    Microsoft Visual Basic 6
    Microsoft ADO 2.8 (Objects & Recordset references)
    Oracle OLEDB Provider (ODAC 10.2, 64-bit)
    Code Snippet:
    Set m_dbConn = New ADODB.Connection
    With m_dbConn
    .ConnectionString = "Provider=OraOLEDB.Oracle;Data Source=oplprod; User ID=myid; Password=mypwd;"
    .ConnectionTimeout = 10
    .CursorLocation = adUseClient
    .Open
    End With

  • I have the new iOS 6 on my iPad, and when ever I try to log on to the iTunes store this comes up: Cannot connect to the iTunes store. Anybody help please? :)

    I have the new iOS 6 on my iPad, and when ever I try to log on to the iTunes store this comes up: Cannot connect to the iTunes store. Anybody help please?

    I'm also having this problem I've already tried changing the year stuff and its still the same I succeeded once when I toggled my credit card account but after that the same problem occurred.

  • HT1665 I face an error message Oxe800012 when connecting iphone 4s to the computer, any help please ?????

    I face an error message Oxe800012 when connecting iphone 4s to the computer, any help please ?????

    See this support article: http://support.apple.com/kb/TS3221

  • I want to use my maps... But it says that it cannot determined my location...how can I use it? Help please...thanks

    I want to use my maps... But it says that it cannot determined my location...how can I use it? Help please...thanks

    Do you have location services turned on? See Settings > Privacy > Location Services
    In any event Maps can be used to obtain directions by supplying the start and end locations after touching "Directions" in the upper left corner.

  • I reset the ipad. hoping it would help. but still it needs password for activation. the owner already forgot password for icloud as well as password of the email since it was not used since 2011. help please.

    I reset the ipad. hoping it would help. but still it needs password for activation. the owner already forgot password for icloud as well as password of the email since it was not used since 2011. help please.

    Your sister can go to https://iforgot.apple.com/ and see if she can recover her password.
    There is nothing anybody else can do.

  • Unable to connect to Oracle Database using Oracle Sql developer 2.1.1.64

    Hi Everyone,
    I am searching for some help regarding my problem with Oracle connectivity. I have installed Oracle 11g release 2 on my Windows XP Professional Laptop. For a few days after installation i could connect to the Oracle database with the SYSTEM account using Oracle SQL developer ( installed on the same Laptop) but now i am unable to do so.It gives me this annoying message:
    An error was encountered performing the required operation  Got a minus one from read call .Vendor code 0
    However i am able to connect using Sql Plus by supplying the username SYSTEM and the corresponding password.
    My TNSNAMES .ora file is as follows:
    ORACLE =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST =localhost)(PORT = 1521))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = ORACLE)
    ORACLR_CONNECTION_DATA =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    (CONNECT_DATA =
    (SID = CLRExtProc)
    (PRESENTATION = RO)
    My Listener.ora file is as follows:
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = CLRExtProc)
    (ORACLE_HOME = D:\app\product\11.2.0\dbhome_1)
    (PROGRAM = extproc)
    (ENVS = "EXTPROC_DLLS=ONLY:D:\app\product\11.2.0\dbhome_1\bin\oraclr11.dll")
    (SID_DESC =
    (GLOBAL_DBNAME = Oracle)
    (ORACLE_HOME = D:\app\product\11.2.0\dbhome_1)
    (SID_NAME = Oracle)
    LISTENER =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    (PROTOCOL_STACK =
    (PRESENTATION = GIOP)
    (SESSION = RAW)
    ADR_BASE_LISTENER = D:\app
    My Sqlnet.ora file is as follows:
    SQLNET.AUTHENTICATION_SERVICES= (NTS)
    NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
    I am new to Oracle and so i need someone in this forum who can help me resolve this problem. Also i even tried connecting to the database using Toad 10.5.0.41. It give me the following error:
    ORA 12537 : TNS Connection closed
    Thanks for your patience and help in advance.
    ---Prashant

    Hello Irian and Sue,
    I can connect to the Oracle database using SQL Plus. Now when i TNSPING ORACLE from command line i get the following message :
    Used parameter files:
    D:\app\product\11.2.0\dbhome_1\network\admin\sqlnet.ora
    Used TNSNAMES adapter to resolve the alias
    Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST =localhost
    *)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ORACLE)))*
    TNS-12537: TNS:connection closed
    Thanks for your response to my initial post.Do u have any other methods to resolve this?

  • Need to connect to Oracle 11g using PI 7.1 JDBC adapter

    Hi All,
    I am trying to configure a JDBC adapter to connect Oracle 11g. For this I need to know the driver,jar and connection URL details.
    Can anyone please provide the above information?
    Please correct me if my details are wrong :
    JDBC Driver : oracle.jdbc.driver.OracleDriver
    JAR : ojdbc5.jar
    URL : jdbc:oracle:thin:@localhost:1521:ora11i
    Regards,
    Prakash.

    Yes i knew how to deploy the jars using SDA.
    I will try to deploy the above jar (ojdbc5.jar ) and try to connect to Oracle 11g with URL & Driver classname.
    If I face any problem then i will get  back to you.

  • Cant connect to Oracle database using oracle db client

    Hi All,
    I recently created a virtual machine running windows server 2008 on my windows 7 host. Oracle database 11g is already installed on host OS(windows 7) and I have installed oracle 11g client on the guest OS(windows server 2008) and trying to connect to oracle database from remote server using oracle client but getting this error:
    ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATAI am trying to connect using oracle client as below:
    C:\Users\Administrator>SET ORACLE_SID = HR84DEV
    C:\Users\Administrator>SQLPLUS /NOLOG
    SQL*Plus: Release 11.2.0.1.0 Production on Fri Feb 10 06:16:34 2012
    Copyright (c) 1982, 2010, Oracle. All rights reserved.
    SQL> CONNECT SYSADM/[email protected]
    ERROR:
    ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA
    I have created database with name - HR84DEV
    HOST ip address is - 192.168.56.1
    I googled this error and as most of resources/blogs talked about having correct entry on listner.ora and tnsnames.ora file, I did the changes on both of these files accordingly.
    PFB the cotent of both of these files:
    tnsnames.ora
    # tnsnames.ora Network Configuration File: C:\MyApps\Oracle\product\11.2.0\dbhome_\NETWORK\ADMIN\tnsnames.ora
    # Generated by Oracle configuration tools.
    LISTENER_ORCL =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.1)(PORT = 1521))
    ORACLR_CONNECTION_DATA =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    (CONNECT_DATA =
    (SID = CLRExtProc)
    (PRESENTATION = RO)
    HR84DEV =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.1)(PORT = 1521))
    (CONNECT_DATA =
    (SERVICE_NAME = HR84DEV)
    ORCL =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = orcl)
    listner.ora
    # listener.ora Network Configuration File: C:\MyApps\Oracle\product\11.2.0\dbhome_\network\admin\listener.ora
    # Generated by Oracle configuration tools.
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = CLRExtProc)
    (ORACLE_HOME = C:\MyApps\Oracle\product\11.2.0\dbhome_)
    (PROGRAM = extproc)
    (ENVS = "EXTPROC_DLLS=ONLY:C:\MyApps\Oracle\product\11.2.0\dbhome_\bin\oraclr11.dll")
    (SID_DESC =
    (SID_NAME = HR84DEV)
    (ORACLE_HOME = C:\MyApps\Oracle\product\11.2.0\dbhome_)
    (PROGRAM = extproc)
    (ENVS = "EXTPROC_DLLS=ONLY:C:\MyApps\Oracle\product\11.2.0\dbhome_\bin\oraclr11.dll")
    LISTENER =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.1)(PORT = 1521))
    ADR_BASE_LISTENER = C:\MyApps\Oracle
    Please not that I dont have any problem in connect to database locally.

    Thanks Nicolas,
    Actually, there was a problem with my oracle client installation. I uninstalled it and then installed back again but still, even after following your instructions I get some error.
    Here what I did:
    Created tnsnames.ora file as below:
    HR84DEV =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.1)(PORT = 1521))
    (CONNECT_DATA =
    (SERVICE_NAME = HR84DEV)
    Placed it under appropriate directory and then checked the connection with database using the command shown below:
    C:\Users\Administrator>tnsping HR84DEV
    TNS Ping Utility for 32-bit Windows: Version 11.2.0.1.0 - Production on 10-FEB-2
    012 08:42:03
    Copyright (c) 1997, 2010, Oracle. All rights reserved.
    Used parameter files:
    C:\MyApps\Administrator\product\11.2.0\client_1\network\admin\sqlnet.ora
    Used TNSNAMES adapter to resolve the alias
    Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)
    (HOST = 192.168.56.1)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = HR84DEV)))
    OK (20 msec)
    Then tried to connect to database as below:
    C:\Users\Administrator>SET ORACLE_SID=HR84DEV
    C:\Users\Administrator>SQLPLUS /NOLOG
    SQL*Plus: Release 11.2.0.1.0 Production on Fri Feb 10 08:25:56 2012
    Copyright (c) 1982, 2010, Oracle. All rights reserved.
    SQL> CONNECT SYSADM/SYSADM@HR84DEV
    ERROR:
    ORA-28547: connection to server failed, probable Oracle Net admin error
    But still getting error.
    I Googled this error and tried to figure out what the problem is and came across the possible cause which is because I haven't specify that the service should run as a user who is in domain admin group.
    well, I am not really sure about this and dont know what user name and password I should enter in OracleserviceHR84DEV-properties-log on-this account.
    do I really need to set this?

  • Connect to Oracle DB using DBCP and tnsnames.ora

    I have a Spring-based web app that is running on Tomcat and uses DBCP to connect to Oracle.
    The problem:
    Need to pull database connection information from tnsnames.ora file. There is Oracle Client installed on a server, so tnsnames file is available.
    According to JDBC documentation, the following url should do the trick: jdbc:datadirect:oracle:TNSNamesFile=c:\\oracle\\product\\10.2.0\\NETWORK\\ADMIN\\tnsnames.ora;TNSServerName=FITZGERALD.SALES
    This leads to the following declaration in dataAccessContext-local.xml file:
    +<bean id="dataSource" class="org.apache.tomcat.dbcp.dbcp.BasicDataSource" destroy-method="close">+
    +<property name="driverClassName" value="oracle.jdbc.OracleDriver"/>+
    +<property name="url" value="jdbc:datadirect:oracle:TNSNamesFile=C:\\oracle\\product\\10.2.0\\db_1\\network\\admin\\tnsnames.ora;TNSServerName=TESTDB"/>+
    +<property name="username" value="${jdbc.username}"/>+
    +<property name="password" value="${jdbc.password}"/>+
    +</bean>+
    This doesn&rsquo;t work for me saying that database url is invalid.
    Can anyone provide instructions on how to set up DBCP with tnsnames.ora?
    Any help greatly appreciated.

    You are right, the I got that url may not be correct. I got it from datadirect documentation.
    I couldn�t find any good information or examples on this, but I think using TNS keyword-value pairs and tnsnames.ora is supported by type4 Oracle 10g JDBC.
    Some info I found in section �Connecting to the Database through the Applet� in JDBC Reference http://download.oracle.com/docs/cd/B19306_01/java.102/b14355/jdbcthin.htm#CACCHECD
    I guess there is something off in that documentation though. I couldn't get it working.

  • Unable to establish connection to oracle database using sql developer

    hi guys,
    i tried to connect to the oracle database using the sql developer, but it fails. it replies the following message:
    Status: Failure -Test failed: Io exception: The Network Adapter could not establish the connection
    what should i do? any help

    Please provide a little more information:
    1) SQLDeveloper version.
    2) Database Version.
    3) Database location (same machine or on the network).
    4) Connection method (basic,TNS).
    5) Connection type (Thin,Thick/OCI).
    Usually the first thing to check is if you have correctly entered the right information for your database connection, then if everything seems to be OK the database itself should be checked for potential problems.

  • Error while creating a JDBC connection to Oracle 11g using WLS 6.1

    Hi
    I am trying to connect to Oracle 11g database on Weblogic 6.1 server.
    First of all i would like to know if this is compatible?
    The environement that i have is this
    1. JDK 1.3
    2. Database 11g is on remote system
    3. Oracle client on my local system ( Connecting to the 11g DB through the client works fine)
    4. Weblogic server 6.1
    5. Currently the application is connected to Oracle 10g DB and working fine(We are attempting to move it to 11g)
    Below are the steps that i followed to create the connection:
    1. Made an entry for the datasource in config.xml under <WLS_DOMAIN>/config folder as below
    <JDBCConnectionPool DriverName="oracle.jdbc.driver.OracleDriver"
    MaxCapacity="4" Name="CADConnectionPool"
    Properties="user=abc_proxy;password=proxy_abc;dll=ocijdbc8;protocol=thin"
    RefreshMinutes="5" ShrinkPeriodMinutes="10" Targets="CAsvr"
    TestConnectionsOnRelease="true" TestConnectionsOnReserve="true"
    TestTableName="dual" URL="jdbc:oracle:thin:@gen11t-ora.db.lab.xyz.com:1530:GEN11T"/>
    2. Restarted the server.
    3. Ran the application and get the following error on the server console:
    <Aug 22, 2011 12:39:42 AM CDT> <Error> <JDBC> <Cannot startup connection pool "C
    ADConnectionPool" weblogic.common.ResourceException:
    Could not create pool connection. The DBMS driver exception was:
    java.lang.ArrayIndexOutOfBoundsException
    at oracle.security.o3logon.C0.r(C0)
    at oracle.security.o3logon.C0.l(C0)
    at oracle.security.o3logon.C1.c(C1)
    at oracle.security.o3logon.O3LoginClientHelper.getEPasswd(O3LoginClientH
    elper)
    at oracle.jdbc.ttc7.O3log.<init>(O3log.java:289)
    at oracle.jdbc.ttc7.TTC7Protocol.logon(TTC7Protocol.java:251)
    at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:246)
    at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.ja
    va:365)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:260)
    at weblogic.jdbc.common.internal.ConnectionEnvFactory.makeConnection(Con
    nectionEnvFactory.java:193)
    at weblogic.jdbc.common.internal.ConnectionEnvFactory.createResource(Con
    nectionEnvFactory.java:134)
    at weblogic.common.internal.ResourceAllocator.makeResources(ResourceAllo
    cator.java:705)
    at weblogic.common.internal.ResourceAllocator.<init>(ResourceAllocator.j
    ava:282)
    at weblogic.jdbc.common.internal.ConnectionPool.startup(ConnectionPool.j
    ava:650)
    at weblogic.jdbc.common.JDBCService.addDeployment(JDBCService.java:107)
    at weblogic.management.mbeans.custom.DeploymentTarget.addDeployment(Depl
    oymentTarget.java:360)
    at weblogic.management.mbeans.custom.DeploymentTarget.addDeployments(Dep
    loymentTarget.java:285)
    at weblogic.management.mbeans.custom.DeploymentTarget.updateServerDeploy
    ments(DeploymentTarget.java:239)
    at weblogic.management.mbeans.custom.DeploymentTarget.updateDeployments(
    DeploymentTarget.java:199)
    at java.lang.reflect.Method.invoke(Native Method)
    at weblogic.management.internal.DynamicMBeanImpl.invokeLocally(DynamicMB
    eanImpl.java:636)
    at weblogic.management.internal.DynamicMBeanImpl.invoke(DynamicMBeanImpl
    .java:621)
    at weblogic.management.internal.ConfigurationMBeanImpl.invoke(Configurat
    ionMBeanImpl.java:360)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    57)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    25)
    at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:468)
    at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:209)
    at $Proxy31.updateDeployments(Unknown Source)
    at weblogic.management.configuration.ServerMBean_CachingStub.updateDeplo
    yments(ServerMBean_CachingStub.java:2977)
    at weblogic.management.mbeans.custom.ApplicationManager.startConfigManag
    er(ApplicationManager.java:372)
    at weblogic.management.mbeans.custom.ApplicationManager.start(Applicatio
    nManager.java:160)
    at java.lang.reflect.Method.invoke(Native Method)
    at weblogic.management.internal.DynamicMBeanImpl.invokeLocally(DynamicMB
    eanImpl.java:636)
    at weblogic.management.internal.DynamicMBeanImpl.invoke(DynamicMBeanImpl
    .java:621)
    at weblogic.management.internal.ConfigurationMBeanImpl.invoke(Configurat
    ionMBeanImpl.java:360)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    57)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    25)
    at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:468)
    at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:209)
    at $Proxy42.start(Unknown Source)
    at weblogic.management.configuration.ApplicationManagerMBean_CachingStub
    .start(ApplicationManagerMBean_CachingStub.java:480)
    at weblogic.management.Admin.startApplicationManager(Admin.java:1234)
    at weblogic.management.Admin.finish(Admin.java:644)
    at weblogic.t3.srvr.T3Srvr.start(T3Srvr.java:524)
    at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:207)
    at weblogic.Server.main(Server.java:35)
    at weblogic.jdbc.common.internal.ConnectionEnvFactory.makeConnection(Con
    nectionEnvFactory.java:209)
    at weblogic.jdbc.common.internal.ConnectionEnvFactory.createResource(Con
    nectionEnvFactory.java:134)
    at weblogic.common.internal.ResourceAllocator.makeResources(ResourceAllo
    cator.java:705)
    at weblogic.common.internal.ResourceAllocator.<init>(ResourceAllocator.j
    ava:282)
    at weblogic.jdbc.common.internal.ConnectionPool.startup(ConnectionPool.j
    ava:650)
    at weblogic.jdbc.common.JDBCService.addDeployment(JDBCService.java:107)
    at weblogic.management.mbeans.custom.DeploymentTarget.addDeployment(Depl
    oymentTarget.java:360)
    at weblogic.management.mbeans.custom.DeploymentTarget.addDeployments(Dep
    loymentTarget.java:285)
    at weblogic.management.mbeans.custom.DeploymentTarget.updateServerDeploy
    ments(DeploymentTarget.java:239)
    at weblogic.management.mbeans.custom.DeploymentTarget.updateDeployments(
    DeploymentTarget.java:199)
    at java.lang.reflect.Method.invoke(Native Method)
    at weblogic.management.internal.DynamicMBeanImpl.invokeLocally(DynamicMB
    eanImpl.java:636)
    at weblogic.management.internal.DynamicMBeanImpl.invoke(DynamicMBeanImpl
    .java:621)
    at weblogic.management.internal.ConfigurationMBeanImpl.invoke(Configurat
    ionMBeanImpl.java:360)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    57)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    25)
    at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:468)
    at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:209)
    at $Proxy31.updateDeployments(Unknown Source)
    at weblogic.management.configuration.ServerMBean_CachingStub.updateDeplo
    yments(ServerMBean_CachingStub.java:2977)
    at weblogic.management.mbeans.custom.ApplicationManager.startConfigManag
    er(ApplicationManager.java:372)
    at weblogic.management.mbeans.custom.ApplicationManager.start(Applicatio
    nManager.java:160)
    at java.lang.reflect.Method.invoke(Native Method)
    at weblogic.management.internal.DynamicMBeanImpl.invokeLocally(DynamicMB
    eanImpl.java:636)
    at weblogic.management.internal.DynamicMBeanImpl.invoke(DynamicMBeanImpl
    .java:621)
    at weblogic.management.internal.ConfigurationMBeanImpl.invoke(Configurat
    ionMBeanImpl.java:360)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    57)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    25)
    at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:468)
    at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:209)
    at $Proxy42.start(Unknown Source)
    at weblogic.management.configuration.ApplicationManagerMBean_CachingStub
    .start(ApplicationManagerMBean_CachingStub.java:480)
    at weblogic.management.Admin.startApplicationManager(Admin.java:1234)
    at weblogic.management.Admin.finish(Admin.java:644)
    at weblogic.t3.srvr.T3Srvr.start(T3Srvr.java:524)
    at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:207)
    at weblogic.Server.main(Server.java:35)
    Can't load scjd12.dll, file not found java.library.path=C:\jdk1.3.1_11\bin;.;C:\WINDOWS\system32;C:\WINDOWS;.\bin;C:\P
    rogram Files\Lotus\Notes\Data;C:\Program Files\Lotus\Notes;C:\Program Files\Java
    \jre1.5.0_17\bin;C:\Program Files\Java\j2re1.4.2_06\bin;C:\Oracle\bin;C:\Program
    Files\Oracle\jre\1.3.1\bin;C:\Program Files\Oracle\jre\1.1.8\bin;C:\WINDOWS\sys
    tem32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\system32\nls;C:\WINDOWS\sys
    tem32\nls\ENGLISH;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\Rational
    \common;C:\Program Files\Rational\ClearCase\bin;C:\apache-ant-1.6.5\bin;C:\jdk1.
    3.1_11\bin;C:\Program Files\Citrix\ICAService\;C:\Program Files\Citrix\System32\
    ;Z:.
    <Aug 22, 2011 12:38:06 AM CDT> <Info> <JDBC> <Sleeping in createResource()>
    <Aug 22, 2011 12:38:07 AM CDT> <Error> <JDBC> <Cannot startup connection pool "c
    ispool" weblogic.common.ResourceException:
    Could not load 'com.neon.jdbc.Driver
    If this is a type-4 JDBC driver, it could occur if the JDBC
    driver is not in the system CLASSPATH.
    If this is a type-2 JDBC driver, it may also indicate that
    the Driver native layers(DBMS client lib or driver DLL)
    have not been installed properly on your system
    or in your PATH environment variable.
    This is most likely caused by one of the following:
    1. The native layer SO, SL, or DLL could not be found.
    2. The file permissions on the native layer SO, SL, or DLL
    have not been set properly.
    3. The native layer SO, SL, or DLL exists, but is either
    invalid or corrupted.
    For more information, read the installation documentation
    for your JDBC Driver, available from:
    http://e-docs.bea.com
    at weblogic.jdbc.common.internal.ConnectionEnvFactory.makeConnection(Con
    nectionEnvFactory.java:212)
    at weblogic.jdbc.common.internal.ConnectionEnvFactory.createResource(Con
    nectionEnvFactory.java:134)
    at weblogic.common.internal.ResourceAllocator.makeResources(ResourceAllo
    cator.java:705)
    at weblogic.common.internal.ResourceAllocator.<init>(ResourceAllocator.j
    ava:282)
    at weblogic.jdbc.common.internal.ConnectionPool.startup(ConnectionPool.j
    ava:650)
    at weblogic.jdbc.common.JDBCService.addDeployment(JDBCService.java:107)
    at weblogic.management.mbeans.custom.DeploymentTarget.addDeployment(Depl
    oymentTarget.java:360)
    at weblogic.management.mbeans.custom.DeploymentTarget.addDeployments(Dep
    loymentTarget.java:285)
    at weblogic.management.mbeans.custom.DeploymentTarget.updateServerDeploy
    ments(DeploymentTarget.java:239)
    at weblogic.management.mbeans.custom.DeploymentTarget.updateDeployments(
    DeploymentTarget.java:199)
    at java.lang.reflect.Method.invoke(Native Method)
    at weblogic.management.internal.DynamicMBeanImpl.invokeLocally(DynamicMB
    eanImpl.java:636)
    at weblogic.management.internal.DynamicMBeanImpl.invoke(DynamicMBeanImpl
    .java:621)
    at weblogic.management.internal.ConfigurationMBeanImpl.invoke(Configurat
    ionMBeanImpl.java:360)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    57)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    25)
    at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:468)
    at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:209)
    at $Proxy31.updateDeployments(Unknown Source)
    at weblogic.management.configuration.ServerMBean_CachingStub.updateDeplo
    yments(ServerMBean_CachingStub.java:2977)
    at weblogic.management.mbeans.custom.ApplicationManager.startConfigManag
    er(ApplicationManager.java:372)
    at weblogic.management.mbeans.custom.ApplicationManager.start(Applicatio
    nManager.java:160)
    at java.lang.reflect.Method.invoke(Native Method)
    at weblogic.management.internal.DynamicMBeanImpl.invokeLocally(DynamicMB
    eanImpl.java:636)
    at weblogic.management.internal.DynamicMBeanImpl.invoke(DynamicMBeanImpl
    .java:621)
    at weblogic.management.internal.ConfigurationMBeanImpl.invoke(Configurat
    ionMBeanImpl.java:360)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    57)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    25)
    at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:468)
    at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:209)
    at $Proxy42.start(Unknown Source)
    at weblogic.management.configuration.ApplicationManagerMBean_CachingStub
    .start(ApplicationManagerMBean_CachingStub.java:480)
    at weblogic.management.Admin.startApplicationManager(Admin.java:1234)
    at weblogic.management.Admin.finish(Admin.java:644)
    at weblogic.t3.srvr.T3Srvr.start(T3Srvr.java:524)
    at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:207)
    at weblogic.Server.main(Server.java:35)
    Would like some help on this asap as the project is in critical stage.
    Thanks

    The driver being used by your weblogic is too old and incompatible with the DBMS. Upgrade the driver.

  • Steps to Connect remote Oracle Server using OCi C in Linux

    Hi !
    I am trying to connect oracle server through my application using OCI C in linux, it works fine in my oracle server machine.
    I want to connect oracle server through my C application from Oracle Client Machine
    can anyone help me in this issue ?
    regards
    Balaji.C

    Sounds like you did not specify your database name. Or you database name is hard-coded.
    Can you show us the code?
    Is your TNSNAMES.ORA set up correctly?
    Also, you did not specify any error messages or anything. Are you checking the result codes after any functions?

  • How to connect to Oracle 11g using thin driver with service name & SID

    Hi Experts,
    Wish to know whether there is a common way to connect to Oracle 11g server using SID or service name.
    Earlier I used jdbc:oracle:thin:@<<server>:<<port>>:<<SID>> for connecting to individual Oracle server instances.
    Now I need to connect to Oracle RAC which provides service names. So I need to use jdbc:oracle:thin:@<<server>:<<port>>/<<service name>>.
    This connection string is internally constructed by a program and user inputs <<server>>, <<port>> and <<SID>> or <<Service Name>>. Now this requires two different connection strings based on the input whether its SID or service name.
    Is there a common connection string for these two? Based on some articles like this, I understood that we can generically use jdbc:oracle:thin:@<<server>:<<port>>/<<service>>, whether for SID and service.
    When I tried this format with SID, I am getting the below error. What I tried is jdbc:oracle:thin:@myoracleserver:1521/ORCL, where ORCL is the SID
    java.sql.SQLException: Listener refused the connection with the following error:
    ORA-12514, TNS:listener does not currently know of service requested in connect descriptor
    Request your help in solving this. What I want is a single connection string whether its SID or service. Any help is of great value.
    Regards
    Sunil

    Wish to know whether there is a common way to connect to Oracle 11g server using SID or service name.
    Earlier I used jdbc:oracle:thin:@<<server>:<<port>>:<<SID>> for connecting to individual Oracle server instances.
    Now I need to connect to Oracle RAC which provides service names. So I need to use jdbc:oracle:thin:@<<server>:<<port>>/<<service name>>.
    This connection string is internally constructed by a program and user inputs <<server>>, <<port>> and <<SID>> or <<Service Name>>. Now this requires two different connection strings based on the input whether its SID or service name.
    Is there a common connection string for these two? Based on some articles like this, I understood that we can generically use jdbc:oracle:thin:@<<server>:<<port>>/<<service>>, whether for SID and service.
    When I tried this format with SID, I am getting the below error. What I tried is jdbc:oracle:thin:@myoracleserver:1521/ORCL, where ORCL is the SID
    java.sql.SQLException: Listener refused the connection with the following error:
    ORA-12514, TNS:listener does not currently know of service requested in connect descriptor
    Request your help in solving this. What I want is a single connection string whether its SID or service. Any help is of great value.
    Oracle has an entire book for JDBC: The JDBC Developer Guide.
    There are chapters that provide ALL of the connection properties and the rules for creating connection urls.
    http://docs.oracle.com/cd/E11882_01/java.112/e16548/urls.htm#BEIDBFDF
    See table 8-3 in that doc

Maybe you are looking for