Originally posted by dhwani mathur:
hi
Thanks for the response
First of all,i am not creating my connection
from java class,i am creating my connection from
JSP scriplet <% connection to database code here%>
Originally posted by ankur rathi:
Did you place your driver (jar) in the lib folder of tomcat or application?
JDBC Notes
Version : 0.1
Documented by : Ankur Rathi
Connection through DSN:
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:DSN_Name","username","password");
To create DSN:
programs -> settings -> control panel -> administrative tools -> data sources (ODBC)
create a new DSN here.
Thin Driver:
Take classes11.zip into class path.
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1526:Database_Name", "system", "manager");
To Know Database Name:
1] open a command prompt and type �net start�
2] open a command prompt and type �services.msc�
This will list down all the services, one of the entry will be like this:
oracleservice_SHREE
Here �_SHREE� is Database Name
OCI8 Driver:
Take classes11.zip into class path.
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con = DriverManager.getConnection("jdbc:oracle:oci8:@TNS_Name", "system", "manager");
To Know TNS Name:
Search �tnsnames.ora� file
A TNS Entry look like this:
SUNILDB =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = SUNIL01) (PORT = 1521))
)
(CONNECT_DATA =
(SID = SUNILDB)
(SERVER=DEDICATED)
)
)
Here TNS Name is �SUNILDB�
Everything has got its own deadline including one's EGO!
[CodeBarn] [Java Concepts-easily] [Corey's articles] [SCJP-SUN] [Servlet Examples] [Java Beginners FAQ] [Sun-Java Tutorials] [Java Coding Guidelines]