Connecting To MySQL Database

Hi,

We are using MySQL as a backend.

Now i want to connect to one of the database which are there in

MySQL from java with Servlets.

So now i want to all the details on this topic

What are all the softwares needed for this.

What are the dirvers needed to connect to database.

If possible send me the code which connects to database

with servlets.

Thanks

[414 byte] By [servletforuma] at [2007-9-19]
# 1
Plz tell us more about your situation....what's your AP server?if U wanna use java to access mysql, I suggest U to http://www.mysql.org/downloads/api-jdbc.htmlto download the satisfied jdbc driver.....www.mysql.org is important to U now.
s88a at 2007-7-8 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 2

Hi

Thanks for u r reply.

I loaded MySQL and it is working fine.

I loaded all java software and java webserver

in that system.

Now i want to write one servlet which connects to

one of the table in one of the databases in MySQL.

For this what are all the softwares needed.

I have mm.mysql.jdbc-1.2c.tar which is downloaded from

http://mmmysql.sourceforge.net

but how to use this or to set the classpath.

If u know the solution send me asap.

Thanks

servletforuma at 2007-7-8 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 3
If U use the Tomcat be Ur AP server, maybe I can give U some help.But I am in my office now, I can give U more detail about server conf later.
s88a at 2007-7-8 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 4

Hi.

Thanks for u r reply.

I am using java web server,jdk,jsdk and win NT workstation.

So please help me to connect to MySQL from Java Servlets.

If u don't know the solution for this please ask u r friends who

can help me on this.

If they know send me all the information and software needed

for this work .

Thanks

servletforuma at 2007-7-8 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 5

I had tried since 2 days age. But I have no idea about the java web server also people around me.

anyway give U a little suggection about mySql

use jar.exe to uncompress your mySQL jdbc driver into your server claseese path.

set the classpath of your system.

create 2 tables in yor SQL server

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)

);

then set your conf file

and U can use the data source in your java program...

s88a at 2007-7-8 > top of java,Enterprise & Remote Computing,Web Tier APIs...