How To Pass a Collection/List/Map Through the iBatis to the Database?

2005-09-14 Thread Caroline Jen
I am currenly using JSF as the front end of a J2EE
application. Data go through many business logic
layers and reach the database through the iBatis.

The iBatis is new to me. To pass a query String from
the front end to the database and get a Collection
back from the database through the iBatis has been
tested successful.

Now, I have great difficulty to pass a List or a
Map through the iBatis to the database? Is it
possible to be done?

The reason is that a table with thousands of records
and each record has many name/value pairs may be sent
to update the database. And looping through the table
to send Strings may not be a solution.

Thank you in advance.


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



What Is LIMIT? and How to Use LIMIT?

2004-04-01 Thread Caroline Jen
I saw somebody has MySQL statement this way:

StringBuffer sql = new StringBuffer(512);
sql.append(SELECT ThreadID, ForumID,
MemberName, LastPostMemberName, ThreadTopic,
ThreadBody);
sql.append( FROM  + TABLE_NAME);
sql.append( ORDER BY  + sort +   + order);
sql.append( LIMIT ?, ?);

What is LIMIT?  What those question marks stand for?

__
Do you Yahoo!?
Yahoo! Small Business $15K Web Design Giveaway 
http://promotions.yahoo.com/design_giveaway/

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



How To Write This SQL Statement

2004-02-17 Thread Caroline Jen
Please help.  What is the syntax of idenfying those
who do not have addresses (in the address field) in
the database?

__
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Multiple Roles

2004-01-02 Thread Caroline Jen
In case that a user has multiple roles; for example,
John Dole is both author and editor, 

1. I should have two rows for John Dole?

   John Dole author
   John Dole editor

   or. I should have only one row and use comma ',' to

   separate the roles?

   John Dole author, editor

2. How do I create the table for the second case (see
below)?

  create table user_roles (
  user_name varchar(15) not null,
  role_name varchar(15) not null, varchar(15) null
  );

__
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Primary Key

2004-01-01 Thread Caroline Jen
I saw an example of creating tables (see below).  I
wonder what the primary key (user_name, role_name) in
the table user_roles means?  Does it mean that both
user_name and role_name are the primary key of the
user_roles table?  How does a table have two primary
keys?

create table users (
  user_name varchar(15) not null primary key,
  user_pass varchar(15) not null
);

create table user_roles (
  user_name varchar(15) not null,
  role_name varchar(15) not null,
  primary key (user_name, role_name)
);

__
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Problem With Creating Table

2003-12-31 Thread Caroline Jen
Hi, I tried to create a table.  This table has
seventeen fields.  My create table syntax gets too
long and I was only able to specify 5 fields at the
mysql prompt in the DOS window (DOS does not accept a
command beyond certain length).  How do I put the rest
12 fields in the table I just created?

mysqlCREATE TABLE message_thread (thread_id INTEGER
NOT NULL AUTO_INCREMENT PRIMARY KEY, message_receiver
VARCHAR(79) NOT NULL, message_sender VARCHAR(79) NOT
NULL, article_title VARCHAR(255) NOT NULL,
last_post_member_name VARCHAR(79) NOT NULL);

__
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Create Tables In MySQL

2003-12-30 Thread Caroline Jen
Hi, I have several simple questions regarding creating
tables in the MySQL.

1. For a variable of Java primitive int type, I should
use INT or INTEGER? Do I have to specify the length of
the field?
CREATE TABLE message_thread( thread_id INT or INTEGER
NOT NULL AUTO_INCREMENT PRIMARY KEY);

2. A field in my table is for storing articles.
Articles could be very long in variable length. I
should use VARCHAR or TEXT? What about the length of
the field?

3. For a variable of the Timestamp type, do I specify 
CREATE TABLE message_thread( thread_creation_date
TIMESTAMP NOT NULL );
What about the length of the field?

Thanks for your advices in advance. 



__
Do you Yahoo!?
Find out what made the Top Yahoo! Searches of 2003
http://search.yahoo.com/top2003

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



How Do I Insert ...... ?

2003-12-25 Thread Caroline Jen
I have a table 'message' in the MySQL database.  To
make it simple; say, I have three fields in that
table: thread_ID, thread_topic, and thread_body.

The thread_ID field is AUTO_INCREMENT; therefore, I do
not insert any value into that column.  The value of
that field starts with 1 when the first row is
inserted.

Now, I have the values for thread_topic and
thread_body and want to insert those values into the
'message' table to create the first record in that
table.  

1. where and how do I indicate that there is a problem
insert a row into the table 'message'?  

2. Do I code this way:
 
