|
From: <php...@li...> - 2011-04-11 07:41:33
|
Thank you so much, but I can't getting it up.
I create a link from mysql-connector to /usr/share/tomcat8/lib,
I create a new folder in /var/lib/tomcat6/webapps/ called mysql, where I
create a folder WEB-INF, I create a file web.xml in it, it contains this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<java:comp/env>
<description>
</description>
<res-ref-name>
jdbc/EmployeeDB
</res-ref-name>
<res-type>
javax.sql.DataSource
</res-type>
<res-auth>
Container
</res-auth>
<java:comp/env>
<Context java:comp/env>
<Resource name="jdbc/EmployeeDB"
auth="Container"
type="javax.sql.DataSource"
username="dbusername"
password="dbpassword"
driverClassName="org.hsql.jdbcDriver"
url="jdbc:HypersonicSQL:database"
maxActive="8"
maxIdle="4"/>
</Context>
Now the java method is:
public String connectDB(){
String returned;
try{
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
DataSource ds = (DataSource)
envCtx.lookup("jdbc/EmployeeDB");
Connection conn = ds.getConnection();
//... use this connection to access the database ...
conn.close();
returned = "bne";
} catch (NamingException ne) {
returned = ne.toString();
} catch (SQLException e){
returned = e.toString();
}
return returned;
}
I have this answer:
javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
It's driving me crazy!!!
Saludos
Rocío Gómez Escribano
-----Mensaje original-----
De: php...@li...
[mailto:php...@li...]
Enviado el: viernes, 08 de abril de 2011 21:04
Para: php...@li...
Asunto: Re: [Php-java-bridge-users] help with php-java-bridge and mysql
Just add mysql driver. See
http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html
> java_require('/var/www/bridge/mysql-connector-java-5.1.15-bin.jar');
Err, what does that supposed to do?!?
----------------------------------------------------------------------------
--
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
|