PHP, SQLite on windows using doctrine - php

i must connect to sqlite db file using doctrine,
when i copy db file to php(composer) project i can easily connect to DB,
but when i try to make absolute path it says SQLSTATE[HY000] [14] unable to open database file
i'm using symfony4.2 project for it and doctrine2.5
my .env is like this
DATABASE_WSW="sqlite:////C:\\Program Files\\programX\\db.sqlite" or
DATABASE_WSW="sqlite:////C:\Program Files\programX\db.sqlite" or
DATABASE_WSW="sqlite:////C:/Program Files/programX/db.sqlite"
above examples don't work
when used like this works:
DATABASE_WSW=sqlite:///db.sqlite
what I'm doing wrong?

Related

lightsail unable to find database

i am new at AWS lightsail, basically just following the instruction step by step create a instance, create a database named mypost, and upload all file to instance by filezilla, and then use potty to connect phpmyadmin, export local database into online database, but somehow when i test the link on browser it tell me Connection Error: SQLSTATE[HY000] [1049] Unknown database 'mypost' , i checked both phpmyadmin and database in the aws console all named mypost, i also switched to public mode as well, anyone know why is it?

Unable to load driver: com.mysql.jdbc.Driver

I try to use Jasper to generate report in Laravel. It's work perfect if I didn't use database, if I add database to get data from mysql database he gives me an error "Unable to load driver: com.mysql.jdbc.Driver". I install JDBC Connector and Setup ODBC connection to local mysql server:
Also I setup CLASSPATH to MySQL connector:
Because laravel print me that have some error to generate pdf with database connection I change it to print output command and ran it in terminal and he gives me an error that "Unable to load driver: com.mysql.jdbc.Driver", see next picture:
If you have ANY idea I will be grateful!
A lot of Java applications do not use the CLASSPATH environment variable, and it looks like jasperstarter is one of them.
Looking at http://jasperstarter.cenote.de/usage.html you need to use the command line option --jdbc-dir <directory with driver jar(s)>:
--jdbc-dir <dir> directory where jdbc driver jars are located. Defaults to ./jdbc
Alternatively, as you indicated in the comments, you can put the driver in the JasperStarter/jdbc folder, as that is the default location.

laravel4 migration failed (pdo exception)

I just used artisan migrate to create some table, but I get an error of Type PDO:
[PDOException]
SQLSTATE[HY000] [1045] Access denied for user 'root'#'localhost' (using password: NO)
A php/mysql testscript could connect to the database just fine, but it was another virtualhost and it did not use PDO.
In Laravel4 edited app/config/local/database.php to set the password and database name.
edit in start.php
UPDATE
I hardcoded the password in the PDO connection array and now terminal says there is no database named "database". Clearly it is looking somewhere else for the config, but I have no other config file.
(Due to following a tutorial about making a "local" directory it was not working for me)As it stands, I have downloaded the stable version and everything is working great.
I am going to delete this post, to keep the forum clean.
Make sure you have set up your database connection correctly in app/config/database
Laravel Database Docs
Make sure you are setting up a 'local' environment in start.php
Otherwise Laravel will look for DB config in app/config/database.php
Kindly Check Your app/config/database.php file in local host.
1.)Make Sure local Host Data Base name is Correct
2.)Make sure local Host Data Base username is correct.
3.)Make sure local Host Data Base password is correct.

PHP MySQL WAMP - Database Error

When I launch the website through local host, I get the following error:
Database Error: Unknown database 'db_name'
I'm having a dig around as to what the problem is. The website belongs to a friend of mine and he wants me to connect the website to the database. The database resides within the root directory. I'm merely trying to connect to it.
In most of the PHP files, there is a tag that includes the config file which contains the details of the database.
Any ideas as to how I can get it working and resolve the Database Error: Unknown database 'db_name' error?
Any help is highly appreciated.
Database should not reside in root directory, it should be imported to database (Mysql) server.
Check in Mysql databases, does your database resides there?
If not, you can do so by phpMyAdmin or navigating to your mysql and importing it.
Create database in mysql and import the sql file as below by opening command-line terminal:
/path/to/mysql/bin > mysql -u username -p < /path/to/root/db.sql

problems connecting sqlite database built using php5

I have used php5 to create a sqlite database. The database works fine when accessing its data using php.
However when I try and connect to the same sqlite file using firefox sqlite manager, I get the following error....
SQLiteManager: Error in opening file jTest.sqlite - either the file is
encrypted or corrupt Exception Name: NS_ERROR_FILE_CORRUPTED Exception
Message: Component returned failure code: 0x8052000b
(NS_ERROR_FILE_CORRUPTED) [mozIStorageService.openUnsharedDatabase]
My question:
Can you use php to create sqlite databases and have them work in other applications?
regards J

Categories