$conn = ocilogon('user','abc123','');



Csdn user default icon
如何使用PHP 7连接到Oracle 11?

<div class="post-text" itemprop="text"> <p>The problem is, i have an application that the client demands it runs under Oracle DB.</p> <p>I already have Client 11c installed, as well as Oracle Database.</p> <p>My PHP was built using the following configuration:</p> <pre><code>"--with-pdo-oci=c:\php-snap-build\deps_aux\oracle\x64\instantclient_12_1\sdk,shared" </code></pre> <p>So i copied the instant client to this folder, and put it in the system path as well.</p> <p>Still i'm getting:</p> <pre><code>PS C:\php&gt; php -m PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_oci' (tried: ./ext\pdo_oci (The specified module could not be found.), ./ext\php_pdo_oci.dll (%1 is not a valid Win32 application.)) in Unknown on line 0 </code></pre> <p>When trying to run php -m with display_startup_errors = on</p> <p>I've tried download other PHP Binaries and looked up on every possible corner of the internet.</p> <p>Can anyone help me solve this?</p> <p>P.S. PDO is a must.</p> <p>Thanks in advance!</p> </div>

使用php 5.6连接到远程oracle数据库

<div class="post-text" itemprop="text"> <p>I have two machines:</p> <ol> <li>Windows 7 x64</li> <li>Windows server 2012 R2 x64</li> </ol> <p>In the first machine I installed:</p> <ul> <li>Apache 2.4 TS VC11</li> <li>PHP 5.6.19 TS VCC</li> <li><a href="" rel="nofollow">php_oci8-2.0.8-5.6-ts-vc11-x64</a></li> </ul> <p>I connect to local/remote oracle databases without problem. </p> <p>The second machine is a fresh server installation, it does not have local oracle dabatases, nothing. The idea is to connect to a remote oracle instace. So I made the same installation (apache and php with same versions as first machine), but the first error I found was that the oci8_11g extension is not loaded. My question is, do I need to install some "driver" or "client" for oracle in this server? The apache instance and php work as expected except with error mentioned.</p> </div>

PHP ODBC连接到Oracle,没有UTF-8

<div class="post-text" itemprop="text"> <p>I am having a problem to get UTF-8 support, when i try to connect to Oracle throught ODBC Data Source with PHP <code>odbc_connect()</code>.</p> <p>Also all of this is being done under 32bits. I am using oracle XE DB for testing and instaclient11_2 32bit drivers, ODBC Data source 32it +placed on WAMP32bit server.</p> <p>Althougt i have same result with Oracle 12c DB and client Home 10g 32bit drivers.</p> <p>@TODAY Tested this all with 64bit instanclient drivers, added ODBC 64DataSource on 64bit WAMP Server. Still no luck to display chars corretly...</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt; &lt;/head&gt; &lt;body&gt; &lt;?php $connect = odbc_connect("XEXDB", "username", "password"); $query = "SELECT col, 'čaļi' FROM TESST"; $result = odbc_exec($connect, $query); while(odbc_fetch_row($result)){ $name = odbc_result($result, 1); $surname = odbc_result($result, 2); echo "$name, $surname &lt;br/&gt;"; } odbc_close($connect); ?&gt; </code></pre> <p> </p> <p>Result i get from this code:</p> <pre><code>?A?IS, A?aA?i Gunt?rs Salts, A?aA?i </code></pre> <p>But should be:</p> <pre><code>ĶAĶIS, čaļi Guntārs Šalts, čaļi </code></pre> <p>I cant find how to write <code>$dsn</code> for <code>odbc_connect()</code> to force <code>charset=utf-8</code>, so far no luck to get working $conn_string with <code>charset=utf-8</code>.</p> <p>Also tried to use <code>utf8_encode()</code> and <code>utf8_decode()</code>(using this was me being desperate).</p> <p>Does anyone have had similar problem, or maybe someone have some suggestions i could try?</p> </div>

无法使用PHP与XAMPP连接到Oracle Database 11g

