Either double-click the JAR file or execute the jar file from the command-line. If you need to use MySQL with Java, I hope this example has been helpful. For assistance in constructing the JDBC URL, use the connection string designer built into the MySQL JDBC Driver. In this video tutorial I will show you an Eclipse project which is throwing the : exception while running the example program. now do whatever you want to do with the connection This exception : occurs when there is not JDBC driver for MySQL in project. String url = "jdbc:mysql://THE_HOST/THE_DATABASE" Ĭonnection = DriverManager.getConnection(url,"THE_USER", "THE_PASSWORD")
LOAD THE MYSQL JDBC DRIVER JAVA HOW TO
If it helps to see the Driver and URL connection strings in a sample application, here's a little Java example that shows how to use the MySQL JDBC Driver and URL to establish a database connection: Place the JAR file in the ColdFusion Class Path: Server Configuration: Place the mysql-connector-java-3.1.10-bin.jar in cfusion /lib. Download the desired version of MySQL Connector/J from the MySQL download site. MySQL JDBC Driver and URL connection example Configuring ColdFusionMX to use a newer MySQL JDBC driver. Also, if you install a different version of the MySQL ODBC driver, you must update the DTM flag to update the MySQL ODBC driver name. The basic MySQL JDBC Driver and Java MySQL URL information you need is shown here: Note: The MySQL ODBC driver that you need to install varies based on the operating system that you use. Here's a quick post to help anyone that needs a quick MySQL JDBC Driver and URL reference.
Java MySQL Driver FAQ: Can you share a Java/MySQL JDBC Driver and URL example, i.e., how to connect to MySQL in Java? Using an ad blocker? just a $2 donation at will help keep this site running I was actually trying to get the instance of DriverManager class itself for getting the connection, after getting the Driver instance.Also I was trying to cast Driver class to '' instead of the interface ''.Its working for me.