Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JSP-Servlet jsp connection with oracle.
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


sanatankumar
jsp connection with oracle.
2 Answer(s)      3 years and 7 months ago
Posted in : JSP-Servlet


I want to connect with jsp to oracle,,,plz send me the codes....


Advertisement
View Answers

June 28, 2011 at 1:06 PM


<%
Connection connection = null;
try {
    // Load the JDBC driver
    String driverName = "oracle.jdbc.driver.OracleDriver";
    Class.forName(driverName);

    // Create a connection to the database
    String serverName = "127.0.0.1";
    String portNumber = "1521";
    String sid = "mydatabase";
    String url = "jdbc:oracle:thin:@" + serverName + ":" + portNumber + ":" + sid;
    String username = "username";
    String password = "password";
    connection = DriverManager.getConnection(url, username, password);
} catch (ClassNotFoundException e) {
    // Could not find the database driver
} catch (SQLException e) {
    // Could not connect to the database
}
%>


August 15, 2012 at 12:12 PM


<%@ page import="java.sql.*" %> <HTML> <HEAD> <TITLE>Simple JSP/Oracle Query Example <BODY> <% Connection connection = null; try { Class.forName("oracle.jdbc.driver.OracleDriver"); connection = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "system", "bmwm5tt"); Statement statement = connection.createStatement(); ResultSet resultSet = statement.executeQuery("SELECT Capacity FROM Engine");

while (resultSet.next()) { int x = resultSet.getInt("Capacity");

} }

catch(Exception exception) { out.println("Exception : " + exception.getMessage() + ""); }

