mysql problem

mysql problem

View Answers

September 2, 2009 at 10:26 AM

hai friends myself posted this question but i have refer some books and get some idea. i have verify it practically it i.e


use longblob instead of blob at the time of creation of table in mysql. it will take any image and store in database.


thanks friends

September 3, 2009 at 10:45 AM

Hi Friend,

Create a database table image(id(bigint),image(longblob)) and try the following code:

<%@page import="java.sql.*"%>
<%@page import="java.io.*"%>

<%
String connectionURL = "jdbc:mysql://localhost:3306/test";;;
Connection con=null;
try{
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection(connectionURL, "root", "root");
PreparedStatement ps = con.prepareStatement("INSERT INTO image VALUES(?,?)");
File file = new File("C://spring-wedding-flowers.jpg";);
FileInputStream fs = new FileInputStream(file);
ps.setInt(1,4);
ps.setBinaryStream(2,fs,fs.available());
int i = ps.executeUpdate();
ps.close();
con.close();
}
catch(Exception e){
out.println(e);
}
%>

Thanks









Related Tutorials/Questions & Answers:
mysql 4.x to 5.x upgrade problem
mysql 4.x to 5.x upgrade problem  mysql 4.x to 5.x upgrade problem
mysql problem - JDBC
mysql problem   hai friends i have some problem with image storing in mysql. i.e while i am using image(blob) for insert the image it says... of creation of table in mysql. it will take any image and store in database
Advertisements
MySql date problem
MySql date problem  with a mysql query, how can you get records of previous week dynamically, starting from sunday and ending on saturday? I don't want records from current date, just the previous week
mysql installation problem - JDBC
mysql installation problem  Hi, when i installing mysql server on my pc in MySQL Server Instance Configuration Wizard,I enter the root pw... information. http://www.roseindia.net/mysql/mysql5/Installing-MySQL-on-Windows.shtml
mysql problem - JDBC
mysql problem  hai friends please tell me how to store the videos in mysql plese help me as soon as possible thanks in advance   ... = "jdbc:mysql://localhost:3306/test"; Connection con=null; try
Charset problem upon publishing PHP + MySQL website
Charset problem upon publishing PHP + MySQL website  Charset problem upon publishing PHP + MySQL website
Problem in uploading image to to mysql database
Problem in uploading image to to mysql database  Hi, need some help... have no problem in saving the image in the folder, my problem is it can't save the record to mysql database. heres my code... index.jsp <%@ page
Problem in uploading image to to mysql database
Problem in uploading image to to mysql database  Hi, need some help... have no problem in saving the image in the folder, my problem is it can't save the record to mysql database. heres my code... index.jsp <%@ page language
problem on jsp, inserting data into table(mysql).
problem on jsp, inserting data into table(mysql).  hello friends, I have a problem in jsp.I want to insert data, which is given by user through a html page into a table.And the table name also is given by the user.My database
problem connect jsp and mysql - JSP-Servlet
problem connect jsp and mysql  hello, im getting an error while connecting jsp and mysql. I have downloaded the driver mysql-connector... Software Foundation\Tomcat 5.5\common\lib\mysql-connector-java-2.0.14.jar
problem in selecting second arraylist from mysql database
problem in selecting second arraylist from mysql database  Hi... in mysql database. In the below program , i have hard-coded that second list... = DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","root"); Statement stmt
Null pointer exceptation-Java Servlet web application,Problem connecting with MYSQL database
Null pointer exceptation-Java Servlet web application,Problem connecting with MYSQL database  Hi everyone i would like to ask few question here,since i try to configure this out for 1 week,i dont find any solution for my problem
php problem
php problem  Hello!! I have a problem ,i want to display the data... not connect: ' . mysql_error()); } $sql = 'SELECT * FROM users WHERE username="'.$username.'" LIMIT 1'; $result = mysql_query( $sql); if(! $result) { die('Could
problem on php
problem on php   l have five tables and build them as forms and link between them php and database and i want to build query between them plz help me soon   PHP MySQL Tutorials
MYSQL
MYSQL  How to create time and date based trigger in mysql   MySQL Time Trigger
mysql
mysql  how to open\import table in .dbf format in mysql
mysql
you need to download the mysql-connector jar file for connecting java program from mysql database.......   Hi friend, MySQL is open source database... is the link for the page from where you can understand how to Download and Install MySQL
mysql
mysql  want the code for mysql nested select query with single where condition.want to select data from more than one table
MySql
MySql  what is default password of mySql, and how i configure mySql.   Hi, If you are installing MySQL on windows then you will have to provide the Password for the user root at the installation time.ADS_TO_REPLACE_1
problem in onlinetest...
problem in onlinetest...  hi, my code getting the problem is ,when user leave a question then the server puts error... pls help me
Problem in jsp.
Problem in jsp.  hello friends, I have a problem in jsp.I want to insert data, which is given by user through a html page into a table.And the table..."); Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test
Problem in jsp.
Problem in jsp.  hello friends, I have a problem in jsp.I want to insert data, which is given by user through a html page into a table.And the table..."); Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test
Problem in jsp.
Problem in jsp.  hello friends, I have a problem in jsp.I want to insert data, which is given by user through a html page into a table.And the table..."); Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test
uploading problem
about file into database lib. i use navicat Mysql ... i use this code... <...(); } } } } %> my problem...: firstly.... then problem solved... bt real problem is when i upload files fusing mozilla
problem in validation
problem in validation  sir/madam, i m using struts-1.3.10. i m getting a problem my properties file is not found.... while i hav configuired it in struts-config.xml file, likeADS_TO_REPLACE_1 thanks n regards himanshu
javascript problem
javascript problem  hi guys My problem is that I am using radio button for yes or no but i want to do that if I press yes button then enter... enter please help me this problem
Mine Problem
Mine Problem  how to view a row from a table created in mysql in a java swing application
Servlet problem
problem from last three month and now i hope rose india developers... connectivity code it works but problem is with servlet page. My servlet code...;"; Class.forName("com.mysql.jdbc.Driver"); String url = "jdbc:mysql://127.0.0.1
solve this problem
in table please tell me the solution for thid problem import java.io.*; import..."); PrintWriter out = response.getWriter(); String url = "jdbc:mysql...("text/html"); PrintWriter out = response.getWriter(); String url = "jdbc:mysql
Ant Script Problem - Ant
this Problem? Regards, K.Senthuran   Hi friend, Your Problem is related to JDBC Driver : Download the mysql-connector-java-3.1.6-bin.jar... visit to : http://www.roseindia.net/jdbc/jdbc-mysql/MysqlConnect.shtml
problem on strings
problem on strings  in string1 "123456 ABC DEF...",IN string2 "raveen". iwant to add string2 after 123456 in the first string based on index number.i need logic for this with out using StringBuffer concept. Thanks in advanace
Problem with loginbean.jsp
Problem with loginbean.jsp  http://www.roseindia.net/jsp/loginbean.shtml - I am getting an error in loginbean.jsp.There is some error regarding .What is hello in this? Also in this example how
compilation problem
compilation problem  struts 2.0 : i have included all 5 jars in lib folder,but its giving compilation problem that package open symphony doesnot... havenot set the build path.if this is the problem then tell me how to set
Problem with cookies
Problem with cookies  Hello All, i need jsp code for RememberMe module of login. i am facing problem with cookies. so please if any one could guide me please help and provide mme the exact code.   Please visit
problem with package
problem with package  Dear sir, i have created one java file with package com.net; and i compiled the program.it showing the .class file in " net" folder.The problem is i want to use that .class file in some other
compilation problem
compilation problem  struts 2.0 : i have included all 5 jars in lib folder,but its giving compilation problem that package open symphony doesnot... havenot set the build path.if this is the problem then tell me how to set
jsp problem
jsp problem  problem:::::::: On JSP form ,when i insert data in text field........at that time action is perform and data is retriev from data base... = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root
Jsp problem
Jsp problem  Hello friends.I want to share my jsp problem.I want to show all of my database(mysql) tables except two(user,manufacturer) in a jsp page.plssss help me
Oracle9i Problem
Oracle9i Problem  Hi I have a problem in Oracle9i .I have... the table what i created .But after closing the SQL+ ,the problem started.When i... .....;.it is saying no rows are selected.Why the problem arised in not getting the data that i
problem with session.invalidate()
problem with session.invalidate()  i stuck by a line with "session.invalidate()", after user logout also by pressing the back button of the browser user is still able to navigate to his home page and able to view the session
JScrollBar Problem...
JScrollBar Problem...  Hello Sir/mam, Can i know how to use JScrollBar to JFrame without adding any JPanel to it.. i want to add JScrollBar Directly to JFrame... Please Provide me Simple Example so i can understand
URL problem
URL problem  Hi. I have created a webpage for my project website. in that i have used frameset to split the page. Now if i click any link in the page its navigating to the another page. but the problem is here in the url its
problem of confirmation
problem of confirmation  sir, I tried ur code but when i click on cancel it still submits I dont need to pass id as record is already diaplayed... = DriverManager.getConnection("jdbc:mysql://localhost:3306/inventory", "root", "mca
Is AI a problem?
Is AI a problem?  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: Is AI a problem? Try... "Is AI a problem?". Also tell me which is the good training courses
Skyline Problem
is the line tracing the largest y value from any rectangle in S The Problem: Write.... Your method should solve the problem three different ways; each solution
Problem in Array
Problem in Array  Hi, Can you help me with this problem? Run a program that check if the input string contains equal number of A's and B's. Hoping for your answer.Thank you.   Here is an example that check
problem
Problem
Problem
problem

Ads