Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9164

Re: Connection String Special char

$
0
0

I quickly tested this in SQL Anywhere v16.0.0  with this code and it is working without any issues. The table t is owned by dba;

 

 

  String connectionString = "jdbc:sybase:Tds:localhost:2638?ServiceName=\"BANDENM&W\"";

  System.out.println( connectionString );

  Connection connection = DriverManager.getConnection(connectionString, "dba", "sql");

  Statement statement = connection.createStatement();

  ResultSet resultSet = statement.executeQuery("select * from t");

  while( resultSet.next() ) {

   System.out.println( resultSet.getInt(1) );

  }

 

However, if I create an user "u" and change the getConnection to

  Connection connection = DriverManager.getConnection(connectionString, "u", "sql");

 

The following is reported:

 

jdbc:sybase:Tds:localhost:2638?ServiceName="BANDENM&W"

Unexpected exception : com.sybase.jdbc3.jdbc.SybSQLException: SQL Anywhere Error -141: Tab

le 't' not found, sqlstate = 42W33

 

If I change the query to fully qualify the table (and assuming that the user "u" has permissions to query that table) as in:

 

ResultSet resultSet = statement.executeQuery("select * from dba.t");

 

the query completes without error.

 

I suspect that there are schema differences between the working and non-working database case and it is unlikely that the database name would result in the -141 error.


Viewing all articles
Browse latest Browse all 9164

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>