Oracle connection with Symfony 5 Doctrine - oracle

I'm trying to connect to my database that's Oracle 11, using Doctrine on Symfony 5, and I get these errors, (I have added the OCI8, and oci8_11 to php.ini, and I have activated the oci8_11 extension) :[see attached].1
My connector in the .env is :
DATABASE_URL="oci8://******:*************#192.aaa.aa.aaa:1521/********"

Related

Why I got duplicate key error collection: sessions index error with jenssegers/mongodb?

I started new laravel 9 (with jet and inertia, without team) app with "jenssegers/mongodb": "^3.9" installed.
I changed connection to mongo MngProducts database and run migrations.
But running homepage with controller defined I got error on second request :
E11000 duplicate key error collection: MngProducts.sessions index: id_1 dup key: { id: "loBh99XTp9cm3Qj17YqKhVFTuxM8bvpd14wczWQa" }
In Compass I see 1 row in sessions : https://prnt.sc/irFNeSAU-zN4
I migrated all default 4 laravel tables(without any data in them) and why I have this error and how that can be fixed?
Thanks!
Setting in .env file :
SESSION_DRIVER=file
fixed this issue.

Connecting a db2 database from a centos hosted laravel application

I'm trying to connect to a db2 database server (iseries ibm) from my laravel application (5.8). The application is running on a centos linux server.
I saw that db2 isn't in the 4 databases types listed here : https://laravel.com/docs/5.8/database#introduction.
So I tried to use that package https://github.com/cooperl22/laravel-db2 but I got the followings errors :
Undefined class constant 'I5_ATTR_DBC_SYS_NAMING'
And I've got the errors for 5 constants :
PDO::I5_ATTR_DBC_SYS_NAMING, PDO::I5_ATTR_COMMIT, PDO::I5_ATTR_JOB_SORT, PDO::I5_ATTR_DBC_LIBL, PDO::I5_ATTR_DBC_CURLIB.
Also, if I comment theses constants, I got this error :
`Syntax error: -104 [IBM][CLI Driver][AS] SQL0104N An unexpected token "<END-OF-STATEMENT>" was found following "". Expected tokens may include: "( + - ? : DAY INF NAN RID ROW RRN". SQLSTATE=42601 (SQLNumResultCols[-104] at /root/PDO_IBM-1.3.6/ibm_driver.c:153) (SQL: select * from )`
I'm using the db2_ibmi_ibm driver.
Here is my php info linked to the driver :
EDITED :
php version is 7.3.4
centos version is 7
Also I made a from scratch php script running and I can get the results from a query using the db2_connection method. So I'm pretty sure it's PDO related :-/
Ok I found the issue, my scheme and database were wrong, so the query wasn't correct.
The PDO constants are not needed in my case.
Thanks for your answers

unable to connect Sql Developer using JDBC URL

I have jdbc URL as follows.
jdbc:oracle:thin:#(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=8888))(LOAD_BALANCE = on)(CONNECT_DATA =(SERVER=DEDICATED) (SERVICE_NAME=XXX.XXX.XXX.XXX.com)))
When I connect using this URL from sql developer getting error as follows.
error ora 00604 error occurred at recursive sql level 1 ora-01882 timezone not found
I'm using Mac. If I go to .sqldeveloper -> 4.1.x -> product.conf.
There was a suggestion to change the tz to AddVMOption -Duser.timezone=CET . But I dont find any file called "sqldeveloper.conf".
Any idea here.
Resolved it by adding timezone values in sqldeveloper in product.conf file.
The path was : /Users/username/.sqldeveloper/4.1.5/product.conf (in MACS).
Added line was:
AddVMOption -Duser.timezone=GMT

Worklight 6.2 migration tool error

