datasource 3 « DataSource « Java Database Q&A

1. DataSource Problem

Hi guys, I followed this tutorial here to test data source. I did everything that was there on the page and now I write the following sample Servlet as shown in the example with my own datasource name as import; import java.sql.SQLException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class DataSourceTesting extends HttpServlet { public void doGet(HttpServletRequest ...

2. How to configure Data Source?

3. Datasource

4. Data Source Benifts

6. DataSource class not found

7. Datasource in web.xml

8. contextDestroyed and DataSource attribute question

I'm using a DataSource to allow for pooling MySQL5 connection via Tomcat 6. I have a ServletContextListener and I'm wondering what the standard way of dealing with 'cleanup' is. Here's what I have as a first attempt. Suggestion? Thanks all: /* Remove DataSource and Logger attributes */ public void contextDestroyed (ServletContextEvent sce) { Logger logger = Logger)sce.getServletContext().getAttribute("dispatchLogger"); try { logger.logp(Level.INFO,"DBCPoolingListener", "contextDestroyed(ServletContextEven ...

9. Datasource

Hi, I have a question.I use datasource.getConnection() to get the connection as below. My question is does getConnection() have to be synchronized? Won't the datasource manage the connections in the pool. public Connection static synchronized getConnection(){ Connection conn = null; try{ DataSource dataSource = serviceLocator.getInstance().getDataSource (dataSourceName); conn = dataSource.getConnection(); } catch(Exception ex) { //do something here } return conn; }

10. DataSource passing param

I have concerns over passing DataSource object in a method. Rather, can the client (ClassA) create a datasource object and pass it to other method (in a classB)? Thanks in advance, Example: public classA { public static List getData() { return new ClassB().getData(createDataSource()); } private static DataSource c{ //Create a datasource object (ds) based on the //database connection parameters return ds ...

11. Best first steps for runtime datasources

I need a nudge or a shove in the right direction. I'm a Java newbie, but need some architecture advice on working with multiple db's in a servlet or J2EE I can narrow my vision/world a little and prevent getting overwhelmed. My challenge in a Nutshell. I have a commercial product that uses Oracle. This product has one database for ...

12. DataSource

HI Am using Oc4J datasource and three different application were using that. Is there any limitation for datasource say for example 100 connections or 200 connections. I know that it will reuse the connections. But what is the maximum no. of connections can a datasource hold ??. My application is MDB. So 3 MDBs may use some 1500 connections at a ...

13. Setting up Datasource object

14. Data source

15. Need to configure DataSource

16. Question about datasource

17. HSQL DB Datasource

18. redundant JDBC datasource for Datasource failure/suspend/overload

Hi, Our application has an requirement of handling failover/overload in backend access components. (Any suggestions other than mentioned below to handle runtime FAILURE/SUSPEND/OVERLOAD OF DATASOURCE is appreciated) since i am a newbie in JDBC and datasource i need some clarifications on jdbc datasource. i have a datasource DS1 associated with connectionpool CP1 , max connection capacity - 50 if i create ...

19. Convert DataSource to otherdatasource

Thanks for the response scott. This is to implement the proxy design pattern which is my cleint requirement. I've to proceed like this only for the SQLServerDataSource. OK, if i do testdatasource extends SQLserverDataSource i can achieve want i want.(setting the applicationname). But i'm having problem in accessing the datasource as specified earlier. Which is the retrieval of sqlserverdatasource from appserver's ...

20. Synchronize DataSource Instance?

public class DBBoard { static DataSource dtsrc; static Context envCtx; public static Connection getConnection(){ Connection con = null; if(dtsrc==null){ getDataSource(); } try{ con = dtsrc.getConnection(); }catch(SQLException es){ es.printStackTrace(); } return con; } public static void getDataSource(){ if(envCtx==null){ getEnvironmentContext(); } try{ dtsrc = (DataSource) envCtx.lookup("jdbc/someDB"); }catch(NamingException ne){ ne.printStackTrace(); } } public static void getEnvironmentContext(){ try{ envCtx = (Context) new InitialContext().lookup("java:comp/env"); }catch(NamingException ne){ ...

22. Problem using DataSource with core java app

i want to know if i can use DataSource mechanism instead of DriverManager to connect to a MS SQL Database. I use- 1) NetBeans 6.8 2) MS SQL Database 2005 with ms sql connector for java The below is my program which compiles and runs fine but without any output. The Database tables are correct. Thanks in advance. import java.sql.Connection; import ...

23. DataSource object

25. DataSource - Flush

Disconnecting and reconnecting is the only way to do this. Because you have a connection pool you will not actually know if the connection is actually closed or just returned to the pool. I can't think of a reason why you would want to do this though. What is driving this requirement?

27. Requesting help in connecting a DataSource(DSSDEV)

Hi All, Can anyone please help me connecting a DataSource from Oracle 9i I am using Oracle 9i as DataBase and Eclipse IDE and JBoss Application Server, I am using some code in oracle-ds.xml as below DSSDEV jdbc:oracle:thin:@ begin execute immediate('ALTER SESSION SET NLS_DATE_FORMAT = ''DD.MM.YYYY'''); execute immediate('ALTER SESSION SET NLS_TIMESTAMP_FORMAT =''YYYY-MM-DD-HH24.MI.SS.FF6'''); execute immediate('ALTER SESSION SET CURRENT_SCHEMA = DSSDEVDBALS'); end; ...

28. Data source problem

29. is using a static data source ok?

I made the data source static so that i wont need to do the lookup every time a request comes into my webapp and i was wondering if it would cause problems. The code checks if its null, and if it is, makes it. Two threads could make it, and I guess one would be overwritten, because its not technically a ...

31. Error catching for DataSource

In other words: try { Connection conn = _ds.getConnection(); try { Statement stmt = conn.createStatement(); try { ResultSet result = stmt.executeQuery("SELECT * FROM books"); try { ... } finally { result.close(); } } finally { stmt.close(); } } finally { conn.close(); } } catch (SQLException ex) { Logger.getLogger(DataSourceExample.class.getName()).log(Level.SEVERE, null, ex); }Or, with Java 7: try (Connection conn = _ds.getConnection(); Statement stmt ...

32. JDBC: Concept of DataSource

A datasource is typically a way for the server to manage the connection (or more likely connection pool) for you. A server has a map of datasources and other managed resources in a directory called the JNDI. You use a JNDI reference name in order to retrieve a reference to the datasource in your code.

34. what is XA datasource in java ?

35. DataSource Problem

Hi all, I am trying to access my database using a DataSource but I am encountering a problem and have tried in vain to find a solution(code snipet and stacktrace given below). I am using websphere application server and the database is Oracle 9i. I the server running. Any help would be greatly appreciated. Thanks String dsName1 = "jdbc/UpaidPool"; // JNDI ...

36. Datasource problem

Hi all , I am using TCL file with multiple queries as input to the web services. From following statement I am getting always (like multiple tcl client ) getting single con object. conn = ServiceLookUp.getInstance().getDataSource(config). getConnection(); **** ServiceLookUp class is single tone class . ********** My Resource tag in server.xml file

37. Cannot set DataSource for RowSet

I have always used ResultSet. Now I need to scrooll through the data on JSP page. And I found out that I need to use CachedRowSet. Unfortunately, my runtime has only javax.sql.RowSet. So, I'm trying what's available I have the following code fragment 1. RowSet resSet = null; 2. resSet.setDataSourceName(DBConstants.DATA_SOURCE); When executing the second line I get "Non-application exception occurred..." Can ...

38. source code to retrieve data

Hi there, i am newby in application deveelopment with basic knowledge of Java programing. Here is my problem. I can connect to any database from Netbeans or Sun creator IDE. The scenario is the following: I have an oracle database; on my IDE i put a label, a text field and a static text area to display results. What is the ...

39. datasource creation

41. Data Source in Java

43. datasource in j2me can be used for bluetooth communication

hi, i want have a application where i will send data to mobile and recevice data from mobile to pc via bluetooth my server(PC) side is Java and Mobile side is J2ME iam using RFCOMM for communication, now i my question is wheather datasource can be used for communication if posiible please provide the articles,...

44. datasource for sending bluetooth data from mobile to PC

hi i have a server code which is java runs in PC now i need to have a client code which should send the recording audio data from mobile to PC using bluetooth but i want to use datasource can it be done.. if so please post me some topics and examples Edited by: manju_hawk on Oct 17, 2008 3:18 AM ...

45. DataSource: Reference or New Object?

OK, since I'm still getting all confused here, I'll make this a concrete example: The code above sits in test.jsp. Person A and Person B both access test.jsp at the same time on different computers. Which of the following is true: 1) Person A and Person B each have connections from THE SAME connection pool 2) Person A has 1 connection ...

46. data source exception

47. Jasper Datasource

Hi, I'm creating pdf reports with IReport and I'd like to use JavaBean Datasource. But I want to receive two separated Bean Arrays in my Report. It seemed to me, from tutorials, that it is not possible to achieve. Is it possible instead? I'm thinking to use also subreports to receive this separated beans. Is it possible to set two different ...

48. Question regarding data source object

49. Clob Implementation of DataSource

50. byte array from DataSource

Hi. I have some problems with a JMF DataSource. I need get a byte array from the DataSource when I receive RTPStream in the end point. But in all examples the DataSource is used for creating a Player: DataSource ds = stream.getDataSource(); Player p =; Component comp = p.getVisualComponent(); Help me anybody, please. How can I create byte array (for ...

51. XML as a datasource

Hi Java application gets its data from DB in XML format. It comes in through jdbc as a clob. In java, i have a bunch of classes to where I should inject data from XML. What would be the best way to do this? I'm not very familiar with java and so all suggestions are welcome. At the moment reflection is ...

52. javax.sql.Datasource

54. Unable to resolve datasource

[java] Oct 23, 2007 9:40:30 AM oracle.j2ee.rmi.RMIMessages EXCEPTION_ORIGINATES_FROM_THE_REMOTE_SERVER [java] WARNING: Exception returned by remote server: {0} [java] java.rmi.RemoteException: bindWebApp() failed!; nested exception is: [java] oracle.oc4j.admin.internal.DeployerException: [RTGSApplication:rtgs] - Unable to resolve datasource: jdbc/__default [java] at com.evermind.server.administration.DefaultApplicationServerAdministrator.bindWebApp( [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [java] at sun.reflect.NativeMethodAccessorImpl.invoke( [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke( [java] at java.lang.reflect.Method.invoke( [java] at [java] at com.evermind.util.ReleasableResourcePooledExecutor$ [java] at [java] Caused by: oracle.oc4j.admin.internal.DeployerException: ...

55. Exception occurs while creating a new data source using BIRT RCP desighner!

Guys, Please help me on this ! I have created a pluin project( BIRT ODA API) using elipse and i have placed it in plug-in folder of BIRT RCP Desighner. When i try create a new data source i am getting the below exception and the jars are available in plugin folders : org.eclipse.datatools.connectivity.oda.consumer.helper.OdaHelperException: Unable to create the ODA driver's connection ...

56. custom data source using ODA API through BIRT

57. Protected datasource

59. Using datasource and datahandler

Hi, I am trying to find examples on how to use the javax.activation. classes datasource and datahandler. What I am trying to do is allow a user to specify a url. Depending on whats specified on the url, I would like my application to seek out a custom written datahandler to process it. For example, the URL could be the filepath ...

60. DataSource confusion

Well, that's one way of getting the DataSource, using the ServiceLocator pattern. But there are other ways to do it too. I think the article is trying to describe the service locator pattern and is using the data source as an example. If you know the DS is bound to JNDI, the service locator is a superfluous layer of abstraction.

61. Datasource question

Not sure what you're looking to do, but, one possible problem is, you are returning true if there's an excpetion, which is not the best approach. It would probably be easier if you just put that code into what ever method executes the sql command- check to see if the connection is non-null and available. If not, re-initialize it.

62. Is it Possible??? AudioInputStream to DataSource

Can anyone help me to convert one of these javax.sound.sampled.AudioInputStream javax.sound.sampled.DataLine javax.sound.sampled.SourceDataLine to one of these or any other Player in any other package that has a good set of controls like stop, play, seek and volume for MPEG3 audio The obvious answer is write the stream to a file first and then use a MediaLocator. ...

63. having problem in using url datasource

hi thanks for the information.I used the url object to pass the url.thats fine.But when i tried to send an email ,it is showing the email is sent but i dint get the email.But when i used FileDataSource instead of URLDataSource it is just sending the code as an attachment .What might be the problem?