Connection 2 « Connection « Java Database Q&A





1. Local AdabasD connection    coderanch.com

Hi gang. I'm using Software AG's AdabasD JDBC driver to connect to a local AdabasD database. I set it up in StarOffice 5.2 as an AdabasD database and then I created a JDBC reference to it. The problem that I am having ( both in SO and from code ) is that I can't get the URL right. The driver documentation ...

3. returning a connection    coderanch.com

Hi, I am working with Tomcat with Netscape ES 3.6 on Solaris hitting a Sybase database. I have been asked to put all my 'connecting methods' (i.e. those with sensitive information like password etc.) in separate classes. I am trying the following code to 'return' the connection but it does not seem to be working. I get this error: java.sql.SQLException: No ...

4. DSN-Less Connection    coderanch.com

5. hung jdbc connections    coderanch.com

Hi all, I have a web application (servlets) connecting to Oracle RDBMS through a jdbc layer. The components are: -Oracle RDBMS 8.0.6 -Web Server iPlanet 4.1 -jdk1.2.2 -Oracle jdbc thin driver 2.0 (classes12.zip) -Sun/Solaris 2.6 In this configuration I get a wrong behaviour from the jdbc connections: when the user session goes down (because a timeout) the related jdbc connection remains ...

6. jdbc connection AGGRAVATION!! Can you help?    coderanch.com

I have just spent the last 5 hours attempting to connect to a MySql database on my server. Everthing is working perfectly on my home machine (where I designed the servlets) but I cant get this stupid thing to connect live. Ive sent several message to the tech support section & they did send some suggestions (which I tried) but nothing ...

7. Database Connection    coderanch.com

8. Connection    coderanch.com

I'm very new to jdbc. I hope you can help. How can I automatically connect to the database when my program somehow got disconnected from it. What if I'm already accessing for example the 4th row then I got disconnected. How could I go back to where I got disconnected? Can you please show it by editing my codes below. Thank ...

9. Class connection not found    coderanch.com

I am trying to display records from a Cloudscape database. When my page tries to display I get an error message that ends with 61: Class connection not found. I have checked my classpath and I am not sure where to look from here... Will someone give me a hint what might be wrong here? Thank you.





11. JDBC Connection    coderanch.com

I'll have a go at the second one (ramalingam manonmani) first: what you are probably looking for are JSPs and Servlets if you want to present database information in a web page... Now to the initial question: My preference has always been to use Class.forName("Driver class"). When the class is loaded, its static block (if it has one, and Drivers do ...

13. Establishing Connections to a Data base on a different machine    coderanch.com

Hi all, I want to use the database which is existing remotely( in a different firm). I am using the same format to connect to the other company's database. con = DriverManager.getConnection("jdbc racle:thin:@hostaddress ort:sid","username","passwd"); This same convention, if I try using my machine name or my machine's IP is working fine. But when I try to connect to the remote machine, ...

14. getting connection    coderanch.com

15. Connection Bean    coderanch.com

Hello Sir, Create javabean as follows: // Assign page name, very important package example.test; public class LoginCheck { private String userName = ""; private String passWord = ""; // Default constructor is required. public LoginCheck() { } // JavaBean needs setter and getter methods public void setUserName(String user) { this.userName = user; } public void setPassWord(String passWord) { this.passWord = passWord; ...

16. Making Connections    coderanch.com

Hi all, I have to write a servlet, or a Java class which calls 2 databases and selects some values from 2 tables. That is, when I come to that servlet, at first the servlet has to Select values x,y and Z from table A. Then this servlet has to select values r,t,y from table B. But table A and table ...





17. Initializing dB connection in init section    coderanch.com

Hello, I read lots of people saying that having dB connection initialized in 'init' section of a java code is not dependable, for the connection may be lost at any time. Instead suggested using a connection pool. Can I implement a solution for this as outlined below: 1. create a connection in 'init' section. 2. Use this connection for rest of ...

18. JDBC Connection Utility: static class?    coderanch.com

I am writing a JDBC connection utility to connect Lotus Notes to an Oracle database. It can be called from different part of Notes (like different client classes) but I need to make sure that only one thread can have the database connection at a time (long story!). I am thinking about writing my connection utility class as with static synchronized ...

19. Connection Release.....    coderanch.com

