Connector/j PreparedStatement DOESn't work
6 Message(s) by 2 Author(s) originally posted in mysql java
| From: ProgDario |
Date: Monday, July 17, 2006
|
Hi,
I'm using JAVA 5 with
connect or/j 3.1.13.
I've a stupid
query with two
string parameters.
When I set the parameters and
execute the query, it simply does not
work, and the worst is that it does not show throw any exceptions. The
result set is empty.
If I do not use the preparedstatement, it works.
I'm really get frustrated with this. Any hint?Thanks!!Dario
| From: ProgDario |
Date: Monday, July 17, 2006
|
SOLVED!!
I respond to myself: you are a stupid guy!!
It was a mistake due to a distraction. I was compairing an md5-ed
wrote in message:
Hi,
I'm using JAVA 5 with connector/j 3.1.13.
I've a stupid query with two string parameters.
When I set the parameters and execute the query, it simply does not
work, and the worst is that it does not show throw any exceptions. The
result set is empty.
If I do not use the preparedstatement, it works.
I'm really get frustrated with this. Any hint?
Thanks!!
Dario
| From: Joseph |
Date: Sunday, August 27, 2006
|
Hi Dario,
I'm trying to get my JAVA with my connector to work for a small example.
if you can help here as I'm not sure how to get this accomplish that
would be great.
Thanks
wrote in message:
SOLVED!!
I respond to myself: you are a stupid guy!!
It was a mistake due to a distraction. I was compairing an md5-ed
password with a not md5-ed password.
Dario
wrote in message:
Hi,
I'm using JAVA 5 with connector/j 3.1.13.
I've a stupid query with two string parameters.
When I set the parameters and execute the query, it simply does not
work, and the worst is that it does not show throw any exceptions. The
result set is empty.
If I do not use the preparedstatement, it works.
I'm really get frustrated with this. Any hint?
Thanks!!
Dario
| From: ProgDario |
Date: Wednesday, August 30, 2006
|
Here are some useful link:
http://dev.mysql.com/tech-resources/articles/connection_pooling_with_connectorj.html
In my example, I used a datasource with a JNDI name configured in the
webserver.
Please can you tell me what's wrong with your example, so I can give
you some hint?By
DarioJoseph ha scritto:
Hi Dario,
I'm trying to get my JAVA with my connector to work for a small example.
if you can help here as I'm not sure how to get this accomplish that
would be great.
Thanks
Joseph
wrote in message:
> SOLVED!!
>
> I respond to myself: you are a stupid guy!!
>
> It was a mistake due to a distraction. I was compairing an md5-ed
> password with a not md5-ed password.
>
>
> Dario
>
>
wrote in message:
>
Hi,
I'm using JAVA 5 with connector/j 3.1.13.
I've a stupid query with two string parameters.
When I set the parameters and execute the query, it simply does not
work, and the worst is that it does not show throw any exceptions. The
result set is empty.
If I do not use the preparedstatement, it works.
I'm really get frustrated with this. Any hint?
Thanks!!
Dario
>
>
| From: Joseph |
Date: Friday, September 15, 2006
|
Hi Dario,
I am running Fedora, and downloaded connector/J the last one. Also have
JAVA "/usr/JAVA/jdk1.5.0_05/bin/JAVA" installed. I also got MySql
installed but need to
write some
code in JAVA to access the
database and
can not do that. I'm
newbie here so a little more of details from you
might put me on the right path.
wrote in message:
Here are some useful link:
http://dev.mysql.com/tech-resources/articles/connection_pooling_with_connectorj.html
In my example, I used a datasource with a JNDI name configured in the
webserver.
Please can you tell me what's wrong with your example, so I can give
you some hint?
By
Dario
Joseph ha scritto:
Hi Dario,
I'm trying to get my JAVA with my connector to work for a small example.
if you can help here as I'm not sure how to get this accomplish that
would be great.
Thanks
Joseph
wrote in message:
SOLVED!!
I respond to myself: you are a stupid guy!!
It was a mistake due to a distraction. I was compairing an md5-ed
password with a not md5-ed password.
Dario
wrote in message:
Hi,
I'm using JAVA 5 with connector/j 3.1.13.
I've a stupid query with two string parameters.
When I set the parameters and execute the query, it simply does not
work, and the worst is that it does not show throw any exceptions. The
result set is empty.
If I do not use the preparedstatement, it works.
I'm really get frustrated with this. Any hint?
Thanks!!
Dario
| From: ProgDario |
Date: Tuesday, September 19, 2006
|
HI Joseph,
I will try to be more detailed.
There are two ways you can access a DB:
1- You directtly create a connection, and use it for querying the
tables
2- By using a Pooled connection, but this approach involves some
configuring stuff on web
server files.
I assume you prefer to directly connect to the db WITHOUT the pool
connection feature.
First of all, you've to
include the connector
jar into your classpath
(I hope you are using eclipse).
Then, these are the lines you basically have to write (didn't tested
this code):
dbUrl = "jdbc:mysql://server:port;database_name=db_name";
Class.forName("com.mysql.jdbc.Driver");
connection = DriverManager.getConnection(dbUrl, user, password);For the
URL variable, you've to consult the connector/j documentation
in order to compose the correct url.
Useful links:
http://dev.mysql.com/doc/refman/5.0/en/connector-j-usagenotes-basic.html#connector-j-examples-connection-drivermanager
http://www.stardeveloper.com/articles/display.html?article=2003090401&page=1
Hope this helps!!Dario
Joseph ha scritto:
Hi Dario,
I am running Fedora, and downloaded connector/J the last one. Also have
JAVA "/usr/JAVA/jdk1.5.0_05/bin/JAVA" installed. I also got MySql
installed but need to write some code in JAVA to access the database and
can not do that. I'm newbie here so a little more of details from you
might put me on the right path.
Thanks
wrote in message:
> Here are some useful link:
>
> http://dev.mysql.com/tech-resources/articles/connection_pooling_with_connectorj.html
>
> In my example, I used a datasource with a JNDI name configured in the
> webserver.
>
> Please can you tell me what's wrong with your example, so I can give
> you some hint?
>
>
> By
>
> Dario
>
>
> Joseph ha scritto:
>
>
Hi Dario,
I'm trying to get my JAVA with my connector to work for a small example.
if you can help here as I'm not sure how to get this accomplish that
would be great.
Thanks
Joseph
wrote in message:
>SOLVED!!
>
>I respond to myself: you are a stupid guy!!
>
>It was a mistake due to a distraction. I was compairing an md5-ed
>password with a not md5-ed password.
>
>
>Dario
>
>
wrote in message:
>
>
Hi,
I'm using JAVA 5 with connector/j 3.1.13.
I've a stupid query with two string parameters.
When I set the parameters and execute the query, it simply does not
work, and the worst is that it does not show throw any exceptions. The
result set is empty.
If I do not use the preparedstatement, it works.
I'm really get frustrated with this. Any hint?
Thanks!!
Dario
>
>
>
Next Message: trying to "connect"
Blogs related to Connector/j PreparedStatement DOESn't work
MySQL and Prepared Statements
As a result the
MySQL Connector/J JDBC driver has now been modified so that calls
... to prepare the statement but the server
doesn't have the appropriate support yet.
... The
work around for me was to use createStatement() instead of
...
MySQL :: MySQL Connector/J 3.1.13 Has Been Released
MySQL Connector/J 3.1.13, a new version of the Type-IV all-Java JDBC
... Fixed BUG#19615,
PreparedStatement.setObject(int, Object, int)
doesn't respect scale of BigDecimals.
... getSomeNumeric() didn't
work for the BIT type.
...