If you are using Oracle's MySQL as database in your Hibernate project then you must use mysql-connector-java-5.x.xx-bin.jar JDBC jar. The <property name="connection.url"> tag in hibernate.cfg.xml must have the value jdbc:mysql://localhost:3306/myDb where myDb is your database name.
Code snippet for Hibernate's Database connection settings in hibernate.cfg.xml,
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost:3306/myDb</property>
<property name="connection.username">root</property>
<property name="connection.password"></property>
If you are not working on the localhost then it must be the IP address of the server where the MySQL database is located.
More Posts related to Java,
- How to Get List of All Country Codes in Java Using Locale Class
- Unsupported major.minor version 52.0 in java
- Java - How to set custom thread name?
- Get the current timestamp in Java
- Java Spring Boot 3 Web Hello World with Gradle in IntelliJ
- [fix] NullPointerException Cannot Invoke findById because Repository is null - Java Spring
- java: unclosed string literal [Error]
- Convert Java Byte Array to String with code examples
- Error: Can not find the tag library descriptor for
- Java 8 - Convert List to Map Examples
- Java - Calculate time taken for the code to execute in milliseconds or nanoseconds
- Fix java.net.ProtocolException: Invalid HTTP method
- Java: Convert Stream to List
- Java equals method - Tutorial
- List of Java JDBC Database Driver Jars, Classes and URLs Details
- Read YAML file Java Jackson Library
- How to display Java Date Time timezone GMT/UTC offset using SimpleDateFormat
- List of Java Keywords
- Enable JSON Pretty Print in Java Jackson
- How to Word-Warp Console logs in IntelliJ
- Convert Map to List in Java 8 using Stream API
- Create a Directory using Java Code
- Ways to Convert Integer or int to Long in Java
- [Program] How to read three different values using Scanner in Java
- Java JDBC Example with Oracle Database Driver Connection
More Posts:
- How to Change Eclipse Default Web Browser - Eclipse
- How to install tabnine on VS Code - HowTos
- How to Center Align Image in Bootstrap - CSS
- Connection Failed: 1130 PHP MySQL Error - MySQL
- Java SE 8 Update 301 available with various bug fixes and security improvements - Java
- Microsoft Teams Error code - 6 issue - Teams
- 11 Weeks of Android Online Sessions-15-Jun-to-28-Aug-2020 - Android
- Increase Android Emulator Timeout time - Android