sql « Connection « Java Database Q&A





1. JDBC Database Connections in a Web App DAL    stackoverflow.com

I am building a small website for fun/learning using a fairly standard Web/Service/Data Access layered design. For the Data Access Layer, what is the best way to handle creating Connection objects to ...

2. Create a wrapper for java.sql.Connection that works with JDBC 3 and 4    stackoverflow.com

Is there some hack to create a wrapper for java.sql.Connection which works with JDBC 3 and 4 (Sun added a couple of methods and new types to the interface for JDBC ...

3. How many times should I close the connection In SQL?    stackoverflow.com

I have lots of method in my database class that all of them have one statement, when should I close the connection? In each method or at the end of database ...

4. JDBC: Does the connection break if i lose reference to the Connection object?    stackoverflow.com

If i have the following method -

public static void C()  {
    Connection con = DriverManager.getConnection();

    .... // code

    return;
}
and i ...

5. Finding the actual Job number for a particular JDBC SQL connection to iSeries?    stackoverflow.com

I am using the JTOpen JDBC driver to connect to the iSeries (aka AS/400, IBM System-i, IBMi, WTH?!...). I am having problems with a particular statement and it appears I ...

6. JDBC connection to very busy SQL 2000: selectMethod=cursor vs selectMethod=direct?    stackoverflow.com

In the process of trying to help out an app dev team with performance issues on a SQL 2000 server (from a bunch of Java applications on separate app servers), I ...

7. How do i connect an SQL file to my Bluej application?    stackoverflow.com

I really am new at this, and I don't really know what I'm doing so please be gentle. I have a blueJ program and an SQL database to connect it to. ...

8. Problems connecting to a database. Java/SQLite    stackoverflow.com

try {
    con = DriverManager.getConnection("jdbc:sqlite:db/Freepark.sqlite");
} catch (SQLException e) {
    // TODO Auto-generated catch block
    System.out.println("error al buscar la base de datos");
}
I am ...

9. Risk of SQL injection when connection to AS/400 using JTOpen    stackoverflow.com

We are using JTOpen to connect to our AS/400 machine, and I'm trying to work out the risks of having SQL injection vulnearbility when using this type of integration. Note that we ...





10. Cannot connect to msql 2008 express with JDBC    stackoverflow.com

I was able to connect to MSSQL 2008 express on local machine using SQL server management Studio for host 'nash-pc\sqlexpress'. But when I connect with Microsoft JDBC driver it gives ...

11. Selenium SQL Database Connection    stackoverflow.com

I'm running into an issue when I try to run a simple Selenium test that connects to a SQL database. The test will not run, it seems to fail on compiling ...

12. connecting to sql database in java    stackoverflow.com

I am trying to connect to a database. My friend wrote this code but isn't working. It is not showing any errors. The name of the database is testdb and table name ...

13. Question about build.properties    stackoverflow.com

I'm writing a program that uses JDBC and connects to a database and does some edits / deletes. I need to put the URL, username, and password fields into a build.properties ...

14. Database JDBC connection status    stackoverflow.com

I am (successfully) connecting to a database using

java.sql.Connection connect = DriverManager.getConnection("jdbc:mysql://localhost/some_database?user=some_user&password=some_password");
What should I be checking to see if the connection is still up after some time?
I was hoping for something like ...

15. Closing a database connection in Java    stackoverflow.com

I have the following method in my database class that returns a resultset for a given SQL statement:

public static ResultSet sqlStatement(String query) throws SQLException{
    ResultSet result = null; ...

16. How to Create A Connection Pool/Data Source rather than connecting to A SQL DB    stackoverflow.com

I have code that connects to a SQL DB and queries it based on user input. I would like to connect using a Pool instead to speed up the query times. ...





17. Unable to connect SQL 2005 in Netbean    forums.netbeans.org

Hi, Previously my jdbc SQL Server 2005 is able to connect to my local database. But now it got this error when I try to connect under the Services>Database

18. Can we NOT return a java.sql.Connection type Object from a Webservice?    forums.netbeans.org

sbanda Joined: 19 Nov 2009 Posts: 5 Location: donotknow Posted: Thu Nov 19, 2009 9:55 pm Post subject: Can we NOT return a java.sql.Connection type Object from a ...

19. How to connect to SQL Management Studio Express with NetBeans 6.9    forums.netbeans.org

Hello evryone, i'm new here, my question is: I use Netbeans 6.9 and SQL Management Studio Express and i want to connect to my database. 1- in the Service windows, i ...

20. Connection pool with javax.sql    coderanch.com

21. How to retrieve what SQL(s) a java.sql.Connection is running ?    coderanch.com

I've written a custom connection pooling package and I would like to display what each connection in the pool is currently running(Information on the session associated with this connection). I would like to display what SQL(s) this connection is running, how long has it been running and of course handles to those statements so that I can call statement.cancel() to stop ...

22. Connecting with SQL 2000    coderanch.com

23. JDBC & My SQL connection Problem    coderanch.com

Hi, This may be a simple thing I am overlooking so thanks in advance for any help. I am trying to connect to a mySQL database through a servlet that is called from a html form submission. I have all the connection properties in a simple class and when I try to instantiate the class, I get this error..... java.lang.ClassNotFoundException: org.gjt.mm.mysql.Driver ...

24. JDBC and use of SQL CONNECT BY and PRIOR for hierachy (son,father)    coderanch.com

JDBC and use of SQL CONNECT BY and PRIOR for hierachy (son,father) I want to have the hierarchy of an object. the schema of my table is : HIERARCHY with column SON and column FATHER person father father grandfather my request SQL (on Oracle) is this : SELECT SON FROM HIERACHY START WITH (SON = ?) CONNECT BY A = PRIOR ...

25. JTA, java.sql.Connection.close()    coderanch.com

The JTA 1.0.1B specification states: "The resource manager, once opened, is kept open until the resource is released (closed) explicitly. When the application invokes the connections close method, the resource adapter invalidates the connection object reference that was held by the application and notifies the application server about the close. The transaction manager should invoke the XAResource.end method to disassociate the ...

26. extending java.sql.Connection?    coderanch.com

I'm not sure this sort of thing is possible. The connections are returned from the drivers provided by the database vendor. So, even though you can implement your own connection or somehow extend the connection returned by your driver's implementation, there's no way to force your driver to use the newly improved connection. You would basically have to hack all the ...

27. Regarding java.sql.Connection    coderanch.com

I can't think of anything using the Connection object itself, but what you might want to look at is the underlying database. I often use the Oracle adminstrator tool to monitor database connections. I don't know off-hand how to access this data using JDBC (it will probably be a simple SQL query to list open connections to the database). I don't ...

28. java.sql.Connection ???    coderanch.com

29. Connecting to sql    coderanch.com

30. connecting to SQL database    coderanch.com

If this is the code, I dont think it would run. Java is server side if you use in JSP,you have written all java code in side script tag ,and your code is being treated as script code Please read something more about JSP Shailesh [ April 27, 2005: Message edited by: Shailesh Chandra ]

31. Buttons Connection for SQL    coderanch.com

Hello Sir, I request you to tell me that which aprroach should I used to connect database (SQL) by clicking Buttons. i have Done Buttons Programming in applets. When I attempt to run SQL Creat table Code, I got Run Time Error I used following code. import java.sql.*; import java.lang.*; import java.awt.*; import java.awt.event.*; import java.applet.*; public class ButtonDemo extends Applet ...

32. Newbie help please on SQL connection problem    coderanch.com

Paul, Thanks for the reply. I am working in the IBM RAD 6.0 IDE environment. After consulting with one of our IBM RAD contractors here he found that I had to put the .jar files in the WEB_INF\lib folder. Which I did and now I am somewhat connecting to the SQL Server. NOW, my problem is that my program is blowing ...

34. couldn't connect to SQL database    coderanch.com

35. How to connect to SQL    coderanch.com

36. Sql Connection    coderanch.com

37. MY SQL Connection    coderanch.com

38. java.sql.Connection object, can it be a class var of a DAO?    coderanch.com

Hi All. I am wondering if there is any reason NOT to do this. I have many DAO object that start like this : public class ProcedureDAO extends BaseDAO { public static Collection getProcedureList() throws DAOException { Connection conn = null; Statement stmt = null; ResultSet rs = null; Could I declare the conn, stmt, and rs variables in my BaseDAO ...

39. java.sql. Connection prepareCall method    coderanch.com

40. Sql Connection    coderanch.com

41. Passing values into the SQL connection class?    coderanch.com

I've never made a database connection in java and building a select statement to retrieve the info needed and am needing some help. I have a class that makes the connection: // Method to get a connection to a SQL Server 2000 database. public void SQLConn(){ Connection con = null; String hostname = "localhost"; // local machine try { Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver"); con ...

42. sql connection with java    coderanch.com

First of all, the .tar.gz file is an archive file. You need to unpack it with tar: tar xf mysql-connector-java-3.0.10-stable.tar.gz One of the unpacked files will be a JAR file. It doesn't matter in which directory you put that JAR file; what you need to do is include it in your classpath. When you run your program, do it like this ...

43. Updated from JRE 1.5 to 1.6, now SQL JDBC Connection doesnt work    coderanch.com

Help! I am writing an applet that connects to a SQL 2005 database. Originally I had JRE 1.5, and the code below worked fine for connecting to my SQL Server database: ------------------------------------------------------------------------- try{ connectionUrl = "jdbc:sqlserver://MyPC\DS;databaseName=CP243IT_Sample; IntegratedSecurity=True; Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); con = DriverManager.getConnection(connectionUrl); bRet = true; // success DBConnected = true; txtMsgArea.append("Successfully connected to database.\r\n"); } // Handle any errors that may have ...

44. problem in connecting sql 2005    coderanch.com

Hi guys this is my program.I am using netbeans6 IDE and Microsoft sql driver for JDBC. I am trying connect to the SQL 2005 database.I have added the Driver in the application by right click in project ---> Properties -----> Add jar Files. I am getting this Exception "Exception No suitable driver found for jdbc.sqlserver://localhost:1433;databaseName=Project_Airways;user=sa;password=sql2005; debug: " import java.sql.*; public class ...

45. how java.sql.Connection works?    coderanch.com

46. How to Connect Sql to NetBeans    coderanch.com

47. connecting to sql file    coderanch.com

48. connectivity with my sql without connecting to existing database    coderanch.com

thankyou sir.. still i have doubt... i know how to connect to a database...using jdbc odbc driver..please read following line..... Class.forName("com.mysql.jdbc.Driver"); Connection conn =DriverManager.getConnection("jdbc:mysql://localhost:3306/db2","root","prakki"); Statement stat1=conn.createStatement(); these are the lines which i wrote to connet with database db2... bt i want to know that what should i do if every user will create his own database after login ??

49. NPE for sql Connection    coderanch.com

public static Connection getJDBCConnection() { Connection connection = null; String url = null; try { Class.forName("oracle.jdbc.driver.OracleDriver"); url = "jdbc:oracle:thin:@localhost:1521:mydb"; connection = DriverManager.getConnection(url, "my", "my"); System.out.println(connection.toString()); }catch (SQLException e) { System.out.println(e.getMessage()); } catch (ClassNotFoundException e) { System.out.println(e.getMessage()); }catch(Exception e){ e.printStackTrace(); } try{ System.out.println(connection.toString()); // NPE thrown here }catch(Exception e){ e.printStackTrace(); } return connection; }

51. Having problems with sql connection    coderanch.com

Well, the documentation covers most of this. If you are planning to do much administration I'd start to read through these. Long term this will make things easier. For now, to check what kind of authentication your instance supports use SQL Server Management Studio to view the security properties. By default it will be "Windows Authentication Mode"; for the connection string ...

52. connecting to online SQL DB    coderanch.com

What do you mean with this; do you have a Java application which is compiled to a native Windows executable (*.exe file)? No, sorry my fault it is a Executable JAR file You need a JDBC driver, which is normally only a JAR file that you have to put in your classpath. What kind of database is it (MySQL, Oracle, PostgreSQL, ...

53. close sql connection in finally block    coderanch.com

It's very similar to a Readertry { Connection conn = . . . ; // One line only to declare and create the Connection object { conn. // Use the Connection. As many lines as you need } finally { conn.close(); } } catch (SQLException sqe) { . . . }But you should consider whether it is better to keep Connections ...

54. basic SQL connection steps    coderanch.com

Hello, i don't know if this topic exists already or not, but i'll try my luck anyways. I am currently trying to make a connection with an sql server, and i have absolutely no idea what to do. I work with SQL Express 2008 R2 version. I downloaded the sqljdbc.jar and sqljdbc4.jar drivers from the internet. I put them in the ...

55. Unable to connect to a datasouce, getting the SQL sqlstate 08001    coderanch.com

Hi folks, I have tried in a lot of places and still no luck, I am trying to connect my Java application using a Type 1 JDBC driver, with MS SQL 2008. The server is installed on my computer itself and I am able to access the server and make changes to the database and all but, when I try to ...

56. connecting to sql 2000 using jdbc    dbforums.com

Hello All I'm trying to set up a connection to sql server 2000 using java in a jsp page. but i get the following error when loading through Tomcat 5.0 Thanks for any help My code is as follows: <%@ page language="java" %> <%@ page import="java.sql.*" %> <%@ page import="javax.servlet.*" %> SQL <% //String driver = "com.microsoft.jdbc.sqlserver.SQLServerDriver" ; ...

58. sql connection with java    java-forums.org

import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.PreparedStatement; import java.sql.*; public class conection { private static final String USERNAME = "admin"; private static final String PASSWORD = "welcome"; private static final String DRIVER = "sun.jdbc.odbc.JdbcOdbcDriver"; private static final String URL ="jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=test.mdb;}"; //make an URL to my database test.mdb which must be in your project folder. public static void ...

59. Connection with microsoft sql 2005    java-forums.org

60. problem with sql connection    java-forums.org

dear friend. i got problem to connect java apps with sql database. this implementation made by using dk1.6,mysql xamp,jdbc. when run it,the error with message "not suitable driver found for jdbc. already tried to install the jdbc driver n set classpath, but not succeeded.im begging for help here . before that,thankyou and forgive my english this link,show my output : imgPlace.com ...

61. Java connecting to sql database    java-forums.org

Alri lads Having to use a database, pretty sure I have it connected ok, but getting a error or two. Decided to start with the INSERT PART since I thought it would be handiest, rather than working on logging in or anything. Java Code: public void actionPerformed(ActionEvent e) { if (e.getSource().equals(submit)) { try { Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection( "jdbc:mysql://localhost:3306/assignment", "root", ...

62. Connect Java to SQL    java-forums.org

import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Statement; public class Main { public static void main(String[] args) throws Exception { if (conn != null) { System.out.println("Connection attempt was successful!"); try { conn.close(); } catch (SQLException ex) { ex.printStackTrace(); System.out.println("Problem closing the connection"); } } } static Connection conn; static Statement st; static { try { // Step 1: Load the JDBC ...

63. SQL Connection    forums.oracle.com

65. connecting java to sql    forums.oracle.com

Below is what eclipse wright out. And I dont really understand because I am using passworld and before it didnt even write out the syso lines in the end, but since I changed the getConnection methods parameters it does, so I really hope that I have installed the driver right. java.sql.SQLException: Access denied for user ''@'localhost' (using password: NO) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1056) ...

66. Connecting java to sql plus editor    forums.oracle.com

I am having so many directories in which they contains so many .sql files which contains large no of queries and procedures written in them. Up to now i used to copy those queries manually from these files and paste them in the editor and used to run them. Now i need to automate it by making a tool in java(stand ...

67. Sql Connection    forums.oracle.com

68. Problem with SQL connection    forums.oracle.com

69. SQL connection    forums.oracle.com

71. connecting to local sql database    forums.oracle.com

72. Sharing a SQL connection between classes    forums.oracle.com

It takes a while to connect since I am forwarding, but that isn't an issue. If I go to create a new connection within a different class, I get an exception of some sort. I can't view it currently because the exception shows up in a JOptionPane and it goes way beyond the screen height. What do I could to share ...

73. passing sql connection object?    forums.oracle.com

Hi there,i need advice from experts or from you if you know about this well. Information:I am developing a web application using standart jsp & servlets.I am using DBCP commons library and built a connection pool with tomcat datasource. Here is my question; I have some common servlets which other main servlets will call sometimes.These common servlets makes sql connection & ...

74. Regarding connection between front end HTML and back end SQL 7.0    forums.oracle.com

Hi!! I am working on the project 'ERM'. I have designed 12 forms using HTML. Can u please give me brief idea how to establish the connection between a back end and front end i.e. between HTML and SQL 7.0. If possible can u provide me the source code for the same. I will be very thankful to you. Thanks, Jigar. ...

75. Connect a Progress Database with SQL Explorer Tool (Progress too)    forums.oracle.com

When i try to use this tool i have the next problem and i unknow where or how found information to solve this, please help me. The url is : jdbc:jdbcprogress:T:localhost:20931:sports2000 sports2000 is a Progress database reside in my local disk c:\ The problem: java.lang.UnsatisfiedLink.Error: java/security/AccessControler.doPrivileged Possible causes: If you are trying to use J/Direct(@dll.import), check your compiler version (for JVC, ...

76. Problem in Connecting to SQL DB through Java    forums.oracle.com

So to debug it you start with the following babyhuey.cis.temple.edu:3306 First might as well validate the domain. On windows you do this nslookup babyhuey.cis.temple.edu For me I get the following result which indicates the domain exists. Name: babyhuey.cis.temple.edu Address: 155.247.182.88 So now you check the port by telneting to it telnet babyhuey.cis.temple.edu 3306 And this fails due to connection failure. That ...

77. Problem with Connection while doing SQL in JAVA    forums.oracle.com

Then use the help menu to learn how to pass in arguments via the IDE. HINT: It involves right clicking on the project node, and selecting properties, I'll leave the rest to you, I learned this in the last 5 minutes on my own, since I have never really used NetBeans, but do happen to have it installed. BTW, why the ...