Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7532931
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T05:35:42+00:00 2026-05-30T05:35:42+00:00

I am connecting to an oracle database using a connection pool. I have set

  • 0

I am connecting to an oracle database using a connection pool. I have set up my datasource file but when I try to get a connection I get the error

The method getConnection() is undefined for the type DataSource

I have searched the internet and it doesn’t seem to be a common problem. I am not sure what I have done wrong.

The code is:

<datasources>  
<local-tx-datasource>  
    <jndi-name>DefaultDS</jndi-name>  
    <connection-url>jdbc:oracle:thin:@ED.OPTO:1521:OPY>  
    <driver-class>oracle.driver.OracleDriver</driver-class>  
    <user-name>temiuser</user-name>  
    <password>password</password>  
 </local-tx-datasource>  

import javax.activation.DataSource;
import javax.naming.Context;
import javax.naming.InitialContext;
import java.sql.*;
import javax.sql.*;


public class dataSource {

    // load the driver
    Class.forName("oracle.jdbc.OracleDriver");

    String sourceFile = "java:/TVEContent";
    InitialContext ic = new InitialContext();
    DataSource ds = (DataSource)ic.lookup(sourceFile);
    Connection conn = ds.getConnection();
    Statement stmnt = conn.createStatement("select * from tve");

}

Please help!!!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T05:35:44+00:00Added an answer on May 30, 2026 at 5:35 am

    Name clash: import javax.sql.DataSource;

    BTW should it not be ic.lookup("DefaultDS") (unsure at the moment)?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using hibernate with connection pooled datasource <bean id=dataSource class=oracle.jdbc.pool.OracleDataSource destroy-method=close> <property name=connectionCachingEnabled value=true
I am using dotConnect driver for connecting to oracle database but i always get
I'm using OLEDB provider for ADO.Net connecting to an Oracle database. In my loop,
I have an Oracle Connection to a ORACLE 10.2 database and want to listen
How to make database connection pool in PowerBuilder (v9+) with... ...ODBC? ...SQL Server? ...Oracle?
Sometimes I get Oracle connection problems because I can't figure out which tnsnames.ora file
I'm trying to make a connection to an oracle database using the sample codes
I am using connection pooling of tomcat with oracle database. It is working fine,
I have a Java web application connecting to an Oracle database running on another
Periodically when using pyodbc to create a connection to an oracle database, it kills

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.