protected static void create(String threadTopic,
String threadBody) throws CreateException,
DatabaseException, ForeignKeyNotFoundException 
{
   StringBuffer sb = new StringBuffer(512);
   sb.append(INSERT INTO  + message  
 + (thread_topic, thread_body));
   sb.append( VALUES (?, ?));
   try
   {
  Connection conn =
DBConnection.getDBConnection();
  Statement stmt =
conn.createStatement(sb.toString());
  stmt.setString(1, threadTopic);
  stmt.setString(2, threadBody);
   }
   catch(SQLException sqle) 
   {
  sqle.printStackTrace();
  throw new DatabaseException(Error executing SQL
in ThreadHelper.create.);
   }
   finally 
   {
  stmt.close();
  conn.close();
   }
}

__
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



IDENTITY column

2003-12-23 Thread Caroline Jen
Hi, I am a beginner in using database.  And I
appreciate your support and help.

When we first create a table, 

1. is it possible to create a column that identifies
each record that is to be inserted?

2. If we can create this IDENTITY column, how do we
create it?  Do we set a maximum to the value of this
column?  Or the value simply increases as the number
of records get inserted into the table grows? 

3. when we try to insert the first record to this
table, does this record go to the first row in the
table?  And the value of the IDENTITY for this record
is 1?  When we try to insert the second record to this
table, does the second record automatically go to the
second row in the table?  And the value of the
IDENTITY is 2?



  


__
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Is It Possible To Change the Value of A Particular Field Manually?

2003-12-17 Thread Caroline Jen
Hi, I am not a database person.  I have a database
called members.  One of the fields in this database
is user_name.   There are a number of records in
this database.  Under the field user_name, I would
like to make some changes manually; for example, I
want to change

John Doe   

to 

john_doe  

Is it possible to do it?  How do I do it?  Thank you
very much in advance.

__
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



How To Delete A Particular Record From a Table?

2003-12-01 Thread Caroline Jen
Hi, I am new in using database.  I have created a
table in a MySQL database.  I want to delete a record
from the members table.  The record I want to delete
is: user_name=John Smith.  I tried:

MySQLdelete John Smith from members;
it does not work.

MySQLdelete username='John Smith' from members;
it does not work either.

__
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Select Records From the Database

2003-12-01 Thread Caroline Jen
I got null after selecting records from a table in
the database.  The table is created by me.  I know how
many records will be selected.  Just cannot be null.

I cannot help wonder if my SELECT statement is correct
- I want records to be selected if user_role is equal
to the userrole I supplied AND if journal_category is
equal to the category I supplied.  My statement is:

String query = SELECT user_name FROM members WHERE
user_role = ' + userrole + ' AND journal_category =
' + category + ';   

Do anybody see any mistake? 

__
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



How To Create An ArrayList From the MySQL database

2003-11-27 Thread Caroline Jen
I have a table members in the MySQL database.  I am
going to supply a String editor and search the
members table.  All those who are editor will be
picked up and their name will enter the array I want
to create.

How do I code it and return this array? 

Here is a sketch of my code.  I do not have any
confidence in my code.  I tend to creat a bean for
this ArrayList.

  EditorBean editorList = null;
  
  try 
  {
 conn = DBConnection.getDBConnection();
 stmt = conn.createStatement();
 String query = SELECT user_name FROM members
WHERE user_role = ' + userrole + ';   
 rs = stmt.executeQuery( query );
 if ( start = 0  rs.absolute( start + 1 ) )

 {
boolean hasNext = false;
List editors = new ArrayList();
do
{
   editors.add(new EditorBean(
rs.getString( user_name ) );
} while ( ( hasNext = rs.next() )  (
--count  0 ) );
editorList = new EditorBean( editors,
start, hasNext );
 }
 else
 {
editorList = null:
 }   
 return editorList;
  }


__
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Conditional Search of the Database

2003-10-30 Thread Caroline Jen
I am learning to query the MySQL database
artimus_article.  My database is a storage of articles
with name of the creator, title of the article, the
category in which the article is classifies, ,
etc.

I try to search articles by the name of the creator
within the computer science category.  Are there
mistakes in my prepared statement shown below?

SELECT * FROM artimus_article WHERE creator LIKE (?)
AND category=computer science ORDER BY creator,title;

Should I put computer science in a pair of double
quote or a pair of single quote?

__
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



How To Create Users In MySQL?

2003-09-10 Thread Caroline Jen
I have the MySQL-3.23.55 installed in my PC.
Therefore, I am the DBA without the required DBA
knowledge.

First, how do I create users in the MySQL database?
Second, how do I grant table creation privilege to
users? Is

GRANT ALL PRIVILEGES ON databasename TO someuser
IDENTIFIED BY 'somepassword';

the correct command?

Thanks for your guidance. 



__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]