Hi, I have this following query ... I have a Connection wrapper class which when instantiated gets a connection from a datasource and stores it into a class level variable. Throughout the lenghth of my transaction i use this connection to execute my database queries. I have also written a wrapper for the "Resultset" Generated from execution of a query. This ...

20. Connection    coderanch.com

Caching of database Connections is normally handled via a central Conection Pooling mechanism. The pool opens all the required connections and you request connections from the pool and not directly from the database. I hope I understood your question correctly. This assumes that the application is acting as a client to a database server, and the application itself may be a ...

21. Many connections to DB    coderanch.com

It may, or may not be a concern. That depends on your application. Here's a scenario to consider: 2 people read the same data from the database. Person #1 updates the data. Person #2 has no way to know that the data has been updated. Now person #2 submits their update. This wipes out person #1's changes. If it's highly unlikely ...

22. connection problem    coderanch.com

23. Connection Hangs in the Production System    coderanch.com

Hi All I have Tomcat 4.0 along with Oracle as DB in our prod system. For JDBC Connections, we have implemented our own pool mechanism. Incase there are more requests than the size of the pool, we create a new connection and add it to the pool. Also the pool always checks whether the Connection is OK or not while giving ...

24. Several JDBC connections    coderanch.com

What is the problem? Are you wanting to do the same thing on each database, or different things? There is nothing stopping you connecting to a database, doing some stuff, disconnecting then going on to the next one. You can put this in a loop if you want to do the same stuff to each database. You can connect to multiple ...

25. having problem with jdbc connection for Personal Oracle8i on win98    coderanch.com

