Mengexport Database Ms Access Ke MySQL Dengan Menggunakan ODBC Connector
Mysql Connector
Transcript of Mysql Connector
-
8/14/2019 Mysql Connector
1/5
27.3.4.2. Using Connector/J with Tomcat
The following instructions are based on the instructions for Tomcat-5.x, available athttp://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html which iscurrent at the time this document was written.
First, install the .jar file that comes with Connector/J in $CATALINA_HOME/common/lib so that itis available to all applications installed in the container.
Next, Configure the JNDI DataSource by adding a declaration resource to$CATALINA_HOME/conf/server.xml in the context that defines your web application:
...
factoryorg.apache.commons.dbcp.BasicDataSourceFactory
maxActive10
maxIdle5
validationQuerySELECT 1
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.htmlhttp://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html -
8/14/2019 Mysql Connector
2/5
-
8/14/2019 Mysql Connector
3/5
you should pass them here in the URL, setting them using theparameter tags above will have no effect, you will alsoneed to use & to separate parameter values as theampersand is a reserved character in XML -->
urljdbc:mysql://localhost:3306/test
In general, you should follow the installation instructions that come with your version of Tomcat,as the way you configure datasources in Tomcat changes from time-to-time, and unfortunately ifyou use the wrong syntax in your XML file, you will most likely end up with an exceptionsimilar to the following:
Error: java.sql.SQLException: Cannot load JDBC driver class 'null ' SQL
state: nullPrevious /Next / Up / Table of Contents
User Comments
Posted by Al Hopper on November 18 2005 1:32pm [Delete] [Edit]
The above did not work for me with Tomcat 5.5.9, but the following did:
Posted by Benjamin Slade on November 10 2005 1:29pm [Delete] [Edit]
server.xml is the old location for the but these days it's usually found either inconf/Catalina/[hostname]/[appname].xml or in webapps/[appname]/META-INF/context.xml.
Also note that the syntax of has changed in 5.5. Seehttp://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html
Posted by Benjamin Slade on November 12 2005 10:39pm [Delete] [Edit]
Note, the tag used in the above example is no longer valid Tomcat 5.5; it'sstill OK for tomcat 5.0 and lower.
The example above is not useful to newbies for several reasons. It assumes a newbie alreadyunderstands the concept of declaring a resource within a context for a web application. It also
assumes that the newbie wants to declare this database connection resource to be global acrossall web applications in this Tomcat installation, but doesn't say that.
http://dev.mysql.com/doc/refman/5.1/en/cj-general-j2ee-concepts.htmlhttp://dev.mysql.com/doc/refman/5.1/en/cj-jboss-config.htmlhttp://dev.mysql.com/doc/refman/5.1/en/cj-jboss-config.htmlhttp://dev.mysql.com/doc/refman/5.1/en/cj-j2ee.htmlhttp://dev.mysql.com/doc/refman/5.1/en/index.htmlhttp://dev.mysql.com/doc/mysql/comment.php?id=6780&action=deletehttp://dev.mysql.com/doc/mysql/comment.php?id=6780http://dev.mysql.com/doc/mysql/comment.php?id=6839&action=deletehttp://dev.mysql.com/doc/mysql/comment.php?id=6839http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.htmlhttp://dev.mysql.com/doc/mysql/comment.php?id=6848&action=deletehttp://dev.mysql.com/doc/mysql/comment.php?id=6848http://dev.mysql.com/doc/refman/5.1/en/cj-general-j2ee-concepts.htmlhttp://dev.mysql.com/doc/refman/5.1/en/cj-jboss-config.htmlhttp://dev.mysql.com/doc/refman/5.1/en/cj-j2ee.htmlhttp://dev.mysql.com/doc/refman/5.1/en/index.htmlhttp://dev.mysql.com/doc/mysql/comment.php?id=6780&action=deletehttp://dev.mysql.com/doc/mysql/comment.php?id=6780http://dev.mysql.com/doc/mysql/comment.php?id=6839&action=deletehttp://dev.mysql.com/doc/mysql/comment.php?id=6839http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.htmlhttp://dev.mysql.com/doc/mysql/comment.php?id=6848&action=deletehttp://dev.mysql.com/doc/mysql/comment.php?id=6848 -
8/14/2019 Mysql Connector
4/5
Here's what worked for me.
I created a file $CATALINA_HOME/webapps/MyApps/META-INF/context.xml where$CATALINA_HOME is the installation directory for Tomcat and MyApps is the web applicationdirectory where you're gonna put a bunch of related JSP files sharing the database connectioninfo specified in the context.xml file.
I then added the following for the content of context.xml (from to tag):
Next I placed the following into a .jsp file in the MyApps directory:
Note that "jdbc/TestDB" is the key string used to access the database connection resource info in
-
8/14/2019 Mysql Connector
5/5
the context.xml file.
You can see my overly detailed writeup on installing Java, Tomcat, and MySQL into an Mac OSX environment (pretty close to generic Unix) at the web address:http://www.benslade.com/projects/java/tomcat/InstallingJavaTomcatMySQLOnMacOSX/
Ben SladePublicMailbox at BenSlade dot com
Posted by Al Hopper on November 18 2005 1:41pm [Delete] [Edit]
NB: AutoReconnect=true is deprecated. See changelog section 23.3.6. (go several pages forwardto the Changelog)
Add your own comment.
http://www.benslade.com/projects/java/tomcat/InstallingJavaTomcatMySQLOnMacOSX/http://dev.mysql.com/doc/mysql/comment.php?id=6874&action=deletehttp://dev.mysql.com/doc/mysql/comment.php?id=6874http://dev.mysql.com/doc/mysql/comment.php?sect=cj-tomcat-confighttp://www.benslade.com/projects/java/tomcat/InstallingJavaTomcatMySQLOnMacOSX/http://dev.mysql.com/doc/mysql/comment.php?id=6874&action=deletehttp://dev.mysql.com/doc/mysql/comment.php?id=6874http://dev.mysql.com/doc/mysql/comment.php?sect=cj-tomcat-config