Nisha3102 Posted May 14, 2009 Share Posted May 14, 2009 I am trying to integrate php and jasper reports. I have to generate a report from db and for that I need a jdbc connection object in php. Could any one please help me on this. I have referred some links on google .They all mention the same process of creating an instance of a java class and then calling a getConnection() method of that class. Following the getCOnnection() method public Connection getConnection() { Connection conn = null; try { //Change these settings according to your local configuration Class.forName(this.getDriver()); conn = DriverManager.getConnection( this.getConnectString(), this.getUser(), this.getPassword()); //return conn; }catch(ClassNotFoundException e){ e.printStackTrace(); }catch(SQLException e){ e.printStackTrace(); } return conn; } But when I call this method from php it doesnt return me anything . Could anyone please help me. I need jdbc connection object coz I need to send this as the parameter to FillManager class of Jasper Reports. Link to comment https://forums.phpfreaks.com/topic/158184-php-and-jdbc-urgent-help/ Share on other sites More sharing options...
Ken2k7 Posted May 14, 2009 Share Posted May 14, 2009 That's not PHP, so if you call it, it'll probably be undefined because the function doesn't exist in PHP. Java is not PHP. Link to comment https://forums.phpfreaks.com/topic/158184-php-and-jdbc-urgent-help/#findComment-834418 Share on other sites More sharing options...
Nisha3102 Posted May 15, 2009 Author Share Posted May 15, 2009 I am trying to integrate php and jasper reports. I have to generate a report from db and for that I need a jdbc connection object in php. Could any one please help me on this. I have referred some links on google .They all mention the same process of creating an instance of a java class in PHP and then calling a getConnection() method of that class. PHP code - $jdbcalt = new Java("jdbcalt"); $jdbcalt->getConnection() Java Code in Jdbcalt class Following is the getCOnnection() method public Connection getConnection() { Connection conn = null; try { //Change these settings according to your local configuration Class.forName(this.getDriver()); conn = DriverManager.getConnection( this.getConnectString(), this.getUser(), this.getPassword()); //return conn; }catch(ClassNotFoundException e){ e.printStackTrace(); }catch(SQLException e){ e.printStackTrace(); } return conn; } But when I call this method from php it doesnt return me anything . Could anyone please help me. I need jdbc connection object coz I need to send this as the parameter to FillManager class of Jasper Reports. Link to comment https://forums.phpfreaks.com/topic/158184-php-and-jdbc-urgent-help/#findComment-834457 Share on other sites More sharing options...
Ken2k7 Posted May 15, 2009 Share Posted May 15, 2009 Oh I missed your Java bit. I thought you did via command line "php getConnections()" . You should post your stuff. I don't know what kind of an object is Connection, but give it a toString method and have getConnection write out conn with System.out.println(conn); That should use the toString() method printout. Link to comment https://forums.phpfreaks.com/topic/158184-php-and-jdbc-urgent-help/#findComment-834460 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.