0

I have downloaded and installed oracle 10g express from internet and it shows as XE. Don't know what it actually means. Now, I have to connect my java program with the database and try creating table and execute queries as I did during my course with SQL server. Please guide me how to create the dsn, connect with database and do all my jdbc related programs now with this oracle 10g. Please let me know the step by step procedure starting from datasource creation till doing coding for jdbc in java... Thank you!!

5

2 Answers 2

1

You can create oracle datasource like this;

    OracleDataSource ds = new OracleDataSource();
    ds.setDriverType("thin");
    ds.setServerName("yourServerName");
    ds.setPortNumber(1521);
    ds.setDatabaseName("yourDatabaseName");
    ds.setUser("yourUserName");
    ds.setPassword("YourPassword");

And you can get connection like this;

    Connection conn = ds.getConnection();
Sign up to request clarification or add additional context in comments.

Comments

0

First of all you have to make the JDBC Connector available to your application. To do that download the JDBC connector from oracle ( http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-10201-088211.html ) and place it somewhere accesible by your application.

Secondly you have to use this JDBC to create a connection to the database. There are plenty of examples on SO on how to java code to query the database.

Here is also a nice complete example of what you are looking for : http://www.javaworkspace.com/connectdatabase/connectOracle.do

UPDATE

This is also a nice file to take a look at that shows you exactly what to do step by step http://pdf.coreservlets.com/first-edition/CSAJSP-Chapter18.pdf

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.