[prev in list] [next in list] [prev in thread] [next in thread]
List: mysql-java
Subject: Re: JDBC problem
From: "Duke Martin" <duke.martin () cybersensor ! com>
Date: 1999-07-30 19:31:55
[Download RAW message or body]
I think I understand what you are saying but what if the user interface
(HTML page and buttons) are different for each user. The only thing I have
control over is the name/value of each button. For example, say you had a
music collection database that keeps track of each user's cd collection.
When the user logs into your site, a list of all of his/her cd's is
generated along with a button next to each cd title in the list. When the
user clicks a button, a detailed description of the cd is displayed. For
example:
Garth Brooks button
BackStreet Boys button
I will also know if the user adds or deletes a cd. Will the solution you
previously described handle this situation.
Thanks for your help
Duke
----- Original Message -----
From: Mark Matthews <mmatthew@worldserver.com>
To: Duke Martin <duke.martin@cybersensor.com>
Sent: Friday, July 30, 1999 1:08 PM
Subject: Re: JDBC problem
> You could re-build the PreparedStatement every time, and substitute the
> name of the database in it. You could even cache the different
> PreparedStatements (1 per database name) in a Hashtable, keyed on their
> database name, and then grab it from the Hashtable based on what button
> the person pushed.
>
> With MM.MySQL, PreparedStatement is all done inside the driver, and it
> doesn't give you any performance boost, it's just more convenient to use
> when you don't know what format the data coming in for the query is going
be.
>
> -Mark
>
> On Fri, 30 Jul 1999, Duke Martin wrote:
>
> > Thanks for the info Mark. I am new to MySQL. Do you know if there is a
> > simple solution to my problem? Is there any way to relate the push of a
> > button on an HTML page to a table name on the database? I am willing to
> > re-design my database if necessary. Any ideas greatly appreciated.
> >
> > Thanks again,
> > Duke
> >
> > ----- Original Message -----
> > From: Mark Matthews <mmatthew@worldserver.com>
> > To: Duke Martin <duke.martin@cybersensor.com>
> > Cc: <java@lists.mysql.com>
> > Sent: Friday, July 30, 1999 12:54 PM
> > Subject: Re: JDBC problem
> >
> >
> > > The way PreparedStatement is implemented in my drivers, MM.MySQL, only
> > > recognizes parameters as part of the clause of a column comparison
> > > (basically after your operators).
> > >
> > > I don't know if any drivers support treating anything in an SQL
statement
> > > as a parameter, because that would basically make you have to parse
the
> > > whole SQL statement to figure out how to properly handle the
parameter.
> > >
> > > Considering the fact that java.sql.PreparedStatement talks about the
type
> > > of the input being compatible with the type of the column it is going
> > > into, I would assume that PreparedStatements are only parameterized
for
> > > column values.
> > >
> > > -Mark
> > >
> > > On Fri, 30 Jul 1999, Duke Martin wrote:
> > >
> > > > hi,
> > > >
> > > > I have a java servlet that interacts with a MySQL database. The
> > following
> > > > is a description of my program and my problem:
> > > >
> > > > I have an HTML page with buttons on it. The name/value pair
submitted
> > when
> > > > a button is pushed corresponds to a name of a table on the database.
> > > > Therefore, I am using a prepared statement and using the name/value
from
> > the
> > > > button as a parameter in the sql select statement. The statement
reads:
> > > >
> > > > select column1 from ? where id='104';
> > > >
> > > > The problem is that I get an sql exception syntax error. The query
that
> > the
> > > > server actually receives looks like this:
> > > >
> > > > select column1 from 'button_name' where id='104';
> > > >
> > > > The problem is the quotes around the table name. How do I prevent
this
> > > > error? Is there anyway to parameterize the table name in an sql
> > statement?
> > > > Please help. Any info appreciated.
> > > >
> > > > Duke
> > > >
> > > >
> > >
> ---------------------------------------------------------------------
> > > > Please check "http://www.mysql.com/Manual_chapter/manual_toc.html"
> > before
> > > > posting. To request this thread, e-mail
java-thread240@lists.mysql.com
> > > >
> > > > To unsubscribe, send a message to the address shown in the
> > > > List-Unsubscribe header of this message. If you cannot see it,
> > > > e-mail java-unsubscribe@lists.mysql.com instead.
> > > >
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > Please check "http://www.mysql.com/Manual_chapter/manual_toc.html"
before
> > > posting. To request this thread, e-mail java-thread241@lists.mysql.com
> > >
> > > To unsubscribe, send a message to the address shown in the
> > > List-Unsubscribe header of this message. If you cannot see it,
> > > e-mail java-unsubscribe@lists.mysql.com instead.
> > >
> >
> >
---------------------------------------------------------------------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail java-thread244@lists.mysql.com
To unsubscribe, send a message to the address shown in the
List-Unsubscribe header of this message. If you cannot see it,
e-mail java-unsubscribe@lists.mysql.com instead.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic