Hi all, I try to extract a database schema from a SQL Server 2005. I tried both drivers jTDS and the Microsoft JDBC Driver 1.2. In both versions I can access the database, but the resulting XML schema for Torque is empty.
When I run the JDBC task in build-torque.xml (fresh 3.3) I got this console
response:
jdbc:
[echo] +-----------------------------------------------+
[echo] | |
[echo] | Generating XML from JDBC connection ! |
[echo] | |
[echo] +-----------------------------------------------+
[torque-jdbc-transform] Torque - JDBCToXMLSchema starting
[torque-jdbc-transform] Your DB settings are:
[torque-jdbc-transform] driver : com.microsoft.sqlserver.jdbc.SQLServerDriver
[torque-jdbc-transform] URL :
jdbc:sqlserver://srv-poseidon;instanceName=orgasales;databaseName=OrgaSales;SelectMethod=cursor;integratedSecurity=true
[torque-jdbc-transform] user : orgasales
[torque-jdbc-transform] schema : orgasales
[torque-jdbc-transform] DB driver sucessfuly instantiated
[torque-jdbc-transform] DB connection established
[torque-jdbc-transform] Getting table list...
[torque-jdbc-transform] Building column/table map...
[torque-jdbc-transform] ./resources/schema/schema.xml
[torque-jdbc-transform] Torque - JDBCToXMLSchema finished
[echo] ...done.
BUILD SUCCESSFUL
Total time: 922 milliseconds
That looks good for me. When I use the jTDS driver only the URL is different.
But the resulting XML file looks like this:
<?xml version="1.0"?>
<!DOCTYPE database SYSTEM "http://db.apache.org/torque/dtd/database_3_3.dtd">
<!-- Autogenerated by JDBCToXMLSchema! -->
<database name="orgasales"/>
Hmmm, that's not good. Actually the database has more then 100 tables, the user
'orgasales' has admin rights and I can connect to the database via the MSSQL
console from my developer pc. The only thing that I didn't try is to call the
program directly on the machine. But this shouldn't be a problem, because I can
connect remotely.
The config file looks like this:
torque.database.host = srv-poseidon.cadooz-ag.intern
torque.database.type = mssql
torque.database.adaptor = mssql
torque.database.user = orgasales
torque.database.password = ...
torque.database.schema = orgasales
torque.database.driver = com.microsoft.sqlserver.jdbc.SQLServerDriver
torque.database.url =
jdbc:sqlserver://srv-poseidon;instanceName=orgasales;databaseName=OrgaSales;SelectMethod=cursor;integratedSecurity=true
torque.database.buildUrl = ${torque.database.url}
torque.database.validationQuery = SELECT 1
torque.database.default = orgasales
torque.database.cadooz.adapter = ${torque.database.type}
torque.dsfactory.cadooz.factory =
org.apache.torque.dsfactory.SharedPoolDataSourceFactory
torque.dsfactory.cadooz.pool.maxIdle = 8
torque.dsfactory.cadooz.pool.maxActive = 10
torque.dsfactory.cadooz.pool.maxWait = 10000
torque.dsfactory.cadooz.pool.timeBetweenEvictionRunsMillis = 300000
torque.dsfactory.cadooz.pool.minEvictableIdleTimeMillis = 3600000
torque.dsfactory.cadooz.pool.testOnBorrow = true
torque.dsfactory.cadooz.pool.validationQuery =
${torque.database.validationQuery}
torque.dsfactory.cadooz.connection.driver = ${torque.database.driver}
torque.dsfactory.cadooz.connection.url = ${torque.database.url}
torque.dsfactory.cadooz.connection.user = ${torque.database.user}
torque.dsfactory.cadooz.connection.password = ${torque.database.password}
torque.manager.useCache = true
torque.home = .
torque.project = cadooz
torque.database = mssql
torque.targetPackage = com.cadooz.framework.orgasales
torque.subpackage.map = map
torque.subpackage.manager = manager
torque.runOnlyOnSchemaChange = false
torque.output.dir = .
torque.schema.dir = ${torque.home}/resources/schema
torque.java.dir = ${torque.home}/src
torque.sql.dir = ${torque.home}/resources/schema
torque.useManagers = false
In case of the jTDS driver the connection string looks like this:
torque.database.driver = net.sourceforge.jtds.jdbc.Driver
torque.database.url =
jdbc:jtds:sqlserver://srv-poseidon.cadooz-ag.intern:1433/OrgaSales;instance=OrgaSales
Has someone an idea what I can do to get a XML schema from this database? I
really don't like to edit the scheme file by hand this time ;-)
Thanks,
Thoralf
smime.p7s
Description: S/MIME cryptographic signature
