开发者

IBatis and SQL Server on Java

开发者 https://www.devze.com 2023-02-10 19:18 出处:网络
I\'m trying to make a Java connection with SQL Server, but I\'m facing some problemas. I believe I not specifying correctly the database name. My SQL Map is something like

I'm trying to make a Java connection with SQL Server, but I'm facing some problemas. I believe I not specifying correctly the database name. My SQL Map is something like

    <transactionManager type="JDBC">
    <dataSource type="SIMPLE">
        <property value="com.microsoft.sqlserver.jdbc.SQLServerDriver" name="JDBC.Driver" />
        <property value="jdbc:sqlserver://${host}:${port}" name="JDBC.ConnectionURL" />
        <property value="${name}" name="JDBC.DatabaseName" />
        <property value="${username}" name="JDBC.Username" />
        <property value="${password}" name="JDBC.Password开发者_运维知识库" />
    </dataSource>
</transactionManager>

I connection is successfully, but when I try to retrieve some value from one of ours tables, it's show the error: Invalid object name '[table name]'

How can I specify my database name in this SQL Map?

Thanks in advance


I always know that JDBC.DatabaseName doesn't exists, but I tried. Now, I try changing this key and I found, in SQLMap docs, Driver.Key is used to set driver properties, so I change JDBC.DatabaseName to Driver.DatabaseName, and It works!!!!!

<transactionManager type="JDBC">
    <dataSource type="SIMPLE">
        <property value="com.microsoft.sqlserver.jdbc.SQLServerDriver" name="JDBC.Driver" />
        <property value="jdbc:sqlserver://${host}:${port}" name="JDBC.ConnectionURL" />
        <property value="${name}" name="Driver.DatabaseName" />
        <property value="${username}" name="JDBC.Username" />
        <property value="${password}" name="JDBC.Password" />
    </dataSource>
</transactionManager>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号