hi here is the stack trace i am getting...... java.sql.SQLException: No suitable driver at java.sql.DriverManager.getConnection(DriverManager.java:537) at java.sql.DriverManager.getConnection(DriverManager.java:199) at oracle.jdbc.driver.OracleDriver.defaultConnection(OracleDriver.java:382) at JdbcCheckup.main(JdbcCheckup.java:25) Exception in thread "main" this is for the following piece of code...... /* * This sample can be used to check the JDBC installation. * Just run it and provide the connect information. It will select * "Hello World" from ...

26. Static Connection??? is this right?    coderanch.com

I was talking with a friend the other day about a site I am working on that uses a LOT of JDBC connections throughout it. I have a connection object I use that creates a connection every time one is needed & then closes it right after its done being used. I would normally use a connection pool but this host ...

27. JDBC remote connection failure    coderanch.com

The database will have to reside on the same server that the applet resides on. So if that applet is downloaded from Web Server A then the Database must also reside on Web Server A. If this is not the case, then tell us more about your situation and maybe we can better help. Example, what error messages are you getting, ...

28. dsnless connection for mssql2000    coderanch.com

29. A Connection question    coderanch.com

31. establishing connection to mssql2000    coderanch.com

I am trying to establish connection to mssql2000 on server through JSP Server Tomcat The code used in jsp is //import required packages <%@ page language="java" import="java.sql.*, java.io.*, java.util.*" %> //urlformat one String url="jdbc:odbc:Dsnname;UID=username;PWD=password"; //url format two //String url="jdbc:odbc:Dsnname"; Connection con=null;; try { // Load Driver. Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); out.println("JDBC Driver Loaded"); } catch (Exception le) { out.println( "Error Number.1 : Could not ...

32. Database Daemon Connection    coderanch.com

33. ADO connection and JAVA --- Pls. HELP!!!    coderanch.com

Hi Ranchers, I have a Java application, whose database connection is through ODBC to SQL server. But this project is going to be integrated with another project; that project is using ADO connection to SQL server 7.0. May I know if Java application can use ADO connection as well? then I don't have much to change. Thank you so much

34. help reuired in jdbc connection    coderanch.com

35. very perplexing connection problem    coderanch.com

I have a very strange problem with some code. The code is as follows: public static List getInformation( String sqlStatement ) throws SQLException , NamingException { Connection connection = null ; Statement stmt = null ; ResultSet results = null ; List returnValue = new ArrayList(); try { returnValue.add( "before connection" ); connection = getConnection(); if( connection == null ...

36. Connection questions    coderanch.com

I am working through Jason Hunter, Java Servlet Programming and I have a question about a comment made in the text about an example. The chapter is about database connectivity and example 9-8 showcases a connection pool. Here is a cut and paste of part of the example: synchronized (connections) { while(cons.hasMoreElements()) { con = (Connection)cons.nextElement(); Boolean b = (Boolean)connections.get(con); if ...

37. limit on Connections    coderanch.com

Originally posted by Rkrishna daruri: Is it a good practice to initiate a connection to Database in the constructor of the class used as a bean? Probably not if you then put the bean into a web session. However, if there is only one bean in your application, or if the bean has application scope, or if your application has only ...

39. Setting connection Attribute    coderanch.com

We are taking conection from IAS connection pool for our work.My doubt is this. If Bean A takes a connection from pool and set the attribute of the connectio object to con.setAutocommit(false).After commit he is returning the conection to pool. Now suppose Bean B gets the same connection from the pool and he is expecting the default attribute from the connection ...

40. Connection Question    coderanch.com

I have written some Help Desk software for the company I work for. There are about 15 people that currently use this software. Right now, when information is needed from the database I open a connection, retreive/send my data, then close the connection. Is this the optimal way to do this, or could I get away with opening a connection to ...

41. Problem establish JDBC connection    coderanch.com

42. Connection from web.xml file    coderanch.com

43. connection with database    coderanch.com

44. creating connection    coderanch.com

I am making a project where every jsp requires a connection to a database. Now, at the moment I am creating new connection everytime jsp is loaded. Is this the only way except connection pooling? I want that only one instance of connection is made and it is only passed to all jsp's for the particular session. Means i do not ...

45. connection without class.forName    coderanch.com

The user in the thread linked imports the driver and then does the equivalent thing to Class.forName(), except that their code is now hard-coded to the Driver class. Changing database DRivers requires them to recompile their code. If you've every seen applications like Jira (bug tracking) and a whole bunch of others including anything that accesses a database a wondered 'How ...

46. db Connection    coderanch.com

Just a question regarding to connection to Oracle Database using Web under the ff: platforms: Web Server: IPlanet Database : Oracle Currently what I know is, under Windows environment all I need is create DSN under ODBC and use that as a connection in my code. Ex. Web Server: IIS, PWS Database: MS-Access How about the former? Is there an ODBC ...

47. Login authentication on Microsoft Acces using a DSNless connection    coderanch.com

I was wondering how I could authenticate a user against the workgroup information file that Access generates when you create user accounts in Access. I've eliminated the admin account for my table because I would like to have privaledge level database access to my table. PS - I'm running a DSNless connection from my app to Access. thanks, john

48. Connection to pointbase database    coderanch.com

49. mysql-jdbc connection problem    coderanch.com

50. JDBC Connection    coderanch.com

Hello all. I am trying to get an instance of my OracleConnection from the class OracleConnection. The compiled class is in the same folder as the Emp class that I am trying to compile. The Emp.java class cannot recognize the OracleConnection class. I have tried to add it to my classpath with no sucess, I have tried to import the class ...

52. DB Connection at www.mycgiserver.com    coderanch.com

hi guys!! can any 1 of u help me? actually Im working on a web-site built at the free space provided by www.mycgiserver.com, I used HSQLDB(Hypersonic DB), when i tried at my own computer it worked, but when i uploaded it at mycgiserver its giving me error. when i used fully URL of my DB, It showed the msg that "Connection ...

53. JDBC Connection (or "I Am At My Wits End")    coderanch.com

Hi, Whats the actual exception? I see a lot of code, but you have not said what the problem is. Are you not getting a database connection? It looks like you are running this in a Servlet or app container. A lot of times you need to deploy the JDBC driver to a location the Servlet/Application server knows about or you ...

54. jdbc connection problem    coderanch.com

55. Corrupted connection    coderanch.com

56. DB Connection with no DB    coderanch.com

Has anyone ever found a way to connect to a DBMS without specifying the Database Name initially? I know that doesn't make sense because of the way a Connection works in JDBC. But here is a possible scenerio that may help. What if someone deletes all the Databases in an SQL database? Is there no way in JAVA using JDBC to ...

57. Connection OK in JDK1.3, but fails in JDK1.4    coderanch.com

I'm using a JDBC connection to access an Oracle db. Using JDK 1.3 it functions OK with the following run-command: set JDK=C:\jdk1.3.1\jre set PROJ=C:\Distro set ORACLE=%PROJ%\classes12.zip set path=.;%JDK%\bin; set classpath=.;%PROJ%;%ORACLE%;%JDK%\jre\lib\rt.jar; set classpath java -version java -Duser.language=nl -Duser.region=BE -jar NAL.jar pause However using the same command to use JDK1.4, I get an SQLSTATE='080004' saying it is not possible to connect to this ...

58. connection    coderanch.com

59. Database brand from connection    coderanch.com

No, not really. I've got a factory class that I ask for connections. It needs to know (actually, all the data is in a property file). But the code that needs to know what database it's connected to has connections passed in to it. It's only because of limitations in the JDBC api that I need to know the database, so ...

61. urgently Required connection problem    coderanch.com

Thanks in Advance Actually i am having the problem with the connections, the problem is even though i am closing the connection in finally block some connections are not getting closed. i am using JSP,DB2,WebSphere the code is in my session bean can any one can say why the connections are not getting closed even though i am explecitely closing before ...

62. checking valid database connection    coderanch.com

63. table locks, static connection    coderanch.com

Hello. I think I have a problem, and don't know what to do about it. We have an application we created that connects to a DB2/400 database. When a user keys in an order number, the app retrieves the data from the db back to the user. I've recently noticed, that after the user has the data back, there is still ...

64. JDBC Connection problem    coderanch.com

Hello Everybody, I am getting one problem in J2EE application. I am using Oracle OC4j. I have hundreds of method which opens Connection (JDBC) object and explicitly closes at the end of method inside finally {} block. It works fine for almost all methods. But for some method I am getting following errors messages. DriverManagerConnection PoolConnection not closed, check your ...

65. Detecting database connection loss    coderanch.com

Hi, I have an app which connects to a database and perform some query (using SELECT "style" and stored proc) - all working well. But is there a way to detect loss a connection to my database as soon as it happens (is there an exception or event trigger I can catch or listen to) ? ( so I can auto-reconnect) ...

66. Interesting connection problem    coderanch.com

67. Two ways to get Connection object.    coderanch.com

68. Database Connection Fails    coderanch.com

I should clarify that I'm trying to run my applet in an IDE called VisualAge. The class of the applet is in the same directory as the DB2 classes. I have one further question though. I've read a number of forum entries suggesting that some JDBC connection problems can be resolved by running the usejdbc2.bat file in the java12 directory after ...

69. JDBC connection troubles    coderanch.com

70. Can I reuse connection ?    coderanch.com

This policy is no where near safe. You will encounter huge problems if multiple threads are attempting to use the same connection simultaneously. The best way to use connections is to create a pool of connections then each thread can request a connection from the pool, have exclusive use of the connectiona nd then release it back into the pool when ...

71. transactions/statements per connection    coderanch.com

Hi, I am working upon Java these days. I could not found any restruction as you said. I think you can have two or more statements objects for a single connection object. If you think we can not or found a reason that we can not do that, please let me know about it. I am looking forward for the reason ...

72. connection pooling/oracle/multiple jvms    coderanch.com

I have been using OracleConnectionCacheImpl in a manner suggested to me by the sample code on Oracle's web site, and when I originally set this up I had a lot of debug statements that occasionally reported that I had more instances of this than expected. I had to get on with other work but I've been puzzled about this for a ...

73. Connection Through JDBC    coderanch.com

74. Problem with database connection to ingres    coderanch.com

Hi, We have ingres database and our front end is java and jsp. Our development work is on one server and database is on different server. When I execute following code, I don't see any exception at loading driver but I get run time exception at getConnection as follows connection could not be established ca.edbc.util.EdbcEx: Unable to establish connection due to ...

75. connection thread safe    coderanch.com

76. Connection to Data Base    coderanch.com

Hi, I want to use the JDBC drivers and connect to oracle and SQL Server databases , requirement is that i have to connect to them , create a database , create a user who has full rights on that database and then exit... Is there any default password in oracle that i can use to log in and start my ...

77. One problem with DB Connection    coderanch.com

Here is the problem I have with one of my customer site. They are using MS SQL Server 2000, Java 1.4 and ODBC on Win 2000. for the database connection, I didn't use connection pool but just reused several database connections again and again. When there is only 40 clients connected, it's working great. However, when the number of clients connected ...

78. personalized connection    coderanch.com

79. Regarding Connection interface    coderanch.com

Hi All I have a doubt regarding connection interface.I am using connection interface to create statement.Connection is an interface and i am calling a method on interface and my work is getting done.I know it must have implemented by some lower lever classes and conncetion interface is abstracting all of them.I wanted to know how is it working and what is ...

80. Connection Problem    coderanch.com

Thanks Wayne for the reply. I did not get a chance to post an earlier reply that I solve the problem. All I needed to do was go in and remove the DNS for the access database and reenter it. I have no idea why it did not work the first time as the path was exactly the same. The data ...

82. InterBase - Java connection    coderanch.com

83. DB connection issue    coderanch.com

I am trying to connect to a database using this code it just doesn't seem to be connecting....if anyone has an idea as to why it wouldn't be I would really appreciate some feed back. public class dbISRDExtract{ public static final String SERVER_IP = "server.location"; public static final int SERVER_PORT = 5545; public static final int vedorld = 60007; public static ...

84. Need advise on live connection with the Database    coderanch.com

Hello all, im a newbie on using JDBC, im trying to create a simple java -GUI database program, i would to ask suggestion if im going to keep the connection alive while the program is running to my database, im using JDBC-ODBC bridge. i wish to create a program that has record manipulations such as add,edit,delete,search a record on the the ...

86. connection object reuse    coderanch.com

i have a question about the right architecture. i have an application which uses connection pool. there are different methods at my "model" tier which has to work with db: f.e. a method which makes update and method which returns some values taken from resultset. i know that in many cases i'll have to use these "update" and "select" methods one ...

87. Connection to Database    coderanch.com

Hi All, I've certain doubts abt JDBC...can anyone solve this? 1) While trying to connect to oracle database using type 4 driver, I'm getting following error java.sql.SQLException: No suitable driver I've set the classpath to classes12.zip, and even tried with classes111.zip 2) Suppose i've to connect from my machine to database which is installed on another machine. Is it necessary to ...

88. First connection, I want to do it !!!    coderanch.com

Great starting place: Sun's JDBC tutorial. That said, here's a VERY simple program that shows some of the basics: import java.sql.*; public class MyFirstDb { public static void main(String[] args) { Connection conn = null; Statement stmt = null; ResultSet rset = null; try { Class.forName("oracle.jdbc.driver.OracleDriver"); conn = DriverManager.getConnection( "jdbc :o racle:thin:@localhost:1521:mydatabase", "username", "password"); stmt = conn.createStatement(); rset = stmt.executeQuery("Select * ...

89. problem with connection    coderanch.com

90. Database Connection    coderanch.com

hi all, I am trying to talk to mysql(4.0.15-nt) database on my local machine(OS Win XP Home) from a java program. In oracle there is something like this right ? DriverManager.registerDriver(new OracleDriver()) I am sure there is one in MySql too,but I dont know what it is,let me know..... So Far this is what I have done to establish the connection. ...

91. Connection    coderanch.com

hi, Thanks for the continual help.I figured out the way the connection is established. I have a further doubt on this line. /*Connection conn = DriverManager.getConnection(url)*/. How do I give a userid and password in the above line so that I can connect to the MySql server. Kindly do let me know.Any help would be appreciated. nash

