Anonymous | Login | Signup for a new account | 11-22-2024 04:17 PST |
Main | My View | View Issues | Change Log | Docs |
Viewing Issue Simple Details [ Jump to Notes ] | [ View Advanced ] [ Issue History ] [ Print ] | |||||||||||
ID | Category | Severity | Reproducibility | Date Submitted | Last Update | |||||||
0003098 | [Quercus] | block | always | 11-25-08 13:30 | 03-23-10 07:41 | |||||||
Reporter | catkins | View Status | public | |||||||||
Assigned To | ||||||||||||
Priority | normal | Resolution | open | |||||||||
Status | new | Product Version | 3.2.1 | |||||||||
Summary | 0003098: mysql_connect hostname substition by mangling jndi name | |||||||||||
Description |
I have this string in the php: mysql_connect("java:comp/env/jdbc/thecrossingchurch"); What happens is I get this error: Warning: A link to the server could not be established. url=jdbc:mysql://java:3306/?characterEncoding=ISO8859_1 [^] If I change the statement to: mysql_connect("localhost"); Warning: A link to the server could not be established. url=jdbc:mysql://localhost:3306/?characterEncoding=ISO8859_1 [^] In fact, I can change it to anything and have a similar result. However, if a non-word character is put in the string, then that appears to be the terminator as in the first example. I get: "jdbc/thecrossingchurch" is configured in resin.xml. I can confirm this by doing: $conn = jndi_lookup("java:comp/env/jdbc/thecrossingchurch"); print $conn; Which shows the name and this works as well: $db = new PDO("java:comp/env/jdbc/thecrossingchurch"); Returning a connection, but the site design expect a mysql_connect and mysql_select_db call to setup a current database. |
|||||||||||
Additional Information | ||||||||||||
Attached Files | ||||||||||||
|
Notes | |
(0003788) obaltz 01-30-09 05:04 |
<?php $jndi_name = "java:comp/env/jdbc/cms"; $conn = jndi_lookup( $jndi_name ); var_dump( $conn ); $link = mysql_connect( $jndi_name ); var_dump( $link ); ?> outputs: resource(DBPool[jdbc/cms]) /D:/Programme/resin/webapps/ACME/test.php:6: Warning: A link to the server could not be established. url=jdbc:mysql://java:3306/?characterEncoding=ISO8859_1&useOldAliasMetadataBehavior=true [^] driver=com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource java.sql.SQLException: Unable to connect to any hosts due to exception: java.net.UnknownHostException: java ** BEGIN NESTED EXCEPTION ** java.net.UnknownHostException MESSAGE: java Could someone please care? |
(0004389) pablorg 01-19-10 15:05 |
I have the same problem with postgresql (pg_connect) and quercus 4.0.3 I can connect via PDO using the jndi name but I cannot connect using pg_connect with the jndi name |
(0004475) flushot 03-21-10 16:01 |
I'm experiencing the same problem with mysql_connect and mysql_pconnect. I've had to revert from JNDI to using direct JDBC URIs to get my legacy PHP app working without having to rewrite a lot of code to use PDO instead. |
(0004482) posenato 03-23-10 07:41 |
I use resin 4.0.5, Postgresql 8.4.2 and PEAR.DB library. I have found that the following configuration works: in resin.xml: ...<database><jndi-name>jdbc/erw</jndi-name>... in web.xml: ...<init><database>java:comp/env/jdbc/erw</database>... in the PHP file: <?php ... $db = DB::connect('pgsql://java:comp/env/jdbc/erw'); [^] ... ?> In other words, I have put 'pgsql://' [^] before the jndi name. |
Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
41 total queries executed. 33 unique queries executed. |