16.2 Java Database Connectivity Practical




this video tells about steps to follow for connecting java program to mysql database. Java JDBC is a java API to connect and execute query with the database.

Original source


34 responses to “16.2 Java Database Connectivity Practical”

  1. Thanks for this video. Something is changed now.
    In the url variable, after the database name, i had to add this code "?autoReconnect=true&useSSL=false".
    For example, in my case is:
    String url = "jdbc:mysql://localhost:3306/serra_databaseprova?autoReconnect=true&useSSL=false";

    I you don't do this, ssl error will occur.

    After this, in the Class.ForName i had to modify a little:
    Class.forName("com.mysql.cj.jdbc.Driver").

    I my case, for study database purpose, I don't need ssl security enable, so "?autoReconnect=true&useSSL=false" will disable SSL and also suppress the SSL errors (thanks to stackoverflow).
    Thanks Telusko for the video

  2. Navin in this video 16.2 u used a statement that is con.creatstatement() please explain because conection object con is created in the same class then why i need to use the object in the same class

  3. I write exactly the same code and also made one table in Mysql Workbench but I am getting an error :
    Exception in thread "main" com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create a connection to the database server.
    Caused by: java.lang.NullPointerException
    please help me.
    and my password is correct.

  4. I did the exact same s u did……but I get" Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary. " errorwhat would probably the issue be here…. !! thank you   …

  5. my oracle is installed in to two drives c and g .
    in c disk oracle folder is there. and in G disk app folder is installed .
    in that G disk where app folder is installed in that i have jar file.but in app folder G:appPrashanthproduct11.2.0dbhome_1jdbclib…here i have total 9 jar files with the name of ojdbc5,5g,5dms,6,6g,6dms,simplefan. these are the jar files in my folder . but i added the ojdbc 6 only but i still getting error.
    ……… so please resolve this issuse..
    and at the same time in my encliipse its not showing add external jar file… when am click the librarie folder .it shows module path AND class path … when i am click module path it will show the add external jar file…. sooo please

Leave a Reply