92. DB Connection!    coderanch.com

93. A single connection enough?    coderanch.com

For a web app, I always suggest using a Connection Pool and allowing enough connections for an estimated each user (to an extent). 1. A Connection Pool is easy to setup in any Web App. 2. That < 50 Web App can quickly jump to a > 50 web app, then you already have a Connection Pool in place and you ...

94. Connection Troubles    coderanch.com

I am trying to get my database connection sorted out - i can create the conenction and all works fine but I will need to connect to the databse from a number of files and don't want to have to keep copying the code so I am trying to move my connection code into a class and have the other classes ...

95. Syntax Check and Connection failure    coderanch.com

Whenever I have received that error it has usually meant one of 3 things: 1. The INFORMIXSERVER var is not correct 2. The server is not running 3. You're unable to connect due to a network issue (e.g. you got dropped by a firewall, etc) From the Informix error guide: The desired database server is unavailable, or the network is down ...

96. Need Help ( regarding connection)    coderanch.com

97. Problem in making connection    coderanch.com

98. Persistent Connection Bandwidth    coderanch.com

99. JDBC connection in Java Bean    coderanch.com

100. Database Connection please help    coderanch.com

Hi, I have a servlet that basically connects to the database if the userid and password is correct. I have a "login.html" page where the user enters the "userid" and "password".The servlet does the checking and grants access to the user. My question is as follows.As soon as I startup tomcat type in the url login.html,then press the submit button,(both the ...