|
From: <php...@li...> - 2011-04-08 10:21:23
|
Hi Rocio,
Instead of returning "no", you should display the exception message, that
would help you to solve the problem for sure.
Hope this helps,
JM.
On Fri, Apr 8, 2011 at 5:08 PM, <php...@li...
> wrote:
> Hello, I’m trying to use php-java bridge, but I find it impossible!
>
>
>
> Basic examples work without problem, now, I want to connect php with mysql
> using java.
>
>
>
> This is my code:
>
>
>
> Java :
>
>
>
> public class pruebaLog {
>
>
>
> public static String connectDB(){
>
> Connection conn = null;
>
> String returned;
>
> try {
>
> Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
>
> conn = DriverManager.getConnection("jdbc:mysql://localhost/spb",
> "root", "Administrad0r");
>
> returned= “open”;
>
> } catch (Exception e){
>
> returned = "no";
>
> }
>
> return returned;
>
>
>
> }
>
> }
>
>
>
> And the php:
>
>
>
> <?php
>
>
>
> require_once('./JavaBridge/java/Java.inc');
>
>
>
> java_require('/var/www/bridge/java/pruebaLog.jar');
>
>
>
> try{
>
> $prueba = new Java('pruebaLog');
>
> echo $prueba -> connectDB();
>
> } catch (JavaException $e){
>
> echo "ERROR". "<br>". $e;
>
> }
>
>
>
> ?>
>
>
>
> It shows “no”, I can’t understand why!
>
>
>
> Thank you so much!!
>
>
>
>
>
> Saludos
>
> Rocío Gómez Escribano
>
>
>
>
> ------------------------------------------------------------------------------
> Xperia(TM) PLAY
> It's a major breakthrough. An authentic gaming
> smartphone on the nation's most reliable network.
> And it wants your games.
> http://p.sf.net/sfu/verizon-sfdev
> _______________________________________________
> php-java-bridge-users mailing list
> php...@li...
> https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users
>
|