Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within JDBC and Relational Databases
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Tim Cooke
Campbell Ritchie
paul wheaton
Ron McLeod
Devaka Cooray
Sheriffs:
Jeanne Boyarsky
Liutauras Vilda
Paul Clapham
Saloon Keepers:
Tim Holloway
Carey Brown
Piet Souris
Bartenders:
Forum:
JDBC and Relational Databases
Starting Oracle services through java
amol l a lekurwale
Ranch Hand
Posts: 30
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
To start oracle services, we need to manually start them through services.msc in windows. Can anyone suggest a way to start them through the application before opting for the normal
jdbc
dbc connection.
Avi Abrami
Ranch Hand
Posts: 1143
1
I like...
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Amol,
If there is a Microsoft C++ API for starting services, I suggest using JNI or alternatively the "java.lang.Runtime" class.
Good Luck,
Avi.
amol l a lekurwale
Ranch Hand
Posts: 30
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
How to use java.lang.Runtime in this case?
Paul Sturrock
Bartender
Posts: 10336
I like...
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
From the command line it would be :
net start [oracle service name]
Just call that from a ProcessBuilder or using Runtime.exec().
JavaRanch FAQ
HowToAskQuestionsOnJavaRanch
Avi Abrami
Ranch Hand
Posts: 1143
1
I like...
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Amol,
You asked:
How to use java.lang.Runtime
http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
Good Luck,
Avi.
mehul thakor
Greenhorn
Posts: 5
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
u can use following code to connect oracle from
jsp
[
java
]....
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <%@ page import="java.sql.Connection" %> <%@ page import="java.sql.DriverManager"%> <%@ page import="java.sql.ResultSet"%> <%@ page import="java.sql.Statement"%> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Add trainee JSP program</title> </head> <body> <% Connection connection=null; int empid=0; try { String name=request.getParameter("name"); String city=request.getParameter("city"); Class.forName("oracle.jdbc.driver.OracleDriver").newInstance(); connection=DriverManager.getConnection("jdbc:oracle:thin:@10.122.130.40:1521:georli01","g2jun08ft2jeeoracle20","infy"); String query="select eid_seq1.nextval from dual"; Statement stmt=connection.createStatement(); ResultSet rs=stmt.executeQuery(query); rs.next(); empid=rs.getInt(1); stmt.close(); Statement stmt1=connection.createStatement(); String query1="insert into trainee values("+empid+",'"+name+"','"+city+"')"; int row =stmt1.executeUpdate(query1); stmt1.close(); } catch(Exception exception) { out.println("Error" +exception); System.out.println("Error" +exception); //it is good practice to use System.out.println() //for printing the error message in the server console } finally { if(null!=connection) { connection.close(); } }
amol l a lekurwale
Ranch Hand
Posts: 30
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Thanks to all for their valuable response.
Avi Abrami
Ranch Hand
Posts: 1143
1
I like...
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Mehul,
In case you are unaware, "oracle.jdbc.driver" package has been deprecated for almost two and a half years now:
http://forums.oracle.com/forums/ann.jspa?annID=201
Good Luck,
Avi.
Consider Paul's
rocket mass heater
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
how to start bpel language
Get Oracle Started
about "sid" in url for Oracle connection
ORA-1113:Can not open database
Tomcat can't be stopped
More...