20
votes
5answers
16k views

Java connectivity with MySQL

Can anyone explain me how to connect Java with MySQL?
115
votes
9answers
61k views

How to get UTF-8 working in java webapps?

I need to get UTF-8 working in my Java webapp (servlets + JSP, no framework used) to support äöå etc. for regular Finnish text and Cyrillic alphabets like ЦжФ for special cases. My setup is the ...
4
votes
2answers
10k views

JDBC MySql Connection Pooling practices

I have a Java-JSF Web Application on GlassFish, in which I want to use connection pooling. Therefore I created an application scoped bean that serves with Connection instances for other beans: import ...
33
votes
9answers
16k views

LINQ for Java tool [closed]

Would a LINQ for java be a useful tool? I have been working on a tool that will allow a Java object to map to a row in a database. Would this be useful for Java programmers? What features would ...
2
votes
3answers
3k views

How I save and retrieve an image on my server in a java webapp

Here with another question on Images ( which seems to be more difficult than I initialy predicted) I'm working on a java Web app with JSF 2.0 ( apache myFaces) and I want this app to be able to upload ...
2
votes
5answers
489 views
+100

Achieve hierarchy in a less number of mysql queries

I have a table like create table site ( site_Id int(5), parent_Id int(5), site_desc varchar2(100) ); Significance of the fields: site_Id : Id of the sites parent_Id : Parent id of the site ...
4
votes
2answers
5k views

Handling MySQL datetimes and timestamps in Java

In a java application what would a good compromise in terms of extracing and inputting date information with a MySQL database using a mix of datetimes and timestamps?
13
votes
5answers
19k views

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

I'm working on getting my database to talk to my Java programs. What do I need to get started? Having already read through (and been thoroughly confused, something that does not happen often) with ...
27
votes
5answers
6k views

How can I protect MySQL username and password from decompiling?

Java .class files can be decompiled fairly easily. How can I protect my database if I have to use the login data in the code?
2
votes
6answers
958 views

Getting last record from mysql

I am using mysql and facing some problem. I want to retrieve last row that is inserted. << Below are details >> Below is how I created table. create table maxID (myID varchar(4)) I inserted ...
9
votes
2answers
18k views

Java: Insert multiple rows into MySQL with PreparedStatement

I want to insert multiple rows into a MySQL table at once using Java. The number of rows is dynamic. In the past I was doing... for (String element : array) { myStatement.setString(1, ...
6
votes
2answers
18k views

How should I connect to a MySQL data source from Eclipse?

I have an external MySQL server that's set up and working fine. I created a database connection in Eclipse and can view the database in the Data Source Explorer tab. Now, I have a servlet that needs ...
3
votes
4answers
3k views

Android JDBC not working: ClassNotFoundException on driver

I'm trying to use JDBC in my Android application to connect to a remote database to do inserts, queries, etc. I have successfully connected and done these things in a different JAVA project. So I ...
11
votes
8answers
10k views

Running a .sql script using MySQL with JDBC

I am starting to use MySQL with JDBC. Class.forName("com.mysql.jdbc.Driver"); conn = DriverManager.getConnection("jdbc:mysql:///x", "x", "x"); stmt = conn.createStatement(); stmt.execute( "CREATE ...
22
votes
9answers
10k views

Is there a more efficient way of making pagination in Hibernate than executing select and count queries?

Usually pagination queries look like this. Is there a better way instead of making two almost equal methods, one of which executing "select *..." and the other one "count *..."? public ...

1 2 3 4 5 28
15 30 50 per page