phpjasper-laravel
phpjasper-laravel copied to clipboard
Error Connecting to database
I am trying to connect to database but get an error like this
`C:\wamp64\www\smb-report\vendor\geekcom\phpjasper-laravel\src\PHPJasper.php /** * @param bool $user * @return mixed * @throws Exception\InvalidCommandExecutable * @throws Exception\InvalidResourceDirectory * @throws Exception\ErrorCommandExecutable */ public function execute($user = false) { $this->validateExecute(); $this->addUserToCommand($user);
$output = [];
$returnVar = 0;
chdir($this->pathExecutable);
exec($this->command, $output, $returnVar);
if ($returnVar !== 0) {
//throw new \PHPJasper\Exception\ErrorCommandExecutable();
throw new \Exception("{$output[0]}", 1);
}
return $output;
}
/**
* @return string
*/
public function output()
{
return $this->command;
}
/**
* @param $user
*/
protected function addUserToCommand($user)
{
if ($user && !$this->windows) {
$this->command = 'su -u ' . $user . " -c \"" . $this->command . "\"";
Arguments
"usage: jasperstarter process [-h] -f
and here is my config
` public function generate()
{
//$input = DIR . '/vendor/geekcom/phpjasper/examples/hello_world.jasper';
$input = base_path('/vendor/geekcom/phpjasper-laravel/examples/Database.jasper');
$output = base_path('/vendor/geekcom/phpjasper-laravel/examples');
$options = [
'format' => ['pdf'],
'locale' => 'en',
'db_connection' => [
'driver' => 'mysql',
'username' => 'root',
'password' => '',
'host' => '127.0.0.1',
'database' => 'smb',
'port' => '3306'
]
];
$jasper = new PHPJasper;
$jasper->process(
$input,
$output,
$options
)->execute();
return view('welcome');
}`
could you please help to tell what's went wrong?
Good afternoon, I have the same or similar mistake
usage: jasperstarter process [-h] -f <fmt> [<fmt> ...] [-o <output>] [-w]
Help, please
with this code the error does not come out anymore, but the fields in the report come out as NULL
$jasper->process( $input, $output, array('pdf', 'rtf'), array('php_version' => phpversion()), array( 'driver' => 'mysql', 'username' => 'root' 'password' => '', 'host' => 'localhost', 'database' => 'ksoftdb', 'port' => '3306',) )->execute();
help please...
Please check the parameters of your DB
You missing , (comma) after username root. in connection array.