- This topic has 3 replies, 3 voices, and was last updated 21 years, 3 months ago by
Riyad Kalla.
-
AuthorPosts
-
dand9959MemberI have a very simple test application that simply connects to a mysql DB in a bean and prints some data via a jsp.
The deployed app works fine in Tomcat, but not in Resin – the java.com.env/jdbc/TestDB resource is not found in Resin?
In tomcat, I place a context.xml for the db resource under the TOMCAT_HOME/conf directory, and name it myApp.xml
I’ve tried placing that file in a number of places under resin, but cannot get the resource recognized.
The Resin docs descirbe a <database> descriptor to use in the app”s web.xml, but Eclipse barfs at the syntax.
Does anyone know what I’ve done incorrectly?
The xml file I use is boilerplate that myEclipse users should recognize:
<Context path=”/TestDB” docBase=”TestDB” debug=”5″ reloadable=”true” crossContext=”true”>
<Resource name=”jdbc/TestDB”
auth=”Container”
type=”javax.sql.DataSource”/><ResourceParams name=”jdbc/TestDB”>
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter><!– Maximum number of dB connections in pool. Make sure you
configure your mysqld max_connections large enough to handle
all of your db connections. Set to 0 for no limit.
–>
<parameter>
<name>maxActive</name>
<value>100</value>
</parameter><!– Maximum number of idle dB connections to retain in pool.
Set to 0 for no limit.
–>
<parameter>
<name>maxIdle</name>
<value>30</value>
</parameter><!– Maximum time to wait for a dB connection to become available
in ms, in this example 10 seconds. An Exception is thrown if
this timeout is exceeded. Set to -1 to wait indefinitely.
–>
<parameter>
<name>maxWait</name>
<value>10000</value>
</parameter><!– MySQL dB username and password for dB connections –>
<parameter>
<name>username</name>
<value>enfora</value>
</parameter>
<parameter>
<name>password</name>
<value>pinehurst</value>
</parameter><!– Class name for mm.mysql JDBC driver –>
<parameter>
<name>driverClassName</name>
<value>com.mysql.jdbc.Driver</value>
</parameter><!– The JDBC connection url for connecting to your MySQL dB.
The autoReconnect=true argument to the url makes sure that the
mm.mysql JDBC Driver will automatically reconnect if mysqld closed the
connection. mysqld by default closes idle connections after 8 hours.
–>
<parameter>
<name>url</name>
<value>jdbc:mysql://localhost:3306/myTestDB?autoReconnect=true</value>
</parameter>
</ResourceParams>
</Context>March 19, 2004 at 1:51 pm #205043
Riyad KallaMemberTo setup your JNDI context for the database connection you need to add the <database> tag you were looking at into the resin.conf file (this is what I understand from my limited reading of the Resin docs)
If I am wrong, someone please correct me.
April 16, 2004 at 4:49 am #206080
AlbrenMemberHi dand,
I have a problem but not really related to the one you are asking.
Im having error “Access denied with mySQL with password YES” (Something like this)
How to setup properly the mySQL. Thanks.April 16, 2004 at 9:36 am #206085
Riyad KallaMemberAlbren,
This is definately out of the scope of these forums, but let me give you some tips to get started:-
1) Download MySQL CC, its a great tool for managing MySQL http://dev.mysql.com/downloads/mysqlcc.html
2) Connect MySQLL CC to your local running instance of MySQL
3) Double click to expand the User Administrator node
4) Add a new user, name them something useful like “devUser”, set their host name to “localhost” and set a password. ALso make sure to check the DB you want them to have access to and what permissions you want to give them. Hit Add.
5) Optionally you can keep this screen open and change “localhost” to “%” (w/o quotes) this allows this same user to connect FROM any where else.
6) Update your JNDI context in Tomcat to use this new login name/password. -
AuthorPosts