I don't succeed to use slq2java.
I'm working in a project that it was developed by other people. They used sql2java to generate code automatically; to continue in their way, I would use same approach. I added a table on db and I have readen that needs modify the file sql2java.properties, but what in particular? The database's parameters are equals (I use the same database than before). In addition to modifying the code of the sql2java.properties file,do I have to do something else?
I hope that anyone can help me.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Giuseppe,
It has been a very long time since I used sql2java - I think there has been a release or two since I last used it. But, I do remember it being pretty easy to use.
Did you read the example page here: http://sql2java.sourceforge.net/example.html ? It shows how you use ant to run the generator. It also provides a link to the sql2java.properties file, which is pretty well documented with comments. You really just need to set the appropriate jdbc settings - sections 1/8 and 2/8.
Charl
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Charl,
thanks for the answer.
So, I have seen that example but when i configure that parameters, what do I have to do to generate the automatic code?
This is my code:
section 1/8 (db parameters)
jdbc.type=mysql
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://xxx.xxx.xx.xxx:3306/schema's name
jdbc.username=**
jdbc.password=*
jdbc.schema=schema's name
Giuseppe,
I'm assuming you are using the release version (2.6.7 is the latest). Unfortunately it looks like a lot of work has gone into the svn repo that didn't get released...
If you have ant available, you should be able to just run ant generate
in the unzipped directory. You can modify the build.xml file to have it point to the right sql2java.properties file (property sql2java-config). Or, you can copy your properties file into the config directory - that looks like it should work.
Good afternoon all,
I don't succeed to use slq2java.
I'm working in a project that it was developed by other people. They used sql2java to generate code automatically; to continue in their way, I would use same approach. I added a table on db and I have readen that needs modify the file sql2java.properties, but what in particular? The database's parameters are equals (I use the same database than before). In addition to modifying the code of the sql2java.properties file,do I have to do something else?
I hope that anyone can help me.
Hi Giuseppe,
It has been a very long time since I used sql2java - I think there has been a release or two since I last used it. But, I do remember it being pretty easy to use.
Did you read the example page here: http://sql2java.sourceforge.net/example.html ? It shows how you use ant to run the generator. It also provides a link to the sql2java.properties file, which is pretty well documented with comments. You really just need to set the appropriate jdbc settings - sections 1/8 and 2/8.
Charl
Hi Charl,
thanks for the answer.
So, I have seen that example but when i configure that parameters, what do I have to do to generate the automatic code?
This is my code:
section 1/8 (db parameters)
jdbc.type=mysql
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://xxx.xxx.xx.xxx:3306/schema's name
jdbc.username=**
jdbc.password=*
jdbc.schema=schema's name
section 2/8
generatedkey.retrieve=after
generatedkey.statement=SELECT last_insert_id()
When I've done this, what should I do?
I use mysql db and Intellij Idea as IDE.
Giuseppe,
I'm assuming you are using the release version (2.6.7 is the latest). Unfortunately it looks like a lot of work has gone into the svn repo that didn't get released...
If you have ant available, you should be able to just run
ant generate
in the unzipped directory. You can modify the build.xml file to have it point to the right sql2java.properties file (property sql2java-config). Or, you can copy your properties file into the config directory - that looks like it should work.
If you don't have ant available, you can look at the code for the Main class that does the generating. I found it in the cvs repo instead of the svn one: http://sql2java.cvs.sourceforge.net/viewvc/sql2java/sql2java/src/java/net/sourceforge/sql2java/Main.java?revision=1.7&view=markup
Good luck!
Charl