<div class="post-text" itemprop="text"> <p>Installed XAMMP and PHP 5.6.31 using Oracle instaclient_11_2 already in the C:\drive. Edited and enabled <code>extension=php_oci8_11g.dll</code> in <code>php.ini</code>. Installed <code>php_oci8_11g.dll</code> in <code>C:\xampp\php\ext</code>.</p> <p>What did i miss? </p> <p>PHP returns: </p> <blockquote> <p>Fatal error: Call to undefined function oci_connect() in C:\xampp\htdocs\OC\oci8.php on line 3</p> </blockquote> <pre><code>&lt;?php $conn = oci_connect('hr', 'hr', 'localhost/orcl'); if (!$conn) { $e = oci_error(); trigger_error(htmlentities($e['message'], ENTS_QUOTES),E_USER_ERROR); } else echo "connection successful"; ?&gt; </code></pre> </div>

PHP连接到远程Oracle DB

<div class="post-text" itemprop="text"> <p>I am having trouble connecting to a remote oracle DB from PHP. I have been following instructions on the web and when I try to install oci8, I get the following error (last 3 lines):</p> <pre><code>sudo pecl install oci8-1.3.4.tgz [sudo] password for denny: downloading oci8-1.3.4.tgz ... Starting to download oci8-1.3.4.tgz (134,240 bytes) .............................done: 134,240 bytes 10 source files, building running: phpize Configuring for: PHP Api Version: 20121113 Zend Module Api No: 20121212 Zend Extension Api No: 220121212 Please provide the path to the ORACLE_HOME directory. Use 'instantclient,/path/to/instant/client/lib' if you're compiling with Oracle Instant Client [autodetect] : /opt/oracle/instantclient building in /tmp/pear/temp/pear-build-rootGYzIDo/oci8-1.3.4 running: /tmp/pear/temp/oci8/configure --with-oci8=/opt/oracle/instantclient checking for grep that handles long lines and -e... /bin/grep checking for egrep... /bin/grep -E checking for a sed that does not truncate output... /bin/sed checking for cc... cc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether cc accepts -g... yes checking for cc option to accept ISO C89... none needed checking how to run the C preprocessor... cc -E checking for icc... no checking for suncc... no checking whether cc understands -c and -o together... yes checking for system library directory... lib checking if compiler supports -R... no checking if compiler supports -Wl,-rpath,... yes checking build system type... x86_64-unknown-linux-gnu checking host system type... x86_64-unknown-linux-gnu checking target system type... x86_64-unknown-linux-gnu checking for PHP prefix... /usr checking for PHP includes... -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib checking for PHP extension directory... /usr/lib/php5/20121212 checking for PHP installed headers prefix... /usr/include/php5 checking if debug is enabled... no checking if zts is enabled... no checking for re2c... no configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers. checking for gawk... gawk checking for Oracle (OCI8) support... yes, shared checking PHP version... 5.5.9, ok checking Oracle Install Directory... /opt/oracle/instantclient checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking size of long int... 8 checking if we're on a 64-bit platform... yes checking OCI8 libraries dir... configure: error: Oracle (OCI8) required libraries not found ERROR: `/tmp/pear/temp/oci8/configure --with-oci8=/opt/oracle/instantclient' failed </code></pre> <p>I downloaded the oracle instantclient, for linux 64-bit, from the oracle website (<a href="" rel="nofollow"></a>) and unzipped in the folder /opt/oracle. some help will be appreciated.</p> </div>


在LINUX CentOS6.5+PHP5.6环境下,要连接使用Oracle 11g 现在有: (1)D机:数据库服务器,为Oracle 11g (2)C1台式机:安装有 LINUX CentOS6.5+PHP5.6环境和OCI8 (3)C2笔记本机:LINUX CentOS6.5+PHP5.6环境和OCI8 (4)一个PHP WEB程序 在C2机上,PHP WEB程序连接使用D机 oracle正常。 在C1机上,同样的PHP WEB程序连接使用D机 oracle 时,即使OCI8文件已经给最高权限文件和777,还是一直提示: SQLSTATE[HY000]:pdo_oci_handle_factory:ORA-12546:TNS:permission denied (/root/PDO_OCI-1.0/oci_driver.c:463) 请问应该如何解决?![图片说明](

php用oci_connect()无密码连接oracle 提示权限不足

感谢浏览! Centos 6.2 php 5.3.6 oracle 11g 1.4.4 用oci_connect("system","JCB410","VPMSDBS",null,OCI_DEFAULT); (VPMSDBS 为$ORACLE_SID) 和oci_connect("/","","php_ora_usr",null,OCI_CRED_EXT); (php_ora_usr 为wallet连接串) 均可以连接上 但用oci_connect("/","","VPMSDBS",null,OCI_CRED_EXT+OCI_SYSDBA); 链接时提示:oci_connect():ORA-01031:insufficient privileges


<div class="post-text" itemprop="text"> <p>I am trying to connect to Oracle database which is not on my PC. I have installed Xampp, PHP and Oracle instant Client. I have added a windows environmental path to C:\instantclient_11_1. The Oci8 is enabled too when I check from phpinfo(). I have added the extension extension_dir = C:\php-5.4.0\ext to the php.ini and also enabled extension=php_oci8_11g.dll. Then when I try to connect to the database using the code below:</p> <pre><code> &lt;?php $conn = oci_connect('username', 'password'); $query = 'select table_name from user_tables'; ?&gt; </code></pre> <p>It says Warning: oci_connect(): ORA-12560: TNS:protocol adapter error. Could anyone help?</p> </div>


<div class="post-text" itemprop="text"> <p>I need to connect oracle 11g database with my xampp server and I need both local and remote connection. For that what I did is first I installed the oracle 11g express edition and the downloaded the <code>instantclient-basic-nt-</code> and placed the extracted folder <code>instantclient_11_2</code> in <code>C:\</code> then I set the environment variable (system variables) and my path value looks like this <code>path=C:\oraclexe\app\oracle\product\11.2.0\server\bin;C:\instantclient_11_2</code>.</p> <p>Then I removed the <code>;</code> before <code>extension=php_oci8.dll</code> and <code>extension=php_oci8_11g.dll</code> from the <code>php.ini</code> file. Then first I tried to connect with my local database:</p> <pre><code>$tns_turjo = '(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = XE)))'; // tns of another pc $tns_ishrak = '(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = XE)))'; // tns of my pc $conn = oci_connect('system', 'cibl123*#', $tns_turjo); if($conn) { echo "connected"; } else { echo "not"; } </code></pre> <p>When I pass <code>$tns_ishrak</code> it echoes <code>connected</code> but when I try to access the oracle database of another pc i.e. use the <code>$tns_turjo</code> then it echoes <code>not</code> and the error is </p> <pre><code>Message: oci_connect(): ORA-12170: TNS:Connect timeout occurred </code></pre> <p>I have also changed the username and password while connecting to another pc.</p> <p>N.B. After enabling the .dll extensions from the php.ini file whenever I start the Apache I get a pop up warning in xampp which is <code>Module 'oci8' is already loaded</code> </p> <p>How can I solve the remote connection issue?</p> </div>

从PHP oci8连接到oracle数据库

<div class="post-text" itemprop="text"> <p>I'm trying to access the ORACLE database from PHP, i'm using WampServer Version 2.2 Apache 2.4.2 – PHP 5.4.3 and oracle 11g. I tried many ways including :</p> <pre><code>&lt;?php if ($conn = oci_connect('sys as sysdba', '12345', '//localhost/orcl')) { print 'Successfully connected to Oracle Database!'; } else { $errmsg = oci_error(); print 'Oracle connection failed' . $errmsg['message']; } ?&gt; </code></pre> <p>i get the following error every time i execute:</p> <pre><code>Fatal error: Call to undefined function OCILogon() in C:\wamp\www\IDS\Index.php on line 3 </code></pre> <p>Does anyone know how to solve this ??</p> </div>


<div class="post-text" itemprop="text"> <p>I'm developing a website in PHP that interacts with Oracle10g remote server database. I've googled on this topic a lot and couldn't find a solution, though i got some idea on tnsnames.ora file. I've installed WAMP in my machine. What are steps to connect to Oracle remote database?? Can any one explain it step by step?? I created a site which connects to MySQL datebase a year ago which wasn't this much tough.</p> <pre><code>$con = oci_connect('username', 'password', '//server ip:port/service name'); </code></pre> <p>It's throwing "Call to undefined function oci_connect()" error.</p> </div>


<div class="post-text" itemprop="text"> <p>I've searched everywhere in google for a solution but I'm still unable to connect to oracle using PHP.</p> <p>I have the following in my php file</p> <pre><code>$conn = oci_connect("username","password", "sid"); </code></pre> <p>However, when ever I try and access the php page, I am getting the same error </p> <pre><code>Fatal error: Call to undefined function oci_connect() in C:\xampp\htdocs\consult.php on line 5. </code></pre> <p>In XAMPP folders I've looked at the php.ini file and removed the leading semicolon so that I'm left with <code>extension=php_oci8_11g.dll</code>.</p> <p>I restarted XAMPP, and I'm getting oci8.dll doesn't exist. I then downloaded oracle instant client but I'm slightly confused as to which folder it is supposed to be placed in.</p> </div>

使用oracle 10g和php在单个数据库连接中执行多个查询

<div class="post-text" itemprop="text"> <p>I want to run multiple sql queries in a single database connection using oracle 10g and php. Here for every sql query queries I have to create database connection. Is there any way to run multiple sql queries in a single database connection or we have to fetch data this way only? Because when we have to run 50 queries, we have to write 50 times like below. </p> <pre><code>&lt;?php include("mydb.php"); // run query $sql6 = "select * from dat where to_char(WD,'dd/mm')='19/08'"; $stid6=oci_parse($conn, $sql6); // set array $arr6 = array(); if(!$stid6){ $e=oci_error($conn); trigger_error(htmlentities($e[message],ENT_QUOTES),E_USER_ERROR); } $r6=oci_execute($stid6); if(!$r6){ $e=oci_error($stid6); trigger_error(htmlentities($e[message],ENT_QUOTES),E_USER_ERROR); } // look through query while($row = oci_fetch_array($stid6,OCI_ASSOC)){ // add each row returned into an array $arr6[] = array(($row['WD']) , (float)$row['DATA']); } oci_free_statement($stid6); oci_close($conn); ?&gt; &lt;?php include("mydb.php"); // run query $sql7 = "select * from dat where to_char(WD,'dd/mm')='11/03'"; $stid7 = oci_parse($conn, $sql7); // set array $arr7 = array(); if(!$stid7){ $e=oci_error($conn); trigger_error(htmlentities($e[message],ENT_QUOTES),E_USER_ERROR); } $r7=oci_execute($stid7); if(!$r7){ $e=oci_error($stid7); trigger_error(htmlentities($e[message],ENT_QUOTES),E_USER_ERROR); } // look through query while($row = oci_fetch_array($stid7,OCI_ASSOC)){ // add each row returned into an array $arr7[] = array(($row['WD'])) , (float)$row['DATA']); } oci_free_statement($stid7); oci_close($conn); ?&gt; ................ ................ </code></pre> <p>*Pardon me, I forgot to mention that we have store day-wise data in different array. I mean to say that 11/03's data will store in arr1 and 19/08's data will be stored in arr2. Not in same array.</p> </div>


我win7 64位系统,jdk是64位的1.7版本,oracle装的是32的10g,客户端跟服务器端都装了 ,我在用jdbc:oracle:oci方式连接数据库时连接失败,而用jdbc:oracle:thin方式就行,错误如下: java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.context.TestContext.getApplicationContext( at at at org.springframework.test.context.TestContextManager.prepareTestInstance( at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest( at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall( at at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock( at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild( at org.junit.runners.BlockJUnit4ClassRunner.runChild( at org.junit.runners.ParentRunner$ at org.junit.runners.ParentRunner$1.schedule( at org.junit.runners.ParentRunner.runChildren( at org.junit.runners.ParentRunner.access$000( at org.junit.runners.ParentRunner$2.evaluate( at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate( at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate( at at at at at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests( at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests( at at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main( Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [beans.xml]: Invocation of init method failed; nested exception is java.lang.UnsatisfiedLinkError: E:\Ebook\JavaSE\develop\Oracle\product\10.2.0\client_1\BIN\ocijdbc10.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform at at at at$1.getObject( at at at at at at at at at org.springframework.test.context.TestContext.loadApplicationContext( at org.springframework.test.context.TestContext.getApplicationContext( ... 24 more Caused by: java.lang.UnsatisfiedLinkError: E:\Ebook\JavaSE\develop\Oracle\product\10.2.0\client_1\BIN\ocijdbc10.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary1( at java.lang.ClassLoader.loadLibrary0( at java.lang.ClassLoader.loadLibrary( at java.lang.Runtime.loadLibrary0( at java.lang.System.loadLibrary( at oracle.jdbc.driver.T2CConnection$ at Method) at oracle.jdbc.driver.T2CConnection.loadNativeLibrary( at oracle.jdbc.driver.T2CConnection.logon( at oracle.jdbc.driver.PhysicalConnection.<init>( at oracle.jdbc.driver.T2CConnection.<init>( at oracle.jdbc.driver.T2CDriverExtension.getConnection( at oracle.jdbc.driver.OracleDriver.connect( at org.apache.commons.dbcp.DriverConnectionFactory.createConnection( at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject( at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory( at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory( at org.apache.commons.dbcp.BasicDataSource.createDataSource( at org.apache.commons.dbcp.BasicDataSource.getConnection( at org.apache.ibatis.mapping.VendorDatabaseIdProvider.getDatabaseProductName( at org.apache.ibatis.mapping.VendorDatabaseIdProvider.getDatabaseName( at org.apache.ibatis.mapping.VendorDatabaseIdProvider.getDatabaseId( at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory( at org.mybatis.spring.SqlSessionFactoryBean.afterPropertiesSet( at at ... 37 more 这个有什么解决办法吗


Oracle数据库表a有area,value,date三个字段,存放着两个地区每日的统计数据: Area Value date 海淀 12 2012-01-01 朝阳 19 2012-01-01 海淀 14 2012-01-02 请写出一条SQL语句得到如下格式结果: “日期、海淀统计数、朝阳统计数、总数” 如:2012-01-01、12、19、31


请解答一下。谢谢! ![图片说明]( ``` 使用SELECT FOR UPDATE语句加锁。 --打开SQL*Plus客户端(会话1) SQL> UPDATE test SET name ='赵六' WHERE id=4; SQL> ROLLBACK; --再打开另一个SQL*Plus客户端(会话2) SQL> SELECT * FROM test FOR UPDATE NOWAIT; SQL> SELECT * FROM test FOR UPDATE WAIT 3; SQL> SELECT * FROM test FOR UPDATE; SQL> ROLLBACK; ```


<div class="post-text" itemprop="text"> <p>I am not able to solve this error I am getting only from the Web Browser. I am trying to connect to a remote Oracle DB using PDO_ODBC in PHP. I think all is well configured, because when I try to connect using sqlplus or isql all is OK! When I try to connect from the Web Browser, firstly it gives a successful connection but with only a simply refresh of the page I got the error in object.</p> <p>This is all my environment:</p> <pre><code>odbcinst -j unixODBC 2.3.1 DRIVERS............: /etc/odbcinst.ini SYSTEM DATA SOURCES: /etc/odbc.ini FILE DATA SOURCES..: /etc/ODBCDataSources USER DATA SOURCES..: /var/www/html/.odbc.ini SQLULEN Size.......: 8 SQLLEN Size........: 8 SQLSETPOSIROW Size.: 8 /etc/odbc.ini [esecns_test] Driver = OracleODBC-11g DSN = OracleODBC-11g ServerName = ESECNS_TEST UserID = **** Password = **** /etc/ [OracleODBC-11g] Description = Oracle ODBC driver for Oracle 11g Driver = /usr/lib/oracle/12.2/client64/lib/ Setup = FileUsage = 1 CPTimeout = 5 CPReuse = 5 Driver Logging = 7 [ODBC] Trace = Yes TraceFile = /tmp/odbc.log ForceTrace = Yes Pooling = No DEBUG = 1 Example driver definitions # Driver from the postgresql-odbc package # Setup from the unixODBC package [PostgreSQL] Description = ODBC for PostgreSQL Driver = /usr/lib/ Setup = /usr/lib/ Driver64 = /usr/lib64/ Setup64 = /usr/lib64/ FileUsage = 1 # Driver from the mysql-connector-odbc package # Setup from the unixODBC package [MySQL] Description = ODBC for MySQL Driver = /usr/lib/ Setup = /usr/lib/ Driver64 = /usr/lib64/ Setup64 = /usr/lib64/ FileUsage = 1 /etc/oracle/tnsnames.ora ESECNS_TEST = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = ) ) -bash-4.2$ ldd =&gt; (0x00007ffeed87c000) =&gt; /usr/lib64/ (0x00007f5cc7a19000) =&gt; /usr/lib64/ (0x00007f5cc7716000) =&gt; /usr/lib64/ (0x00007f5cc74fa000) =&gt; /usr/lib64/ (0x00007f5cc72e1000) =&gt; /usr/lib64/ (0x00007f5cc70d8000) =&gt; /usr/lib64/ (0x00007f5cc6ed6000) =&gt; /usr/lib64/ (0x00007f5cc6cbc000) =&gt; /usr/lib/oracle/12.2/client64/lib/ (0x00007f5cc3216000) =&gt; /usr/lib/oracle/12.2/client64/lib/ (0x00007f5cc2c48000) =&gt; /usr/lib64/ (0x00007f5cc2a36000) =&gt; /usr/lib64/ (0x00007f5cc2674000) =&gt; /usr/lib64/ (0x00007f5cc245e000) /lib64/ (0x00007f5cc7ee1000) =&gt; /usr/lib/oracle/12.2/client64/lib/ (0x00007f5cc21e7000) =&gt; /usr/lib/oracle/12.2/client64/lib/ (0x00007f5cc1db3000) =&gt; /usr/lib/oracle/12.2/client64/lib/ (0x00007f5cc166a000) =&gt; /usr/lib/oracle/12.2/client64/lib/ (0x00007f5cc141c000) =&gt; /usr/lib64/ (0x00007f5cc1211000) -bash-4.2$ printenv XDG_SESSION_ID=381 HOSTNAME=cmapps-test TERM=xterm SHELL=/bin/bash HISTSIZE=1000 61528 22 SSH_TTY=/dev/pts/2 USER=cmapps TWO_TASK=// LD_LIBRARY_PATH=/usr/lib64:/usr/lib/oracle/12.2/client64/lib LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=01;36:*.au=01;36:*.flac=01;36:*.mid=01;36:*.midi=01;36:*.mka=01;36:*.mp3=01;36:*.mpc=01;36:*.ogg=01;36:*.ra=01;36:*.wav=01;36:*.axa=01;36:*.oga=01;36:*.spx=01;36:*.xspf=01;36: TNS_ADMIN=/etc/oracle MAIL=/var/spool/mail/cmapps PATH=/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin PWD=/usr/lib/oracle/12.2/client64/lib LANG=en_US.UTF-8 HISTCONTROL=ignoredups SHLVL=1 HOME=/var/www/html LOGNAME=cmapps 61528 22 LESSOPEN=||/usr/bin/ %s XDG_RUNTIME_DIR=/run/user/1000 ORACLE_HOME=/usr/lib/oracle/12.2/client64 _=/usr/bin/printenv OLDPWD=/var/www/html isql -v ESECNS_TEST +---------------------------------------+ | Connected! | | | | sql-statement | | help [tablename] | | quit | | | +---------------------------------------+ SQL&gt; sqlplus64 *****/******@ESECNS_TEST SQL*Plus: Release Production on Mon May 8 15:18:26 2017 Copyright (c) 1982, 2016, Oracle. All rights reserved. Connesso a: Oracle Database 11g Enterprise Edition Release - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL&gt; </code></pre> <p><a href="" rel="nofollow noreferrer">Connection OK</a></p> <p><a href="" rel="nofollow noreferrer">Connection error after refresh page</a></p> </div>


<div class="post-text" itemprop="text"> <p><strong>Working code-</strong></p> <pre><code>$dbh = new PDO('oci:dbname=localhost/XE', 'hr', 'hr'); $s = $dbh-&gt;prepare("select * from Employees"); $s-&gt;execute(); while (($r = $s-&gt;fetch(PDO::FETCH_ASSOC)) != false) { echo htmlentities($r['FIRST_NAME']) . " " . $r['LAST_NAME'] . "&lt;br&gt;"; } </code></pre> <p><strong>Not working code</strong> <strong><em>(Error-Call to undefined function oci_connect(), oci_new_connect())</em></strong></p> <pre><code>/*Using oci_connect */ $conn=oci_connect("hr","hr","localhost/XE"); If (!$conn) echo 'Failed to connect to Oracle'; else echo 'Succesfully connected with Oracle DB'; oci_close($conn); /*Using oci_new_connect*/ $c = oci_new_connect('hr', 'hr', 'localhost/XE'); $s = oci_parse($c, 'select city from locations'); oci_execute($s); while (($res = oci_fetch_array($s, OCI_ASSOC)) != false) { echo htmlentities($res['CITY']) . "&lt;br&gt;"; } </code></pre> <p>phpinfo are as <a href="" rel="nofollow noreferrer">phpinfo details</a> I have placed instantclient for 11g in c and set PATH variable also</p> <hr> <p><strong>Tried every instantclient extensions one by one-</strong> </p> <ol> <li>extension=php_oci8.dll, </li> <li>extension=php_oci8_11g.dll,</li> <li>extension=php_oci8_12c.dll</li> </ol> <p><strong>I am using Oracle 11g</strong></p> <p>Tried also- <a href="">this</a> and <a href="">this also</a></p> </div>

左外连接的条件谓词评估较晚,导致性能问题。 Oracle 8i

<div class="post-text" itemprop="text"> <p>This is on Oracle 8i (sorry, no control over this) and PHP 7.</p> <p>I am building a search tool. It's a simple form with 3 fields, using HTTP Post method. PHP then does some checks on the 3 fields' values, determines if they are valid and then sends the values off to the SQL query. The query looks something like this; remember its 8i so no ANSI join here :</p> <pre><code>SELECT reports_table.*, documents_table.*, cases_table.* FROM reports_table, documents_table, cases_table WHERE reports_table.report_id = documents_table.report_id AND reports_table.report_id = cases_table.report_id(+) -- Report Number filtering AND reports_table.report_no = CASE WHEN $report_no_isvalid = 1 THEN '$report_no' -- Oracle expects datatype varchar2 ELSE reports_table.report_no END -- Document Number filtering AND documents_table.document_no = CASE WHEN $doc_no_isvalid = 1 THEN $doc_no -- Oracle expects datatype number ELSE documents_table.document_no END -- Case Number filtering AND cases_table.case_no = CASE WHEN $case_no_isvalid = 1 THEN '$case_no' -- Oracle expects datatype varchar2 ELSE cases_table.case_no END </code></pre> <p>The user is required to enter at least a Report Number, or a Case Number. The full numbers are required, i.e. no wildcard search is allowed. The <code>reports_table</code> is very large. When searching by Report Number, the database takes a very long time as if the CASE evaluation that acts on the validity of the Report Number, i.e. this section of code here</p> <pre><code>AND reports_table.report_no = CASE WHEN $report_no_isvalid = 1 THEN '$report_no' -- Oracle expects datatype varchar2 ELSE reports_table.report_no END </code></pre> <p>is being evaluated after the joining operation. It seems to be indeed evaluated though, because if I add another simple predicate in the WHERE clause to limit the scope on the Report Number, the database answers very fast, with the expected result. e.g. lets say the Report Number I'm searching for is 'R123456', if I add <code>AND reports_table.report_no LIKE 'R1234%'</code>, as a predicate outside of the CASE statement, the performance is good. Otherwise it is extremely slow, as if Oracle is scanning the whole <code>reports_table</code> in trying to make the join.</p> <p>I would like to find a way to tell Oracle to ensure its looking at the conditional CASE filter on the Report Number when performing the join but I have no idea how. Or maybe I should avoid altogether that kind of conditional restriction on the join, and if so, what technique could I use to achieve what I'm trying to do?</p> </div>


大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...


今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...


一 前言 此篇文章的内容也是学习不久,终于到周末有时间码一篇文章分享知识追寻者的粉丝们,学完本篇文章,读者将对token类的登陆认证流程有个全面的了解,可以动态搭建自己的登陆认证过程;对小项目而已是个轻量级的认证机制,符合开发需求;更多精彩原创内容关注公主号知识追寻者,读者的肯定,就是对作者的创作的最大支持; 二 jwt实现登陆认证流程 用户使用账号和面发出post请求 服务器接受到请求后使用私...

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...



总结了 150 余个神奇网站,你不来瞅瞅吗?



提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...






私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...




今天给你们讲述一个外包程序员的幸福生活。男主是Z哥,不是在外包公司上班的那种,是一名自由职业者,接外包项目自己干。接下来讲的都是真人真事。 先给大家介绍一下男主,Z哥,老程序员,是我十多年前的老同事,技术大牛,当过CTO,也创过业。因为我俩都爱好喝酒、踢球,再加上住的距离不算远,所以一直也断断续续的联系着,我对Z哥的状况也有大概了解。 Z哥几年前创业失败,后来他开始干起了外包,利用自己的技术能...


场景 日常开发,if-else语句写的不少吧??当逻辑分支非常多的时候,if-else套了一层又一层,虽然业务功能倒是实现了,但是看起来是真的很不优雅,尤其是对于我这种有强迫症的程序"猿",看到这么多if-else,脑袋瓜子就嗡嗡的,总想着解锁新姿势:干掉过多的if-else!!!本文将介绍三板斧手段: 优先判断条件,条件不满足的,逻辑及时中断返回; 采用策略模式+工厂模式; 结合注解,锦...

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...


阿里巴巴全球数学竞赛( Alibaba Global Mathematics Competition)由马云发起,由中国科学技术协会、阿里巴巴基金会、阿里巴巴达摩院共同举办。大赛不设报名门槛,全世界爱好数学的人都可参与,不论是否出身数学专业、是否投身数学研究。 2020年阿里巴巴达摩院邀请北京大学、剑桥大学、浙江大学等高校的顶尖数学教师组建了出题组。中科院院士、美国艺术与科学院院士、北京国际数学...


不知道是不是只有我这样子,还是你们也有过类似的经历。 上学的时候总有很多光辉历史,学年名列前茅,或者单科目大佬,但是虽然慢慢地长大了,你开始懈怠了,开始废掉了。。。 什么?你说不知道具体的情况是怎么样的? 我来告诉你: 你常常潜意识里或者心理觉得,自己真正的生活或者奋斗还没有开始。总是幻想着自己还拥有大把时间,还有无限的可能,自己还能逆风翻盘,只不是自己还没开始罢了,自己以后肯定会变得特别厉害...






当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...


HashMap底层实现原理,红黑树,B+树,B树的结构原理 Spring的AOP和IOC是什么?它们常见的使用场景有哪些?Spring事务,事务的属性,传播行为,数据库隔离级别 Spring和SpringMVC,MyBatis以及SpringBoot的注解分别有哪些?SpringMVC的工作原理,SpringBoot框架的优点,MyBatis框架的优点 SpringCould组件有哪些,他们...


硅谷科技公司上班时间OPEN早已不是什么新鲜事,早九晚五是常态,但有很多企业由于不打卡,员工们10点、11点才“姗姗来迟”的情况也屡见不鲜。 这种灵活的考勤制度为人羡慕,甚至近年来,国内某些互联网企业也纷纷效仿。不过,硅谷普遍弹性的上班制度是怎么由来的呢?这种“流行性迟到”真的有那么轻松、悠哉吗? 《动态规划专题班》 课程试听内容: 动态规划的解题要领 动态规划三大类 求最值/计数/可行性 常...






爬取彼岸桌面网站较为简单,用到了requests、lxml、Beautiful Soup4


编程语言层出不穷,从最初的机器语言到如今2500种以上的高级语言,程序员们大呼“学到头秃”。程序员一边面临编程语言不断推陈出新,一边面临由于许多代码已存在,程序员编写新应用程序时存在重复“搬砖”的现象。 无代码/低代码编程应运而生。无代码/低代码是一种创建应用的方法,它可以让开发者使用最少的编码知识来快速开发应用程序。开发者通过图形界面中,可视化建模来组装和配置应用程序。这样一来,开发者直...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?





已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...


前几天我们公司做了一件蠢事,非常非常愚蠢的事情。我原以为从学校出来之后,除了找工作有测试外,不会有任何与考试有关的事儿。 但是,天有不测风云,公司技术总监、人事总监两位大佬突然降临到我们事业线,叫上我老大,给我们组织了一场别开生面的“考试”。 那是一个风和日丽的下午,我翘着二郎腿,左手端着一杯卡布奇诺,右手抓着我的罗技鼠标,滚动着轮轴,穿梭在头条热点之间。 “淡黄的长裙~蓬松的头发...


在2019年的ReactiveConf 上,《Elm in Action》的作者Richard Feldman对未来5年Web开发的发展做了预测,很有意思,分享给大家。如果你有机会从头...