How to connect Laravel with oracle
HTML-код
- Опубликовано: 27 сен 2024
- How to connect laravel with oracle
Before starting please
If u are using wamp server
Then go to your green icon of wamp
Then php
Then php extensions
And tick php_oci8_11g(if u are using oracle 11 g)
If u are using xamp server
Then go to your php.ini file
Check that your line extension=php_oci8_12c.dll ; is uncomment
Here I am using xamp server..
Steps
Step1:-------------------------------------------------------------------------------------
write following in terminal
[if you are using Laravel 5.3,then following line ]
composer require yajra/laravel-oci8:"5.3.*"
[if you are using Laravel 5.2,then following line]
composer require yajra/laravel-oci8:"5.2.*"
[if you are using Laravel 5.1,then following line]
composer require yajra/laravel-oci8:"5.1.*“
[if you are using Laravel 5.7,then following line]
composer require yajra/laravel-oci8:"5.7.*“
(here I am using laravel 5.3)
Step2:----------------------------------------------------------------------------------------------------------------
add the following to the providers section of config/app.php.
Yajra\Oci8\Oci8ServiceProvider::class
Step3:---------------------------------------------------------------------
Write in terminal =============
php artisan vendor:publish --tag=oracle
step4-------------------------------------------------------------------------------------------------
then go to .env file and set up database like
DB_CONNECTION=oracle
DB_HOST=localhost
DB_PORT=your_oracle_port_no
DB_DATABASE=your_database
DB_USERNAME=your_username
DB_PASSWORD=your_password
DB_PORT info is located in orant\NET80\ADMIN\ TNSNAMES.ORA
Another related video link:
Call to unfined function yajra\pdo\oci_connect() (oracle +Laravel...link below)
• Call to undefined fun...
#oracle #laravel #oci8 #pdo_oci #laravel5
================Related tags=======================================
oracle laravel, laravel, oracle, oci8, yajrabox, yajrabox datatables, yajrabox laravel, yajra datatables laravel 5.5, yajra datatables laravel 5.6, datatable laravel 5.6, laravel yajra, oarcle, oci, oracle tutorial, xampp, oracle xampp, laravel 5 database configuration, laravel beginner tutorial, laravel database settings, laravel 5 db settings, laravel tutorial for beginners step by step, database configuration laravel 5, laravel tutorial, laravel database, database connection, call to undefined function, undefined, solution, oracle +laravel, unfined function, call to unfined function, yajra\\pdo\\oci_connect(),laravel,oracle,how to connect database with laravel project,how to connect oracle database using cli,how to laravel,how to connect sql using command line,connect database with laravel project
Thank u a lot sir. But if we do now, its very little deferent. But its okay. Good job 👍
thank you a lot!!! you can also use TCP viewer to view the port used by oracle.
very good.. can you make complete app series using oracle DB
tnks bro Great video tutorial , greetings from Mexico
Illuminate\Contracts\Container\BindingResolutionException
Target class [App/Http/Controllers/TestController] does not exist.
how to fix?
Thank you so Much!! It's work like charm
great to hear that it works for you :D
Illuminate\Contracts\Container\BindingResolutionException
Target class [App/Http/Controllers/TestController] does not exist.
I am getting this error. Any help?
me too
Great video tutorial. Can I link this video on my laravel-oci8 package? Thanks!
kindly upload a videos how to connect msql in laravel through angular js and perform crud on it
thanks you very much, it save my life!
Thành Hoàng
Thanks for your feedback. :D
it is nice...
ORA-12505: TNS:listener does not currently know of SID given in connect descriptor
oracle 19c how connect in laravel
great, thanks a lot!
Did he works in laravel 7 or 8 ??
this command doesnt work for me please help..
composer require yajra/laravel-oci8:^8
it throws this error
PHP Warning: PHP Startup: Unable to load dynamic library 'oci8_12c' (tried: C:\xampp\php\ext\oci8_12c (The specified module could not be found.), C:\xampp\php\ext
\php_oci8_12c.dll (%1 is not a valid Win32 application.)) in Unknown on line 0
hello try this one ,then let me know which error you are getting ruclips.net/video/cA0m5DRPqsI/видео.html
Sorry, can you show me step 4 in database.php?How to modify?Cause not show in this video
Hamzah , i add my database.php here
when I am doing step 3 there is error appears:
In ProviderRepository.php line 208
Class 'Yajra\Oci8\Oci8ServiceProvider::class' not found
Any ideas? I use laravel 5.8
I have the same error, did you solve it?
T
hanh you for the video but i got a missstack "ORA-12170: TNS:Connect timeout occurred" and i couldn't fine the way suitable to fix it on my local. could you help me ?
Hello +quyen van, Thank you for sharing your Problem. I Think the following link will help you to solve your problem
stackoverflow.com/questions/23970158/ora-12170-tnsconnect-timeout-occurred
Plz, let me know if you still have the problem using the above solution.
thanks.. :)
:/ ERROR :/
FatalThrowableError in Oci8.php line 455:
Call to undefined function Yajra\Pdo\oci_connect()
hi +javier do you enabled extension=php_oci8.dll in php.ini ??? you may check out this link github.com/yajra/laravel-oci8/issues/1 ......which server r you using?? is it wamp or xamp or anything else??
que crack este man
after remove ; from php ini on the oci line i got error
hi +Ahmed. Can u tell me exactly what error are you getting?
hello sorry for my english i have a problem, i need crear my authentication (auth) with oracle with the table dba_users that is for default the table where oracle save the user and password, and then get the rol from the user and create the menu based on the roles, but the most import for me is how use auth with oracle with the table dba_users and not with the table "users" that laravel have for default thanks
watch this ruclips.net/video/e6t97M4DI2E/видео.html ...although its mysql but concept is pretty same
ok thanks :D
thanks but the example not is possible because oracle have your table dba_users and this table not have column ID or rememberToken or create_at or update_at, and the auth use table.id when start i need only that i can use the table dba_users only put my login and password and the auth only return true o false with this table, because the example you create other table similar to user but i not want create other table similar, else use the table already exists and keep the session, you know? and i sorry again for my english. thanks
as far i know u need rememberToken or create_at or update_at fields ,otherwise auth will not work properly like login and password logout time (coz its check rememberToken during these times )..
u can add these fields(ID or rememberToken or create_at or update_at) to dba_users table .and for ID (since there is no auto increment column in oracle) u can use $sequence during insert(registration)
nysql is far better than oracles.. in my experience!!
Thank you for this tutorial! But i have 2 questions.
1. on 2:40, i need to modify line 'default' = ... from 'mysql' to 'oracle', right? but do i have to add an element 'oracle' => [ ... ] later in 'connections' array in this file? i have just sqllite, mysql, pgsql and sqlsrv in connections;
2. on 4:15, is it right that i need to connect to oracle manually? i don't use TOAD, and earlier before using Laravel i connected to oracle via oci_connect and so on.
Thank you in advance!
Thanks! it totally works for me, I just had to adapt the connection in database.php because I use odbc here, so, was made like this:
"'oracle' => [
'driver' => 'oracle',
'tns' => env('your_odbc', '(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle-scan)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = your_service_name)
)
)'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '1521'),
'database' => env('DB_DATABASE', 'your_database'),
'username' => env('DB_USERNAME', 'your_username'),
'password' => env('DB_PASSWORD', 'your_password'),
'charset' => env('DB_CHARSET', 'AL32UTF8'),
'prefix' => env('DB_PREFIX', ''),
'prefix_schema' => env('DB_SCHEMA_PREFIX', ''),
],
]"
Declaration of Yajra\Pdo\Oci8::query($statement, $fetchMode = null, $modeArg = null, $ctorArgs = null) must be compatible with PDO::query(string $query, ?int $fetchMode = null, mixed ...$fetchModeArgs)
I have a solution for PHP 8 !!! composer require yajra/laravel-pdo-via-oci8:3.*
FatalThrowableError in Oci8.php line 455:
Call to undefined function Yajra\Pdo\oci_connect()
First check that u have oci8 enabled...To check it go to your browser then localhost then go to php info...if u have found out that there is oci8 enabled then ok otherwise follow below
if there is no oci8 then do the following
1.download oracle instant client...then copy all the file from 'oracle instant client' folder and paste it to your pc/windows/system
2. Make sure you have php_oci8.dll in your bin\php\php_version\ext directory. If not, download it.
3. Enable extension=php_oci8.dll in your php\php.ini file (which i already showed in video 1.09 period) , and restart apache.
the procedure entry point OCIstmtGetNextResult could not be located in the dynamic link library
sorry i don't get ur prob
Very thanks, you help me very!!!!
how to add oracle as second database. mysql is default. pls help me
as far I know if you set up .env , you don't .if it not work then go to your config/database.php ,'default' => env('DB_CONNECTION', 'yoursetting'),
change it according to your oracle set up ,also 'connections' => [
'yoursetting' => [
'driver' => 'yoursetting',
ruclips.net/video/Kgl3FzqP1Ps/видео.html
if i using laravel 5.7 ??
hmm but make sure following line[if you are using Laravel 5.7, then the following line]
------------------
composer require yajra/laravel-oci8:"5.7.*“
Which version of oracle server did you install?
Hi +Moura, it's oracle 11g
I tried to use the 11g express however it's not working.
Class Yajra\Oci8\Oci8ServiceProvider not found... any solution?
+enrique do u add Yajra\Oci8\Oci8ServiceProvider::class in config/app.php ??? which version of laravel r u using???
Yes, i'm using Laravel 5.3
+enrique try this
composer dump-autoload
or
php artisan dump-autoload
am not sure what is the actual solution ...but trying to find out a solution for you
+enrique do u solve your prob?? another thing came into my mind do u put instantclient in your system???