![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 4219 Articles for MySQLi
![Daniol Thomas](https://www.tutorialspoint.com/assets/profiles/13551/profile/60_130035-1512726078.jpg)
3K+ Views
Generally, Data about data is known as metadata. The DatabaseMetaData interface provides methods to get information about the database you have connected with like, database name, database driver version, maximum column length etc...Following are some methods of DatabaseMetaData class.MethodDescriptiongetDriverName()Retrieves the name of the current JDBC drivergetDriverVersion()Retrieves the version of the current JDBC drivergetUserName()Retrieves the user name.getDatabaseProductName()Retrieves the name of the current database.getDatabaseProductVersion()Retrieves the version of the current database.getNumericFunctions()Retrieves the list of the numeric functions available with this database.getStringFunctions()Retrieves the list of the numeric functions available with this database.getSystemFunctions()Retrieves the list of the system functions available with this database.getTimeDateFunctions()Retrieves the list ... Read More
![Daniol Thomas](https://www.tutorialspoint.com/assets/profiles/13551/profile/60_130035-1512726078.jpg)
5K+ Views
A ResultSet interface in JDBC represents the tabular data generated by SQL queries. It has a cursor which points to the current row. Initially this cursor is positioned before first row.You can move the cursor using the next() method and, you can retrieve the column values of a row using the getter methods of the ResultSet interface (getInt(), getString(), getDate() etc..).To retrieve required data from a table:Connect to the database.Create a Statement object.Execute the Statement using the executeQuery() method. To this method, pass the select query in the String format. To retrieve all the values, we use the following query:Select ... Read More
![Daniol Thomas](https://www.tutorialspoint.com/assets/profiles/13551/profile/60_130035-1512726078.jpg)
2K+ Views
A ResultSet interface in JDBC represents the tabular data generated by SQL queries. It has a cursor which points to the current row. Initially, this cursor is positioned before the first row.Moving the pointer throughout result setThe next() method of the ResultSet interface moves the pointer of the current (ResultSet) object to the next row, from the current position. This method returns a boolean value, if there are no rows next to its current position it returns false, else it returns true. Therefore, using this method in the while loop you can iterate the contents of the result set.while(rs.next()){ }Getting the ... Read More
![Daniol Thomas](https://www.tutorialspoint.com/assets/profiles/13551/profile/60_130035-1512726078.jpg)
37K+ Views
Following are the main differences between functions and procedures:FunctionsProceduresA function has a return type and returns a value.A procedure does not have a return type. But it returns values using the OUT parameters.You cannot use a function with Data Manipulation queries. Only Select queries are allowed in functions.You can use DML queries such as insert, update, select etc… with procedures.A function does not allow output parametersA procedure allows both input and output parameters.You cannot manage transactions inside a function.You can manage transactions inside a procedure.You cannot call stored procedures from a functionYou can call a function from a stored procedure.You ... Read More
![Daniol Thomas](https://www.tutorialspoint.com/assets/profiles/13551/profile/60_130035-1512726078.jpg)
2K+ Views
Like procedures, you can also create function in a database and store them.SyntaxFollowing is the syntax of creating a function in a(MySQL) database:CREATE FUNCTION Function_Name(input_arguments) RETURNS output_parameter BEGIN declare variables; statements . . . . . . . . . . return data_type; ENDExampleSuppose we have a table named Emp in the database with the following content:+--------+------------+----------------+ | Name | DOB | Location | +--------+------------+----------------+ | Amit | 1970-01-08 | Hyderabad | | Sumith | 1970-01-08 | Vishakhapatnam | | Sudha | 1970-01-05 | Vijayawada ... Read More
![Krantik Chavan](https://www.tutorialspoint.com/assets/profiles/13545/profile/60_126883-1512724834.jpg)
2K+ Views
Following are the advantages of the prepared statement:By avoiding multiple compilation and execution of statements, prepared statements perform faster.Using prepared statements, we can insert values to advanced datatypes such as BLOB, CLOB, OBJECT easily with the help of the setter methods provided by the PreparedStatement interface.By providing setter method to set values prepared statement avoids the use of quotes and other special characters with in the query, and thereby it escapes the SQL injection attacksFollowing are the limitations of prepared statements:Since a PreparedStatement object represents only one SQL statement at a time, we can execute only one statement by one ... Read More
![Krantik Chavan](https://www.tutorialspoint.com/assets/profiles/13545/profile/60_126883-1512724834.jpg)
496 Views
While executing statements using Statement object, especially insert statements, each time a query is executed the whole statement is compiled and executed again and again where, the only difference among these statements is the values of the statements.Whereas, prepared statement is a precompiled statement i.e. the query is compiled and stored in the database, using place holders (?) instead of values and values to these place holders are supplied later.Thus, avoiding unnecessary compilation and execution of the statement again and again.ExampleSuppose, we have a table named Dataset in the database with the columns mobile_brand and unit_sale, if we want to ... Read More
![Krantik Chavan](https://www.tutorialspoint.com/assets/profiles/13545/profile/60_126883-1512724834.jpg)
2K+ Views
At the end of your JDBC program, it is required explicitly to close all the connections to the database to end each database session. However, if you forget, Java's garbage collector will close the connection when it cleans up stale objects.Relying on the garbage collection, especially in database programming, is a very poor programming practice. You should make a habit of always closing the connection with the close() method associated with connection object.To ensure that a connection is closed, you could provide a 'finally' block in your code. A finally block always executes, regardless of an exception occurs or not.To ... Read More
![Krantik Chavan](https://www.tutorialspoint.com/assets/profiles/13545/profile/60_126883-1512724834.jpg)
4K+ Views
You can call the SQL stored procedures using the CallableStatement interface. A Callable statement can have input parameters, output parameters, or both.You can create an object of the CallableStatement (interface) using the prepareCall() method of the Connection interface. This method accepts a string variable representing a query to call the stored procedures and returns a CallableStatement object.Suppose you have a procedure name myProcedure in the database you can prepare a callable statement as://Preparing a CallableStatement CallableStatement cstmt = con.prepareCall("{call myProcedure(?, ?, ?)}");Then you can set values to the place holders using the setter methods of the CallableStatement interface and execute ... Read More
![Nancy Den](https://www.tutorialspoint.com/assets/profiles/13557/profile/60_88439-1512714529.jpg)
118 Views
If you are accessing one type of database, such as Oracle, Sybase, or IBM, the preferred driver type is 4.If your Java application is accessing multiple types of databases at the same time, type 3 is the preferred driver.Type 2 drivers are useful in situations, where a type 3 or type 4 driver is not available yet for your database.The type 1 driver is not considered a deployment-level driver, and is typically used for development and testing purposes only.