sql 2 « mysql « Java Database Q&A





1. How to add a list to a SQL database (using java)    stackoverflow.com

I am new to sql and I was wondering how i can add a list to a database. Here is what I mean: I have an a java class like this ...

2. How to set "SQL_NO_CACHE" default in a pooled mysql JDBC connection    stackoverflow.com

Our mysql server has "SQL_NO_CACHE" off by default, and I wish it off for my application. I can rewrite all my SQL statements but it sound stupid. According to the

3. What is the java.sql.Types equivalent for the MySQL TEXT?    stackoverflow.com

When using PreparedStatement's setObject method for a column of type TEXT (in a MySQL DB), what should the last parameter be? For example, I know that this is ok for a VARCHAR ...

4. A datetime equivalent in java.sql ? (is there a java.sql.datetime ?)    stackoverflow.com

So far, I have not found a clear answer to this. I'd like to know what the equivalent is for a SQL type DATETIME and the java type, using a PreparedStatement. I ...

5. java.sql.Driver stub not being recognized by java.sql.DriverManger    stackoverflow.com

I am trying to unit test a thin data access layer that I've written. I was hoping I wouldn't have to inject a stub of DriverManager into the class that makes ...

6. Database access using parametrized and prepared statements    stackoverflow.com

Simple question. I am using Java and MySQL database. I want to write database access methods what would use PreparedStatement method and would be parametrized, such as:

 public DBResult selectQueryWithParameters(String SQL, ...

7. Which option is most efficient to insert data to mysql db?    stackoverflow.com

I have a mysql db with several tables, let's call them Table1, Table2, etc. I have to make several calls to each of these tables Which is most efficient, a) Collecting ...

8. SQL Where clause returns nothing - Beginner    stackoverflow.com

I have a table that has 3 fields, ID, Name, Address. (Name and Address are type String) There are instances, where the Address is left Null. How do i write an SQL ...

9. Object oriented approach using RDBMS    stackoverflow.com

I have a question regarding how to use an object oriented approach while using an RDBMS such as mysql. I am developing a small application that will keep track of billing. ...





10. Java Connection SQL isValid() not being recognized    stackoverflow.com

I keep getting the error "The method isValid(int) is undefined for the type Connection" I am currently using eclipse galileo, have JRE and JDK 6, and have all appropriate .jar files available. i ...

11. Why am I getting this error: java.sql.SQLException: Prepared statement needs to be re-prepared?    stackoverflow.com

I am getting the following error while running a batch job.

sql.SQLException: Prepared statement needs to be re-prepared
In what cases is this error encountered ?

12. mySQL database structure    stackoverflow.com

I'm kinda stuck in a tricky situation with the mySQL DB design for my webservice.The DB had initially this Structure:

   CREATE TABLE IF NOT EXISTS `Disease` (
   ...

13. mySQL nested loop wont execute    stackoverflow.com

I'm working on a SOAP based webservice where in a part of it i have to perform some queries on the database using nested loop, the problem is that the inner ...

14. Unable to access Sonar MySQL database Caused by: java.sql.SQLException: Access denied for user 'sonar'@'glassfishdev.ccs.local' (using password: YES)    stackoverflow.com

I am trying to add Sonar to my Continuous Integration build system. I am using ANT as my build script and I am using the sonar-ant-task-1.1.jar for sonar to generate the ...

15. SQL Syntax Error    stackoverflow.com

I have java code which connect to MySQL and retrive data. I have following code and it always give SQLSyntaxErrorException and says there is syntax error in line 1. I cant ...

16. java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0)    stackoverflow.com

I'm trying upload image to database using Java.
I've used following code to do that work.

File file= new File("image.jpg");
FileInputStream fis = new FileInputStream("image.jpg");

String query = "insert into mytable(id,image) values(?, ?)";
PreparedStatement stmt ...





17. accessing values from SQL database for xml namespace tags in java    stackoverflow.com

Hi i have written a java code to create xml tags in separate xml file(.xml) and query the database. my xml tag is in this format

<company comp:loc=" "/> 
now i ...

18. Finding MySQL status statistics in Java App    stackoverflow.com

In my Java app, I want to query the MySQL status statistics. I'm adding some simple monitoring (mostly writing alerts when certain settings reach certain thresholds). In any case, I can't ...

19. splitting a huge sql file to multiple sql files    stackoverflow.com

I have a huge SQL file that I want to restore to mysql server 5.5 .... while I'm restoring the the file at the middle of restoring process stopped, then i ...

20. Timespan in Java and SQL?    stackoverflow.com

I want to save time intervals in my SQL table but I'm not sure what type to use in Java for this. What I need to store are durations like 12:33:57 or ...

21. How to add mysql JDBC driver to Eclipse so it can be used by SQL Explorer?    stackoverflow.com

I would like where am I supposed to install MySQL JDBC driver in Eclipse so it can be detected and used by SQL Explorer. Just to be clear, if possible, I would ...

22. Connection from MySQL to remote DB - possible?    stackoverflow.com

is it possible to create a connection from a MySQL DB to a remote database (probably Oracle) using something like an ODBC/JDBC connector? I need to create a trigger on the ...

23. Can`t create entity classes from a database in netbeans 7.0.1    stackoverflow.com

I am trying to add entity classes that are from a database. I successfully created the connection resource using glass fish server and tested. But when i try to add the ...

24. How to determine which SQLException has been returned / where's the error codes list?    stackoverflow.com

I'm using com.mysql.jdbc.Driver (If it means anything). I want to be able to catch and properly process the exceptions I receive from MySQL. I want to know if the transaction failed, if ...

25. Can't see inserted data from MySQL immediately    stackoverflow.com

I am using JDBC.My test application inserts some data into MySQL,then query it via the same connection.I have four computers,one is MySQL server,three are UBuntu Desktops.In one UBuntu Desktop,my test application ...

26. Using batch SQL commands with MySQL JDBC    stackoverflow.com

I am trying to figure out the best way to get MySQL to use batch updates. I create, let's say, 10,000 records. Each record needs to be inserted into the DB like ...

27. Com.sql.DriverManager Not registering driver    stackoverflow.com

High, I'm trying to create a mysql instance inside my code by utilizing mysl-je.jar for both windows and Linux. When I try to register the embedded driver, I recwive a sql ...

28. com.mysql.jdbc.Driver not found when trying to add SQL features in Jitsi    stackoverflow.com

I'm coding on Jitsi using Eclipse: I have to use JDBC to connect to MySQL database, so I've imported java.sql.* in my MainFrame class and I've included mysql-connector-java-5.1.18.jar into "Java Build ...

29. MySql datetime not returning time    stackoverflow.com

I have a mysql db with a column with a datetime field. However, I cannot find a way in java to return this as some sort of time object within java, ...

30. Getting error in MySQL delete command through java code    stackoverflow.com

I have used jdbc to delete records from the table, while eexcuting the same, I got an error as I have shown below :

java.sql.SQLException: Before start of result set
   ...

31. Use sql with java - compiled into .jar - "ClassNotFoundException com.mysql.jdbc.Driver"    stackoverflow.com

I wanted to try using SQL with Java, so I downloaded mysql-connector-java-5.1.18-bin.jar. I'm using Eclipse, so I went into Eclipse, Project -> Properties and added the jar files. I also added the following ...

32. Problems setting up an SQL User-Defined Function in MySQL using the Java Language    stackoverflow.com

I have had quite some difficulty trying to make a User Defined Function (UDF) in Java for my MySQL Server. I was hoping I could ask for some help on this ...

33. why are my java files not being connected to my mysql database?    stackoverflow.com

I have downloaded the connector/jar file and moved it to the lib\ext folder. But when I run the ready-made code to test if the java file is connected to the database, ...

34. Using `java.sql.CallableStatement` many times without closing it    stackoverflow.com

I have a java.sql.CallableStatement with 3 parameters, and I need to call it many times, passing different values for the third parameters. What is the right way to do this? ...

35. Database encoding change to UTF8 causing java.lang.NullPointerException    stackoverflow.com

I'm running a Tomcat WAR, which uses a MySQL database. The application will run in foreign languages, so I had to change all database character parameters to utf8. One application string (appPrefix) has ...

36. JDBC / MYSQL: java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: NO)    stackoverflow.com

With this code

String url = "jdbc:mysql://localhost/mysql";
Connection con = DriverManager.getConnection(url, "root", "");
I get the following exception.
java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: NO)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073)
   ...

37. can JavaDB use SQL statements?    stackoverflow.com

I need to make a project in java where I am going to create a database, but my problem is, I don't know what to pick, I have knowledge about SQL(Select ...

38. java.sql.SQLException: No suitable driver found for jdbc:mysql:    jmeter.512774.n5.nabble.com

This post has NOT been accepted by the mailing list yet. Hi All, I want to test the database which is installed in a different server ( say dimvidi2202). But while I am running the test it gives the error as java.sql.SQLException: No suitable driver found for jdbc:mysql:. Any idea pls???? Is anywhere I am doing anything wrong... I did ...

39. SQL in MySQL    coderanch.com

40. Problem in SQL (MySQL) select password column    coderanch.com

I've had the same problem. Can I guess that you're not running *nux and are in Windows instead? If you search the MySQL docs, the password function is supported by the crypt() system call. This doesn't exist in Windows. I had a search and I think there are implementations you can plug in, but I never bothered... Is this the problem ...

42. Postgres SQL or MySQL    coderanch.com

When I set up my environment at my hosting company a few years back, I chose PostgreSQL over MySQL since, at least at the time, MySQL did not have transaction support. That may have changed since; I haven't really kept up since Postgres satisfies my DB needs completely. Another thing I really like about Postgres is its support of the LIMIT ...

44. Is HF SQL useful beyond MySQL?    coderanch.com

Hi Greg, it's actually more SQL than MySQL. It has a slight bias to MySQL, but is fairly generic SQL code which, with few exceptions, will play nicely with Oracle. The most important focus for me with this book was to get the concepts out there. It's easy to look up syntax when it occasionally varies, but to understand how and ...

45. Is Head First SQL usable for MySQL?    coderanch.com

46. Error at the time of importing sql_dump(MYSQL5.0 )    coderanch.com

You will have to find a tutorial about dumps in MySQL; there is something in "Beginning MySQL" by Sheldon and Moes (Wrox) which is a very nice book and not too expensive, but was printed in 2005 and could do with a new edition. "DDL" is usually taken to mean Data Definition Language and means things like "CREATE TABLE", as opposed ...

47. MySql 5.0.67 sql statement, command line versus jdbc PreparedStatement    coderanch.com

This simple sql statement works at the command line but not when executed through a PreparedStatement. I have looked at several examples on the web but have not found the error. Can anyone suggest something to try? mysql> select userName, password, userType from registered_users; +------------+----------+---------------+ | userName | password | userType | +------------+----------+---------------+ | tuser | tpwd | Student | | ...

49. SQL Syntax Error for MySQL but not sure where...    coderanch.com

Can someone spot my error? I cannot seem to figure it out. Could be my jdbc driver, I'm currently using 5.1.14 jdbc driver. public int update(String sku, String category, String description, String name, String price, String inventoryLevel, String brand, String gender, String size ) { int i; con = dbcon.SimpleConnection(); PreparedStatement ps = null; ResultSet rs; int prodId; try { System.out.println("Indise ...

51. You have an error in your SQL syntax; check the manual that corresponds to your MySQL    java-forums.org

Hi All, I have installed ubuntu 9 and downloaded mysql-server, JDBC connector and Eclipse 3.2 via synaptic Manager. The versions I have mysql-server 5.1 (5.1.31 ubuntu 2) mysqlclient 5.1 (5.1.31 ubuntu 2) libmysql-java 5.1.6 JDBC (mysql-connector-java-5.1.6-bin.jar) ubuntu 9 I was testing a simple code to check if a connection with a test database is established or not on mysql server but ...

52. Is it possible to load an external sql script by connecting to a mysql data    forums.oracle.com

hi, this is ayesha parween. Basically we manually connect to the mysql server and go to the administrator and take the back up of the file and load the sql script for creating a schema creating the tables and populating the tables with the data. Is it possible through some java jdbc for connecting to the mysql server and creating the ...

53. can we run a sql script for mysql database via java program?    forums.oracle.com

Mahendralal, welcome to the forum. Please don't post in threads that are long dead. When you have a question, start your own topic. Feel free to provide a link to an old post that may be relevant to your problem. Also, this is a forum, not a code factory. Recommended reading: [http://catb.org/~esr/faqs/smart-questions.html] I'm locking this thread now. db

54. java.sql.SQLException:No suitable driver found for jdbc:mysql    forums.oracle.com

Hi i am facing the problem of running a java program that queries an SQL database. It works perfect when i am running it with netbeans but has a problem in running through the command prompt this error message comes up java.sql.SQLException:No suitable driver found for jdbc:mysql://127.0.0.1:3306 can someone pls help me to fix it