PHPJasper / phpjasper-laravel

MIT License
32 stars 17 forks source link

Oracle Jasper Connection #32

Open mrffiroz opened 2 years ago

mrffiroz commented 2 years ago

$input = DIR . '/../../../../vendor/geekcom/phpjasper/examples/Blank_A4.jasper'; $output = DIR .'/../../../../vendor/geekcom/phpjasper/examples'; $jdbc_dir = DIR . '/../../../../vendor/geekcom/phpjasper/bin/jaspertarter/jdbc'; $options = [ 'format' => ['pdf'], 'locale' => 'en', //'params' => ['bankId'=>'260','stDate'=>'06/10/2021','edDate'=>'06/19/2021','branchId'=>''], 'db_connection' => [ 'driver' => 'generic', 'username' => 'BANK', 'password' => 'BANK', 'host' => '192.168.78.1', 'database' => "dummydb", 'port' => '1521', 'jdbc_dir' => $jdbc_dir, 'jdbc_driver'=>'oracle.jdbc.driver.OracleDriver', 'jdbc_url' => 'jdbc:oracle:thin:@192.168.78.1:1521:dummydb', 'db_sid' => 'dummydb' ] ];

    I am failed to connect oracle server!!
    Try to us it with laravel 6.8 But always 
    "Your report has an error and couldn 't be processed!\ Try to output the command using the function `output();` and run it manually in the console. "

    Can you describe how to connect with laravel+oracle 
mrffiroz commented 2 years ago

public function daily_Collection_report_5(Request $request){ $jasper = new PHPJasper;

    $inputs = __DIR__ . '/../../../../vendor/geekcom/phpjasper/examples/Blank_A4.jrxml';
    $input = __DIR__ . '/../../../../vendor/geekcom/phpjasper/examples/Blank_A4.jasper';
    $output = __DIR__ .'/../../../../vendor/geekcom/phpjasper/examples';
    $jdbc_dir = __DIR__ . '/../../../../vendor/geekcom/phpjasper/bin/jaspertarter/jdbc';
    $options = [
        'format' => ['pdf'],
        'locale' => 'en',
        'params' => ['bankId'=>'260','stDate'=>'06/10/2021','edDate'=>'06/19/2021','branchId'=>''],
        'db_connection' => [
            'driver' => 'generic',
            'username' => 'BANK',
            'password' => 'BANK',
            'host' => '192.168.78.1',
            'database' => "dummydb",
            'port' => '1521',
            'jdbc_dir' => $jdbc_dir,
            'jdbc_driver'=>'oracle.jdbc.driver.OracleDriver',
            'jdbc_url' => 'jdbc:oracle:thin:@192.168.78.1:1521:dummydb',
            'db_sid' => 'dummydb'
        ]
    ];

    $jasper->compile($inputs,$output,
        $options)->execute();

    $jasper->process(
        $input,
        $output,
        $options
    )->execute();
   $file_location = __DIR__ . '/../../../../vendor/geekcom/phpjasper/examples/Blank_A4.pdf';
    return response()->file($file_location);
}

This is my laravel controller action