To build Hibernate applications , you need the following
- Java Integrated Development Environment
- Database Server
- Hibernate JAR files and JDBC driver
Install MySQL (Installation Steps)
import all the hibernate related jar files in your project build path (Hibernate jars)
mysql connector driver (Download)
Write a small jdbc code to test the connectivity
----------------------------------------------------------------------------------------
TestJdbc.java
----------------------------------------------------------------------------------------
package com.bikesh.test;
import java.sql.DriverManager;
import org.hibernate.dialect.MySQL55Dialect;
import com.mysql.jdbc.Connection;
public class TestJdbc {
public static void main(String[] args) {
String jdbcUrl="jdbc:mysql://localhost:3306/bikesh?useSSL=false";
String user="root";
String pass="root";
try{
Class.forName("com.mysql.jdbc.Driver");
System.out.println("Connecting to jdbc:"+jdbcUrl);
java.sql.Connection myConn=DriverManager.getConnection(jdbcUrl,user,pass);
System.out.println("Connection Successful");
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
No comments:
Post a Comment