finally { if(connection != null) { try { connection.close(); } catch (Exception ignored) { // ignore }

} }

%>



Related Tutorials/Questions & Answers:
jsp connection with oracle.
jsp connection with oracle.  I want to connect with jsp to oracle,,,plz send me the codes
jsp connection with oracle.
jsp connection with oracle.  I want to connect with jsp to oracle,,,plz send me the codes
Advertisements
how to connection jsp to oracle database connections in netbeans ide
how to connection jsp to oracle database connections in netbeans ide  how to connect jsp to oracle database connections in netbeans ide?pls provide screenshots if possible
how to connection jsp to oracle database connections in netbeans ide
how to connection jsp to oracle database connections in netbeans ide  how to connect jsp to oracle database connections in netbeans ide?pls provide screenshots if possible
Java Connection to Oracle database
Java Connection to Oracle database  HI I am ubable to connnect jdbc to Oracle database.i had gone to control panel >>Administrative tool>>>Data source,in that forDNS name i typed Oracle and in TNS i culdn't
Hibernate- Oracle connection - Hibernate
to make a connection to oracle DB from eclipse. Thanks...Hibernate- Oracle connection  In Eclipse I tried Windows -->... on databaseconnection --> New Oracle Added ojdbc14 Jar file path UID
error oracle database connection?
error oracle database connection?  hi now i am trying to connect oracle database and also insert my data into table, but it's not working.. I created... in oracle table. my table name is logininfoclient_sla. this is my coding
java oracle connection problem - SQL
java oracle connection problem  I have successfully made connection... JSP. But the codes that i have tried for fetching the data are not working even though they do not show any error.Can you kindly provide me a code written in JSP
android connection to database oracle 10g
android connection to database oracle 10g  Hello, How i can connect my android application to my oracle 10g database
About connection database oracle to java
About connection database oracle to java  Hi I culdn't connect oracle datebase to java.when i compile the program it is ok.but when i clicked... Oracle and then i clicked add button.Then Dialog box came indicating DNS and TNS
About connection database oracle to java
About connection database oracle to java   I culdn't connect oracle... Panel>>Administrative Tools>>Data Sources in that i selected Oracle... just typed DNS as Oracle and for TNS i clicked on the list of TNS. But it has
About connection database oracle to java
About connection database oracle to java  **Hi I culdn't connect oracle datebase to java.when i compile the program it is ok.but when i clicked... Oracle and then i clicked add button.Then Dialog box came indicating DNS and TNS
About connection database oracle to java
About connection database oracle to java  Hi I culdn't connect oracle datebase to java.when i compile the program it is ok.but when i clicked... Oracle and then i clicked add button.Then Dialog box came indicating DNS and TNS
About connection database oracle to java
About connection database oracle to java   I culdn't connect oracle... Panel>>Administrative Tools>>Data Sources in that i selected Oracle... just typed DNS as Oracle and for TNS i clicked on the list of TNS .But it has
Could not establish the connection to oracle - JDBC
to use: Connection conn = DriverManager.getConnection("jdbc:oracle:oci8... to use: Connection conn = DriverManager.getConnection ("jdbc:oracle:thin... oracle.jdbc.driver.OracleDriver()); Connection conn = DriverManager.getConnection("jdbc:oracle
JDBC Connection code to connect servlet with oracle.
JDBC Connection code to connect servlet with oracle.  JDBC Connection code to connect servlet with oracle
JSP-Oracle connectivity
JSP-Oracle connectivity  I have created a "dynamic web project" mainly with jsp files in eclipse and now, want to connect with oracle 10g, so how can I proceed for the database connection
Todd oracle DB connection through PHP
Todd oracle DB connection through PHP  Can u please explain how to connect Todd oracle DB using PHP & What are the setups we need to perform? Thanks
REQ for connection b/w jdbc and oracle database
REQ for connection b/w jdbc and oracle database    REQ for connection b/w jdbc and oracle database    The Java classes to connect...:*** a) If you are using oracle oci driver,you have to use: Connection conn
if my database(oracle) connection failure means wat is the code to write in exception ?
if my database(oracle) connection failure means wat is the code to write in exception ?  if my database(oracle) connection failure means wat is the code to write in exception
java and oracle - JSP-Servlet
... data types in oracle database. And I need to write the code in servlets and jsp
jsp page connectivity with oracle - SQL
connectivity jsp with oracle. Please send the code for solving problem. thanks ...: a) If you are using oracle oci driver,you have to use: Connection connection... and password. b) If you are using oracle thin driver,you have to use: Connection
connection of jsp with mysql - JSP-Servlet
Example of connection between JSP and MYSQL  Need an example of connection between JSP and MYSQL
jsp-oracle validation - JDBC
jsp-oracle validation  Dear friends, my validation not takes place.... --------------------------------------- logoutaction.jsp --------------------------------------- oracle 10g...://www.roseindia.net/jsp/ Thanks. Amardeep   Hello I am try so many times
connection to mysql in jsp
connection to mysql in jsp  please i got this error message when trying to connect to mysql database in jsp. Unknown character set: 'utf8mb4
Connection Pooling - JSP-Servlet
Connection Pooling  Hi All, Iam new to Connection Pooling in Java. I need to create connection pooling for my MySQL Database with JSP using Bean... Connection con=null; public static Connection getConnection() { try
jsp connection to db2
jsp connection to db2  hello friends i have a project to do in jsp using db2 database can anyone please help me in connecting a jsp page to db2 database?? please frienda help me
jsp with database oracle
jsp with database oracle  hai i am doing one program in jsp i want to check the jsp life cycle methods so wrote one program, in which i write...*" %> <%! Connection con; PreparedStatement ps; public void jspInit() { try
Dbase connection - JSP-Servlet
Dbase connection  Hi! how to write common dbase connection for all JSP pages. In how many ways we can write this... send me any code if u have.......... Thanks in advance
connection with database - JSP-Servlet
and the connection with the database using jsp code, I get exceptions that I have... with java code. Is there any other way to establish a connection with database in jsp...connection with database  I tried the DSN and connection
connection of jsp with mysql - JSP-Servlet
connection of jsp with mysql  can anybody tell me about connection of JSP with MYSQL? and also tell me which version is compatible with tomcat 4.1 i am using tomcat 4.1, MYSQL 5.0 but i have problem with connection
 

 

 

DMCA.com