I am working on migrating data from WL 5.0.6.2 to 6.2. While doing that I encountered problems running data migration tool.
Background:
Approach:
we export the WRKLGHT table from 5062 DB to an intermediate DB for data migration so the running DB is not affected.
DBs:
1. schema: proj
its storing 5062 runtime data, upgrade-worklight-506-60-oracle.sql, upgrade-worklight-60-61-oracle.sql upgrade sql are executed.
2. schema: proj6
its blank DB at first, "create-worklightadmin-oracle.sql" is executed to prepare WLADMIN tables.
WL Project existing:
1. wlProj
its the app running on 5062 WL server
2. wlProj6
its the target project running on 6.2 WL, and data will be migrated to be used by this project
Steps:
1. recreate proj6 schema
1.1 SQLPlus -> connect as SYSTEM -> "drop user proj6 cascade"
1.2. -> "create user proj6 identified by {password}" -> "grant all privileges to proj6"
2. execute "create-worklightadmin-oracle.sql" on proj6 schema
2.1 SQLDeveloper -> connect as user proj6
2.2 run #"{ WL server install dir}/databases/create-worklightadmin-oracle.sql";
2.3 commit
3. Open cmd and run the following command
java -cp ojdbc6.jar;worklight-ant-deployer.jar com.ibm.worklight.config.dbmigration62.MigrationTool -p /wlProj -sourceurl jdbc:oracle:thin:#//192.168.0.**:1521/xe -sourcedriver oracle.jdbc.driver.OracleDriver -sourceuser proj -sourcepassword *** -targeturl jdbc:oracle:thin:#//192.168.0.***:1521/xe -targetdriver oracle.jdbc.driver.OracleDriver -targetuser proj6 -targetpassword *** 2>out.txt
'migrating wlProj-{ios,android}' & 'migrating access data record for wlProj-.....' are shown in cmd.
And in out.txt, the following error is shown.
15 WorklightManagementPU-oracle INFO [main] openjpa.Runtime - Starting OpenJPA 1.2.2
15 WorklightManagementPU-oracle INFO [main] openjpa.jdbc.JDBC - Using dictionary class "org.apache.openjpa.jdbc.sql.OracleDictionary".
com.ibm.worklight.config.dbmigration62.exceptions.MigrationException: FWLSE3406E: The applications migration failed with error The field "description" of instance "ApplicationEntity[id=51, name=wlProj, displayName=, description=null, thumbnail=null, platformVersion=null]" contained a null value; the metadata for this field specifies that nulls are illegal..
at com.ibm.worklight.config.dbmigration62.MigrationTool.run(MigrationTool.java:195)
at com.ibm.worklight.config.dbmigration62.MigrationTool.main(MigrationTool.java:128)
Caused by: <openjpa-1.2.2-r422266:898935 fatal user error> org.apache.openjpa.persistence.InvalidStateException: The field "description" of instance "ApplicationEntity[id=51, name=wlProj, displayName=, description=null, thumbnail=null, platformVersion=null]" contained a null value; the metadata for this field specifies that nulls are illegal.
at org.apache.openjpa.kernel.SingleFieldManager.preFlush(SingleFieldManager.java:540)
at org.apache.openjpa.kernel.SingleFieldManager.preFlush(SingleFieldManager.java:478)
at org.apache.openjpa.kernel.StateManagerImpl.preFlush(StateManagerImpl.java:2829)
at org.apache.openjpa.kernel.PNewState.beforeFlush(PNewState.java:39)
at org.apache.openjpa.kernel.StateManagerImpl.beforeFlush(StateManagerImpl.java:960)
at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:1967)
at org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java:1927)
at org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(BrokerImpl.java:1845)
at org.apache.openjpa.kernel.LocalManagedRuntime.commit(LocalManagedRuntime.java:81)
at org.apache.openjpa.kernel.BrokerImpl.commit(BrokerImpl.java:1369)
at org.apache.openjpa.kernel.DelegatingBroker.commit(DelegatingBroker.java:877)
at org.apache.openjpa.persistence.EntityManagerImpl.commit(EntityManagerImpl.java:512)
at com.ibm.worklight.config.dbmigration62.ApplicationMigration.migrateApplication(ApplicationMigration.java:138)
at com.ibm.worklight.config.dbmigration62.ApplicationMigration.migrate(ApplicationMigration.java:63)
at com.ibm.worklight.config.dbmigration62.AbstractMigration.run(AbstractMigration.java:66)
at com.ibm.worklight.config.dbmigration62.MigrationTool.run(MigrationTool.java:183)
... 1 more
ERROR 20 : FWLSE3406E: The applications migration failed with error The field "description" of instance "ApplicationEntity[id=51, name=wlProj, displayName=, description=null, thumbnail=null, platformVersion=null]" contained a null value; the metadata for this field specifies that nulls are illegal..
This is recorded as IBM PMR #77138,999,738, and was identified as a defect that is currently being worked on.
There is no local fix to do other than wait for a fix via the support ticket.

PDO cannot find ODBC driver

Trying to migrate to PDO for an ODBC connection to a remote database.
My system is Windows 7 Pro, with a FortiClient VPN connection to the remote domain, and Tunnel Mode connected. (Added in edit: Running PHP 5.4, so PDO should be installed by default.)
The data source configuration in the Windows 7 ODBC Data Source Administrator is as follows (some names changed for security):
Under System DSN:
System Data Source Name = 'TheBigDB'
Driver = 'Oracle in instantclient_11_2' (64-bit)
TNS Service Name = '10.10.1.20:1521/BIGDB'
UserID = 'BigDBUser'
All other settings are defaults for installation of driver
The following piece of PHP non-PDO code is able to create a connection usable for queries:
if (!($myConn = odbc_connect('TheBigDB','BigDBUser','myPwd'))) {
echo "No ODBC connection<br />";
}
So I can connect to the database. The problem is doing it in PDO. The following PHP...
try {
$odbcConn = new PDO('odbc:Driver={Oracle in instantclient_11_2};Server=10.10.1.20:1521;Database=BIGDB;Uid=BigDBUser;Pwd=myPwd');
} catch (PDOException $e) {
echo 'PDO connection failed: ' . $e->getMessage();
}
... results in a PDO connection failed: could not find driver message. My first try relied more heavily on the Data Sources Administrator; that looked like this:
try {
$odbcConn = new PDO('MyBigDB','BigDBUser','myPwd');
} catch (PDOException $e) {
echo 'PDO connection failed: ' . $e->getMessage();
}
Same thing -- could not find driver.
So here's my question: Given a Windows 7 system with ODBC through a VPN connection to an Oracle database that all seems to work without PDO, how do I migrate the connection parameters to create a PDO connection? Maybe a better question is why mess with PDO for the connection, but I keep reading that PDO is more secure, so I'm trying to use it.
More digging got me an answer. The correct syntax for creating a PDO object that uses a Windows Data Sources ODCB connection is not what I showed, but instead this (minus the try/catch):
$myConn = new PDO('odbc:TheBigDB','BigDBUser','myPwd');
BUT... with PHP 5.4.12 using ODBC to touch an Oracle 11 DB, you need to edit the correct php.ini file (see this WampServer forum topic for a discussion of which of three php.ini files you need to edit). Under Dynamic Extensions, uncomment extension=php_pdo_odbc.dll and extension=php_pdo_oci.dll (I did both; not sure which one did the trick...)
Another tip: In my scripts, neither odbc_connect() nor PDO() worked for me unless my connection was created in Windows Data Sources Administrator under the System DSN tab. It did not work under User DSN.

Resources