Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
My tools are as follows
Ubuntu server 16
PHP7
oci8
codeigniter
Oracle DB
I have php7 with oci8 successfully running by installing the basic and devel .rpm files from oracle's website.
I'm able to successfully connect to my oracle database and return data through my webpage.
The issue I'm having is the time to execute the query is about twice as long as it is on my PRD server that is using an ODBC connection and a driver from actual oracle on OS X (Mac). I'm not sure why the performance would be twice as slow. Especially considering this server's hardware capabilities are much more powerful.
Any help is greatly appreciated.
Thanks
EDIT: After actually measuring the execution times alone, it looks like they truly are faster on the new server. The page load seems to be slower because of codeigniter's oci8 driver, I'd have to guess.
DRCP Connection Pooling
PHP from 5.3 (PECL OCI8 1.3) supports Oracle Database Resident Connection Pooling (DRCP). DRCP allows more efficient use of database machine memory and provides high scalability. No, or minimal, application changes are needed to use DRCP.
DRCP is suited for applications that connect using few database schemas and hold database connections open for a short period of time. Other applications should use Oracle's default Dedicated database server processes, or use Shared servers.
DRCP benefits all three connection functions, but gives the highest scalability when connections are created with oci_pconnect().
For DRCP to be available in OCI8, Oracle client libraries used by PHP and the version of the Oracle Database must both be 11g or greater.
Documentation on DRCP is found in several Oracle manuals. For example, see » Configuring Database Resident Connection Pooling in the Oracle documentation for usage information. A » DRCP white paper contains background information on DRCP.
To use DRCP, build PHP with the OCI8 1.3 (or later) extension and Oracle 11g (or later) libraries and then follow these steps:
As a privileged database administrator, use a program like SQL*Plus to start the connection pool in the database:
SQL> execute dbms_connection_pool.start_pool;
Optionally use dbms_connection_pool.alter_param() to configure DRCP settings. The current pool settings can be queried from the DBA_CPOOL_INFO view.
Update the connection strings used. For PHP applications that currently connect using a Network Connect Name like MYDB:
$c = oci_pconnect("myuser", "mypassword", "MYDB");
modify the tnsnames.ora file and add a (SERVER=POOLED) clause, for example:
MYDB = (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp) (HOST=myhost.dom.com)
(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=sales)
(SERVER=POOLED)))
Alternatively, modify the Easy Connect syntax in PHP and add :POOLED after the service name:
$c = oci_pconnect("myuser", "mypassword", "myhost.dom.com:1521/sales:POOLED");
Edit php.ini and choose a connection class name. This name indicates a logical division of the connection pool and can be used to isolate pooling for separate applications. Any PHP applications with the same user name and connection class value will be able to share connections in the pool, giving greater scalability.
oci8.connection_class = "MY_APPLICATION_NAME"
Run the application, connecting to the 11g (or later) database.
Related
I have only used db links to get access to remote db so far. Now I have to find a way to use JDBC to connect to remote db and get data. Can someone guide me what all things would I need to ask the remote db admin in order to setup a jdbc connection, and once I have the connection, how do I query the database using java stored procedure, just like I am querying it over remote db right now with db link?
You've described a fairly complicated problem, but haven't given any information about your database or operating system. Are you connecting to a SQL Server database? MySQL? Are you running on Linux? Windows?
First, you'll need a driver. That's going to depend on the database, operating system and versions thereof that you're using. For example, here is the Microsoft ODBC Driver for SQL Server (Oops, looks like it's currently unavailable.)
Second, you need to set up Oracle Heterogenous Services. That's fairly complicated and not something I can answer here. You might start with the Database Gateway for ODBC User's Guide.
Oracle does have gateways for various other databases, but they're licensed additionally from the database itself.
I am new to Oracle database in general, but I'm attempting to get Oracle's SQL Developer running on a workstation that has pre-configured System DSNs created for an OracleRDB database. I've confirmed the ODBC connections are working because I can use MS Access to connect and link to the tables. The "test" options within ODBC also succeed. Now I am trying to get a similar connection created using SQL Developer so I can see the column types and write queries in a more useful editor.
Here's what I have available when examining the ODBC connection properties:
Now I'm trying to create a duplicate connection in SQL Developer, but I'm at a loss for why things don't work. I first tried using the default SQL Developer installation, but couldn't get things working. Then I discovered there's an OracleRDB extension available, so I installed that, but I keep getting this error when attempting to use similar values:
As I stated, these ODBC connections were pre-configured on the workstation I'm using, so I don't know anything more than what is provided by the Oracle ODBC driver window.
Is there something obvious I'm not seeing or doing to replicate this connection in SQL Developer? Or perhaps something else I can do to debug this to learn more?
UPDATE
On the advice of one answer I'm trying to make the connection with JDBC, but having a hard time understanding what I'm doing wrong. Here's another screenshot with the connection parameters I have available, but with the server and database names changed:
With these values (the port came from my tnsnames.ora file), if I try to make a JDBC connection I keep getting the following error from SQL Developer:
One final attempt I did was to use the proper values in the Oracle RDB tab, and when I use them and click 'test' the Testing Connection dialog just spins and never seems to return:
So I apologize for the long post here, but I'm struggling because there's just something I am really not understanding about how this all works. I appreciate everyone who took the time to read this question.
Oracle SQL Developer is a Java Application. You'll need to get the JDBC Driver for RDB.
Once you have that, in the SQL Developer preferences, find the Third Party JDBC section, and then use that to add an entry and point to the JAR for what you just installed.
Step by step instructions here.
Working connection string for RDB Thin Driver:
RDB_DB_CONN_STR = "jdbc:rdbThin://node.myplace.com:1707/";
where node.myplace.com is the name of the OpenVMS node hosting the RDB Thin Driver, 1707 is the port number assigned to the RDB Thin Driver.
We are trying to reproduce an Oracle deadlock issue in our Grails / JBoss 5 / Windows Server 2003 application with The Grinder. We are simulating 800 concurrent users using 8 VM Grinder nodes, but we are only seen one database connection per VM, so somewhere along the line there appears to be some sort of limit.
How can we lift this limit to allow more than one database connection per VM?
Are you trying to connect directly from the Grinder to Oracle? Normally you'd use the Grinder to apply load against your JBoss server, and let JBoss worry about the Oracle connections.
If you really want to go from The Grinder to Oracle, and you want to control exactly how many DB connections you open, it can be done by opening a separate connection for each Grinder threads. Instantiate a new connection in the _init_ method of your TestRunner class. You'll want to avoid using any ORM tools (Hibernate, Ibatis, ...) since they do connection pooling for you and won't let you have direct control of the number of DB connections you open. Use the JDBC API (via jython) instead.
We've a java application running inside JBoss EAP version 5.1 and until today we've always used the standard thin driver to connect to Oracle.
Upon further investigation after having upgraded all our clients to Oracle 11.2.0.2 Jdbc driver and having downloaded all the related files from Oracle site we've found three possible connections than could be used by JBoss
<connection-url>jdbc:oracle:thin:#...</connection-url>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<connection-url>jdbc:oracle:thin:#...</connection-url>
<driver-class>oracle.jdbc.pool.OracleDataSource</driver-class>
<connection-url>jdbc:oracle:thin:#...</connection-url>
<driver-class>oracle.ucp.UniversalConnectionPool</driver-class>
The latest requires the copy of the UCP.JAR file in the JBoss lib directory.
Question is: does somebody experienced the different configurations and found one better than the others in terms of performance and stability?
Regards
Massimo
It depends what type of connection you want. Do you want to set up a pooled connection or not? Generally in mid-tier environments you want to use pooled connections to limit the number of connections to your database and at the same time provide good service times.
1) Direct connection to the database
2) Pooled connection to the database
3) Pooled connection to the database, uses the new UCP pool
We got some answers by RedHat.
Their suggestion was basically to continue using the first option and let JBoss manage the connection pool.
Option number 2 is not a suggested option, while option number 3 is too recent and RedHat does not have experience using it.
Regards
Massimo
I'm very newbie for Oracle and very not sure about Oracle.
one question I want to know.
if I want develop oracle windows application. first I must install oracle on server for database server but I'm not sure if I don't want install oracle on client. I must install oracle for client YES or NO !?
thank for help.
Yes. The Oracle client must be installed on any machine wishing to access the database. The components of the client you need to install will depend on the method your application using. eg. OLEDB, ODBC, etc.
The answer is 'it depends' - your software will need some kind of client-side driver or library for communicating with Oracle, but there are many ways you can do this.
1) Compiling Oracle's SDK libraries directing into your application.
2) Using a locally installed SQL*Net client (which can be shared between different local applications, so that things like TNS_NAMES setup can be shared).
3) Using third-party libraries embedded in your application.
Also the different kinds of clients can expose or restrict different levels of functionality.
You can install Oracle DB and Oracle Client on same Machine. In below order:
Oracle DB
Oracle Client
Do not forget to do an ADMIN Share prior to install Oracle DB.
To Answer the general question; You have to install Oracle Client on any machine needed to connect to the Oracle Database.