Thanks. However, I'm using this process as a test. In the proper application we will be using a JDBC or JDNI connection initiated by PHP to connect to our IDMS database. Its complicated but it means we have to use the PHP-Java Bridge, Java and JDBC..... so we can't use ODBC. I'm using this as a test to get my head around the code. I've resorted to try and get it working with the JDBC connection coded in the script for now, and i'll move on to JNDI later. I have now got this code: <?php require_once ("java/Java.inc"); $drivermanager = new JavaClass('java.sql.DriverManager'); $conn1 = $drivermanager->getConnection("jdbc:mysql://localhost:3306/javatest?user=javauser&password=javadude") or die("Unable to connect to MySQL"); print $conn1; echo '<br /><br />'; mysql_select_db("javatest", $conn1) or die('Could not connect: ' . mysql_error()); $result = mysql_query("SELECT id, foo, bar FROM testdata"); while ($row = mysql_fetch_array($result)) { print "ID:".$row{'id'}." Name:".$row{'foo'}." ".$row{'bar'}."<br>"; } mysql_close($conn1); ?> This gives the following reply: com.mysql.jdbc.JDBC4Connection@22622262 Could not connect: It seems to connect Ok, but I think it gets stuck at the mysql_select_db() function because no database information is being extracted. I've tested a few things, and if I remove the $conn1 from this line: mysql_select_db("javatest", $conn1) or die('Could not connect: ' . mysql_error()); to give this: mysql_select_db("javatest") or die('Could not connect: ' . mysql_error()); I get the following error: com.mysql.jdbc.JDBC4Connection@22862286 Could not connect: Access denied for user 'root'@'localhost' (using password: NO) So I 'think' this indicates that the first lot of code connects OK - it just can't access the database. Maybe I'm using the wrong code to select the database??: mysql_select_db("javatest", $conn1) ; Can anyone see why my mysql_select_db() function is not working? Maybe its not possible to use this with the way that I have used the drivermanager->getConnection method? Please help :-(( -- View this message in context: http://www.nabble.com/PHP-Java-Bridge%3A-Connect-PHP-to-MySQL-using-JNDI-tp21562460p21565513.html Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php