Help!!! Database problem.
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Micheal_Chao
Posted On:   Thursday, December 5, 2002 08:35 AM

Can anybody knows the problem: Action.java: Connection conn=null; try{ javax.sql.DataSource dataSource=servlet.findDataSource("job"); conn=dataSource.getConnection(); DatabaseBean bd =new DatabaseBean(conn); bd.insertCandidat(); DatabaseBean.java: public DatabaseBean(Connection conn){ m_conn=conn; } public void insertCandidat () throws SQLException{ Statement stmt=null; try{ String sqlstr="INSERT INTO candidat (name)" +"Values('Allo')"; stmt=m_conn.createState   More>>

Can anybody knows the problem:



Action.java:



Connection conn=null;
try{
javax.sql.DataSource dataSource=servlet.findDataSource("job");

conn=dataSource.getConnection();

DatabaseBean bd =new DatabaseBean(conn);

bd.insertCandidat();



DatabaseBean.java:



public DatabaseBean(Connection conn){


m_conn=conn;

}


public void insertCandidat ()
throws SQLException{

Statement stmt=null;

try{


String sqlstr="INSERT INTO candidat (name)" +"Values('Allo')";

stmt=m_conn.createStatement();

stmt.executeUpdate(sqlstr);

}






key="job"


autoCommit="true"


description="Job database"


driverClass="org.gjt.mm.mysql.Driver"


maxCount="2"


minCount="1"


user="user"


password="Password"


url="jdbc:mysql://localhost:3306/job"


/>








The results turn out that nothing had been done. I check in my SQL, an empty set. No error or exception had been report with I run the application. Please need serious help. I try everything. Thnaks.

   <<Less

Re: Help!!! Database problem.

Posted By:   neal_ravindran  
Posted On:   Thursday, December 5, 2002 01:23 PM

Try your sql insert command via command-line(sqlplus,isql...)
Probably the mistake lies there in.


If that does not help then you might get better help if you post it in the JDBC section

About | Sitemap | Contact