![]() |
JDBC and Apache Tomcat pls help
I have this simple code for my JDBC java file:
:
import java.sql.*;I put the compiled code in the webapps/Root/web-inf/classes folder in the apache directory heres my web.xml file (in the webapps/Root/web-inf folder) :
<?xml version="1.0" encoding="ISO-8859-1" ?> when i do: http://localhost:8080/test.htm i get this: :
HTTP Status 404 - /test.htmany help is appreciated .... many many thanks |
JDBCTest is just a normal class; it needs to be a servlet tobe used with Tomcat.
:
|
If you want to retrieve data form table tb1, you should use rs.getXXX() functions like getInt, getString and etc.., ResultSet doesnot retrieves the data ,it just point the row.
|
i shal try that... many thanks...
but is there a way to just get the data in the result set no mattter if its interger or string |
getObject ;)
|
can i get a code exaple pls.. im kinda rusty on java..many thanks
|
I am using MYSql as a DBMS and the MYSql conector J as a driver... do any of you know what to put for the url ...
as in Connection conn = DriverManager.getConnection(" "); the documentation wasnt much help... and do i need a webserver to run JDBC code ? |
A typical value for the url would be "jdbc:mysql://localhost:3306/<database name>". Note that with MySQL, you have to GRANT appropriate priviledges to the user accessing the database otherwise you'll get a "Server configuration denies access to data source" error.
And no, you don't need a webserver to run JDBC code. You can run it straight from a normal "main()" application. |
icic..how do i grant privlidges?
also: to log into MYsql console i need a password, (the root password), that wouldnt be the password I use int he connection info is it? |
You need to read up on MySQL a little more, specifically how to create new users and to grant them priviledges. I won't go into it here, as there's 1001 articles online that'll explain it better than I could.
|
| All times are GMT -5. The time now is 1:17 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC