database query

database query

create table file1 ( file_id int , file_data text );

i'm unable to create this table and the error is invalid type text. plz help me.

View Answers

April 29, 2011 at 6:02 PM

Which database you are using?

If you are using Mysql database then this query works.

Here is the java code for creating a table.

import java.sql.*;
class CreateDatabaseTable 
{
    public static void main(String[] args) 
    {
        try{
            Class.forName("com.mysql.jdbc.Driver");
            Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/mysql", "root", "root");
            Statement stmt=con.createStatement();
            String table = "create table file ( file_id int , file_data text)"; 
            stmt.executeUpdate(table);
            System.out.println("Table is created successfully!");
        }
        catch(Exception e){
            System.out.println(e);
        }
    }
}

April 30, 2011 at 12:43 PM

actually i'm using oracle database. and i want to create a table with a field where i could save any uploaded file.plz help me.


May 2, 2011 at 11:12 AM

Then use Blob data type.

Ads









Related Tutorials/Questions & Answers:
database Query
database Query  i have to find common columns from two tables fron 2 differnt schemas what query to use? i used intersect but i am not getting how it is comapring two tables from different schema because in query we have
database Query
database Query  i have to find common columns from two tables from 2 different schemas what query to use? i used intersect but i am not getting how it is comparing two tables from different schema because in query we have
Advertisements
DATABASE QUERY
DATABASE QUERY  Sir, I'am making a project where the database has 2 cols, earning and expenditure. I'm using servlet and JSP and MS Access... the employees. I have written the query: try { Class.forName
database query
database query  create table file1 ( file_id int , file_data text ); i'm unable to create this table and the error is invalid type text. plz help me
database related query
database related query  i have created database in phpmyadmin of wampserver ! but i can't see it in mysql command line ! Can anybody please help me
how to write a query for adding records in database
how to write a query for adding records in database  How write fire query in JSP for adding records in database
MySql Databse query to fetch results from database
MySql Databse query to fetch results from database  Hi. I have a field in database named stages. its datatype is varchar(60). It contains values chennai,trichy,kanchipuram for a single record. I have to retrieve these data from
Query to insert values in the empty fields in the last row of a table in Mysql database?
Query to insert values in the empty fields in the last row of a table in Mysql database?  I have some fields filled and some fields empty in the last row of my MYSQL database. Now I want to fill up those empty fields in the last
MySql Databse query to fetch results from database and display it in HTML File
MySql Databse query to fetch results from database and display it in HTML File  Hi. I have a field in database named stages. its datatype is varchar(60). It contains values chennai,trichy,kanchipuram for a single record. I have
Database
Database  is it possible to view the query code after executing it.if yes tell me the procedure.   Yes, if you want to retrieve the data that is stored in database, then use the given query: select * from student
database
database  Is it possible to let the user first type the database and table name in textfields and then provide him a taxt area to type an insert query to insert data in that table and then execute the query.....The project
query
query  how to get data from database in tables using swings
database
; Have you run this query directly into the Mysql database? Here it works properly.   Have you run this query directly into the Mysql database? Here
database
database  database
database
database  database application
Database
Database  in my database i insert the first name and last name as('abc','def')but it gives error.plz send me the query how can we insert the first... is the query: insert into student(firstname,lastname,email,dob,phone) values
Database
Database  in my database i insert the first name and last name as('abc','def')but it gives error.plz send me the query how can we insert the first... is the query: insert into student(firstname,lastname,email,dob,phone) values('Roseindia
Database
the database, create and populate tables, query individual tables. (You must...Database  Hi, i need help building a database based on something like...), multiplicity (or cardinality), in the context of the database system (i.e. give
How to send from netbeans gui registration form to MySQL query browser database?
How to send from netbeans gui registration form to MySQL query browser database.... in textField then click the button named "Register" will send it to my MySQL Query Browser database. what code will i do? this is my existing code from my
How to send from netbeans gui registration form to MySQL query browser database?
How to send from netbeans gui registration form to MySQL query browser database.... in textField then click the button named "Register" will send it to my MySQL Query Browser database. what code will i do? this is my existing code from my
query optimization
query optimization  hai ! i need a code in java for database query optimization.plz help
query
query  how to delete checked record into database using checkbox in jsp   We are providing you the code where we have specified only three fields bookid,author and title in the database. 1) Create book.jsp <
database
database  the code for initializing the database connection
MySQL PHP Query delete
MySQL PHP Query delete       Mysql PHP Query delete is used to execute Mysql function ( ) delete query from a database table. MySQL PHP Query is used to delete the records
database
database  in my database i add some fields.the total fields are first... syntax errors so send me the how to write the query and insert the one table values also.   Use the following query to create a table will all
database
database  i want to let the user select the name of database and then delete that database.......im doing project in swings netbeans
database
database  use of hyperlink to show the data from database
database
database  i need to insert time in my database. i need a code to insert time in my database. its very urgent
database
database  im doing my project in netbeans swings...wn a user wants to create a database from the gui...i want to display an error msg if a database with that name already exists and if it does not exist new database should
database
database  tell me use about database and give me a small program.   It is secure and can easily be accessed, managed, and updated. Moreover... links: Connect JSP with database Mysql Connect Java with database Mysql
database
database  tell me use about database and give me a small program.   It is secure and can easily be accessed, managed, and updated. Moreover... links: Connect JSP with database Mysql Connect Java with database Mysql

Ads